Fix adaptive height calculation to exclude header lines
Some checks failed
CodeQL / Analyze (go) (push) Has been cancelled
build / build (push) Has been cancelled
Test fzf on macOS / build (push) Has been cancelled

The adaptive height (--height ~100%) was using the raw chunklist count
including header items, making the window too tall by headerLines rows.
This commit is contained in:
Junegunn Choi
2026-02-23 02:21:41 +09:00
parent b9804f5873
commit 4d6a7757b8

View File

@@ -323,10 +323,11 @@ func Run(opts *Options) (int, error) {
query := []rune{}
determine := func(final bool) {
if heightUnknown {
if total >= maxFit || final {
items := max(0, total-int(headerLines))
if items >= maxFit || final {
deferred = false
heightUnknown = false
terminal.startChan <- fitpad{min(total, maxFit), padHeight}
terminal.startChan <- fitpad{min(items, maxFit), padHeight}
}
} else if deferred {
deferred = false