m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-16 15:23:48 -05:00

Fix regression where header is not updated

This commit is contained in:
Junegunn Choi
2025-07-06 20:04:03 +09:00
parent fb570e94e7
commit d364a1122e
2 changed files with 13 additions and 7 deletions

View File

@@ -2901,16 +2901,19 @@ func (t *Terminal) resizeIfNeeded() bool {
// Check if the header borders are used and header has changed // Check if the header borders are used and header has changed
allHeaderLines := t.visibleHeaderLines() allHeaderLines := t.visibleHeaderLines()
primaryHeaderLines := allHeaderLines primaryHeaderLines := allHeaderLines
if t.hasHeaderLinesWindow() { needHeaderWindow := t.hasHeaderWindow()
needHeaderLinesWindow := t.hasHeaderLinesWindow()
if needHeaderLinesWindow {
primaryHeaderLines -= t.headerLines primaryHeaderLines -= t.headerLines
} }
// FIXME: Full redraw is triggered if there are too many lines in the header // FIXME: Full redraw is triggered if there are too many lines in the header
// so that the header window cannot display all of them. // so that the header window cannot display all of them.
needHeaderLinesWindow := t.hasHeaderLinesWindow() if (needHeaderWindow && t.headerWindow == nil) ||
if (t.headerBorderShape.Visible() || needHeaderLinesWindow) && (!needHeaderWindow && t.headerWindow != nil) ||
(t.headerWindow == nil && primaryHeaderLines > 0 || t.headerWindow != nil && primaryHeaderLines != t.headerWindow.Height()) || (needHeaderWindow && t.headerWindow != nil && primaryHeaderLines != t.headerWindow.Height()) ||
needHeaderLinesWindow && (t.headerLinesWindow == nil || t.headerLinesWindow != nil && t.headerLines != t.headerLinesWindow.Height()) || (needHeaderLinesWindow && t.headerLinesWindow == nil) ||
!needHeaderLinesWindow && t.headerLinesWindow != nil { (!needHeaderLinesWindow && t.headerLinesWindow != nil) ||
(needHeaderLinesWindow && t.headerLinesWindow != nil && t.headerLines != t.headerLinesWindow.Height()) {
t.printAll() t.printAll()
return true return true
} }

View File

@@ -1930,7 +1930,10 @@ class TestCore < TestInteractive
def test_change_header_on_header_window def test_change_header_on_header_window
tmux.send_keys %(seq 100 | #{FZF} --list-border --input-border --bind 'start:change-header(foo),space:change-header(bar)'), :Enter tmux.send_keys %(seq 100 | #{FZF} --list-border --input-border --bind 'start:change-header(foo),space:change-header(bar)'), :Enter
tmux.until { |lines| assert lines.any_include?('foo') } tmux.until do |lines|
assert lines.any_include?('100/100')
assert lines.any_include?('foo')
end
tmux.send_keys :Space tmux.send_keys :Space
tmux.until { |lines| assert lines.any_include?('bar') } tmux.until { |lines| assert lines.any_include?('bar') }
end end