Skip to content

Commit 66df240

Browse files
authored
Fix panic when use header border without pointer/marker (#4345)
1 parent ed4442d commit 66df240

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Diff for: src/terminal.go

+3
Original file line numberDiff line numberDiff line change
@@ -2647,6 +2647,9 @@ func (t *Terminal) headerIndent(borderShape tui.BorderShape) int {
26472647
}
26482648
if borderShape.HasLeft() {
26492649
indentSize -= 1 + t.borderWidth
2650+
if indentSize < 0 {
2651+
indentSize = 0
2652+
}
26502653
}
26512654
return indentSize
26522655
}

Diff for: test/test_layout.rb

+12
Original file line numberDiff line numberDiff line change
@@ -991,4 +991,16 @@ def test_change_header_and_label_at_once
991991
BLOCK
992992
tmux.until { assert_block(block, it) }
993993
end
994+
995+
def test_header_border_no_pointer_and_marker
996+
tmux.send_keys %(seq 10 | #{FZF} --header-lines 1 --header-border sharp --no-list-border --pointer '' --marker ''), :Enter
997+
block = <<~BLOCK
998+
┌──────
999+
│ 1
1000+
└──────
1001+
9/9 ─
1002+
>
1003+
BLOCK
1004+
tmux.until { assert_block(block, it) }
1005+
end
9941006
end

0 commit comments

Comments
 (0)