mirror of
https://github.com/junegunn/fzf.git
synced 2026-04-27 09:41:31 +08:00
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:
+9
-2
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user