Redraw when change-footer changes line count

Mirror of the earlier change-header fix. The inline footer slot's row
budget depends on footer content length, but resizeIfNeeded() tolerates
a shorter-than-wanted inline window, so extra lines get clipped. Drive
a redraw on length change to re-run the layout.
This commit is contained in:
Junegunn Choi
2026-04-21 18:41:48 +09:00
parent 7782da6c00
commit 56be41218c
2 changed files with 22 additions and 3 deletions
+9 -2
View File
@@ -1816,14 +1816,16 @@ func (t *Terminal) changeHeader(header string) bool {
return needFullRedraw
}
func (t *Terminal) changeFooter(footer string) {
func (t *Terminal) changeFooter(footer string) bool {
var lines []string
if len(footer) > 0 {
lines = strings.Split(strings.TrimSuffix(footer, "\n"), "\n")
}
needFullRedraw := len(t.footer) != len(lines)
t.footer = lines
t.clickFooterLine = 0
t.clickFooterColumn = 0
return needFullRedraw
}
// UpdateHeader updates the header
@@ -6796,7 +6798,12 @@ func (t *Terminal) Loop() error {
})
case actChangeFooter, actTransformFooter, actBgTransformFooter:
capture(false, func(footer string) {
t.changeFooter(footer)
if t.changeFooter(footer) && t.footerBorderShape == tui.BorderInline {
// resizeIfNeeded() tolerates a shorter-than-wanted inline
// window, so a length change can leave the inline slot
// stale. Force a redraw to re-run the layout.
req(reqRedraw)
}
req(reqFooter)
})
case actChangeHeaderLabel, actTransformHeaderLabel, actBgTransformHeaderLabel: