Fix adaptive height with an inline header or footer border
CodeQL / Analyze (go) (push) Canceled after 0s
build / build (push) Canceled after 0s
Test fzf on macOS / build (push) Canceled after 0s

- extraLines() used borderLines(), which reports zero for BorderInline
- Divider drawn for an inline section still takes a line, and
  resizeWindows() reserves it via addInline()
- So adaptive height came up one line short per inline section and the
  list scrolled
- Affects --header-lines-border, --header-border and --footer-border
  alike. All three set came up three lines short
- Without a list border the shape normalizes to BorderTop or BorderBottom,
  which report a line, hence --no-list-border looked like a fix

    seq 10 | fzf --height=~100% --list-border \
                 --header-lines=1 --header-lines-border=inline

Fix #4904
This commit is contained in:
Junegunn Choi committed 2026-09-06 11:27:17 +09:00
1 parent a52ac843d7
commit 1372d04f79
3 files changed
+35 -3

No files matched your search

+11 -3
View File
@@ -1547,6 +1547,14 @@ func (t *Terminal) visibleInputLinesInList() int {
// Extra number of lines needed to display fzf
func (t *Terminal) extraLines() int {
// borderLines() reports zero for BorderInline, but addInline() still
// reserves a divider line for it
sectionLines := func(shape tui.BorderShape) int {
if shape == tui.BorderInline {
return 1
}
return borderLines(shape)
}
extra := 0
if !t.inputless {
extra++
@@ -1562,16 +1570,16 @@ func (t *Terminal) extraLines() int {
}
if t.headerVisible {
if t.hasHeaderWindow() {
extra += borderLines(t.headerBorderShape)
extra += sectionLines(t.headerBorderShape)
}
extra += len(t.header0)
if w, shape := t.determineHeaderLinesShape(); w {
extra += borderLines(shape)
extra += sectionLines(shape)
}
extra += t.headerLines
}
if len(t.footer) > 0 {
extra += borderLines(t.footerBorderShape)
extra += sectionLines(t.footerBorderShape)
extra += len(t.footer)
}
return extra