Fix misleading comment on printHeader nil-window guard

The guard fires when hasHeaderWindow() returned false at resize time,
not when addInline had no budget (placeInlineStack always leaves a
non-nil 0-height placeholder).
This commit is contained in:
Junegunn Choi
2026-04-19 19:12:51 +09:00
parent 01567b4f06
commit 251b08b831

View File

@@ -3432,10 +3432,12 @@ func (t *Terminal) printHeader() {
return
}
// When an inline section was requested but addInline had no budget, its window is
// nil. Don't fall through to withWindow — that would leak header content into the
// list window. A nil window is only legitimate when the shape is NOT inline (e.g.
// header combined with the list when --no-list-border is in effect).
// headerWindow is nil when hasHeaderWindow() returned false at resize time,
// e.g. --header-border=inline combined with empty header content. Don't
// delegate to printHeaderImpl because its nil-window branch folds the header
// into the list window, which isn't valid for inline. A nil window is only
// legitimate when the shape is NOT inline (e.g. header combined with the
// list when --no-list-border is in effect).
if !(t.headerBorderShape == tui.BorderInline && t.headerWindow == nil) {
t.withWindow(t.headerWindow, func() {
var headerItems []Item