summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphanium <91544758+phanen@users.noreply.github.com>2025-04-13 19:24:29 +0800
committerGitHub <noreply@github.com>2025-04-13 20:24:29 +0900
commit66df24040fed3c76df545fc34b47387c86922786 (patch)
tree42e9bd83fb67daac3b2a6033b796046fce12adb5
parented4442d9eaef9bc6dfb65b4f6c2b079060bbb4f7 (diff)
downloadfzf-66df24040fed3c76df545fc34b47387c86922786.tar.gz
Fix panic when use header border without pointer/marker (#4345)
-rw-r--r--src/terminal.go3
-rw-r--r--test/test_layout.rb12
2 files changed, 15 insertions, 0 deletions
diff --git a/src/terminal.go b/src/terminal.go
index e1d14adc..7d826fa3 100644
--- a/src/terminal.go
+++ b/src/terminal.go
@@ -2647,6 +2647,9 @@ func (t *Terminal) headerIndent(borderShape tui.BorderShape) int {
}
if borderShape.HasLeft() {
indentSize -= 1 + t.borderWidth
+ if indentSize < 0 {
+ indentSize = 0
+ }
}
return indentSize
}
diff --git a/test/test_layout.rb b/test/test_layout.rb
index 401f0f35..ed384712 100644
--- a/test/test_layout.rb
+++ b/test/test_layout.rb
@@ -991,4 +991,16 @@ class TestLayout < TestInteractive
BLOCK
tmux.until { assert_block(block, it) }
end
+
+ def test_header_border_no_pointer_and_marker
+ tmux.send_keys %(seq 10 | #{FZF} --header-lines 1 --header-border sharp --no-list-border --pointer '' --marker ''), :Enter
+ block = <<~BLOCK
+ ┌──────
+ │ 1
+ └──────
+ 9/9 ─
+ >
+ BLOCK
+ tmux.until { assert_block(block, it) }
+ end
end