Commit c3c3ade
Eric Bower
·
2026-01-16 19:45:17 -0500 EST
parent 5e4c326
fix(tui): border boundaries
1 files changed,
+16,
-2
+16,
-2
| ... | ... | @@ -90,11 +90,25 @@ func (b *Border) HandleEvent(vaxis.Event, vxfw.EventPhase) (vxfw.Command, error) | |
| 90 | 90 | } | |
| 91 | 91 | ||
| 92 | 92 | func (b *Border) Draw(ctx vxfw.DrawContext) (vxfw.Surface, error) { | |
| 93 | + | // Ensure minimum bounds for child widget | |
| 94 | + | maxWidth := ctx.Max.Width | |
| 95 | + | maxHeight := ctx.Max.Height | |
| 96 | + | if maxWidth > 2 { | |
| 97 | + | maxWidth = maxWidth - 2 | |
| 98 | + | } else { | |
| 99 | + | maxWidth = 1 | |
| 100 | + | } | |
| 101 | + | if maxHeight > 3 { | |
| 102 | + | maxHeight = maxHeight - 3 | |
| 103 | + | } else if maxHeight > 0 { | |
| 104 | + | maxHeight = 1 | |
| 105 | + | } | |
| 106 | + | ||
| 93 | 107 | surf, _ := b.w.Draw(vxfw.DrawContext{ | |
| 94 | 108 | Characters: ctx.Characters, | |
| 95 | 109 | Max: vxfw.Size{ | |
| 96 | - | Width: ctx.Max.Width - 2, | |
| 97 | - | Height: ctx.Max.Height - 3, | |
| 110 | + | Width: maxWidth, | |
| 111 | + | Height: maxHeight, | |
| 98 | 112 | }, | |
| 99 | 113 | }) | |
| 100 | 114 |