mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-01 20:52:06 -07:00
@@ -2755,11 +2755,15 @@ func (t *Terminal) printItem(result Result, line int, maxLine int, index int, cu
|
||||
item := result.item
|
||||
_, selected := t.selected[item.Index()]
|
||||
label := ""
|
||||
extraWidth := 0
|
||||
if t.jumping != jumpDisabled {
|
||||
if index < len(t.jumpLabels) {
|
||||
// Striped
|
||||
current = index%2 == 0
|
||||
label = t.jumpLabels[index:index+1] + strings.Repeat(" ", t.pointerLen-1)
|
||||
label = t.jumpLabels[index:index+1] + strings.Repeat(" ", util.Max(0, t.pointerLen-1))
|
||||
if t.pointerLen == 0 {
|
||||
extraWidth = 1
|
||||
}
|
||||
}
|
||||
} else if current {
|
||||
label = t.pointer
|
||||
@@ -2788,6 +2792,7 @@ func (t *Terminal) printItem(result Result, line int, maxLine int, index int, cu
|
||||
|
||||
maxWidth := t.window.Width() - (t.pointerLen + t.markerLen + 1)
|
||||
postTask := func(lineNum int, width int, wrapped bool, forceRedraw bool) {
|
||||
width += extraWidth
|
||||
if (current || selected) && t.highlightLine {
|
||||
color := tui.ColSelected
|
||||
if current {
|
||||
|
@@ -827,6 +827,24 @@ class TestCore < TestInteractive
|
||||
tmux.until { |lines| assert(lines.any? { it.include?('jump cancelled at 3') }) }
|
||||
end
|
||||
|
||||
def test_jump_no_pointer
|
||||
tmux.send_keys "seq 100 | #{FZF} --pointer= --jump-labels 12345 --bind ctrl-j:jump", :Enter
|
||||
tmux.until { |lines| assert_equal 100, lines.match_count }
|
||||
tmux.send_keys 'C-j'
|
||||
tmux.until { |lines| assert_equal '5 5', lines[-7] }
|
||||
tmux.send_keys 'C-c'
|
||||
tmux.until { |lines| assert_equal ' 5', lines[-7] }
|
||||
end
|
||||
|
||||
def test_jump_no_pointer_no_marker
|
||||
tmux.send_keys "seq 100 | #{FZF} --pointer= --marker= --jump-labels 12345 --bind ctrl-j:jump", :Enter
|
||||
tmux.until { |lines| assert_equal 100, lines.match_count }
|
||||
tmux.send_keys 'C-j'
|
||||
tmux.until { |lines| assert_equal '55', lines[-7] }
|
||||
tmux.send_keys 'C-c'
|
||||
tmux.until { |lines| assert_equal '5', lines[-7] }
|
||||
end
|
||||
|
||||
def test_pointer
|
||||
tmux.send_keys "seq 10 | #{fzf("--pointer '>>'")}", :Enter
|
||||
# Assert that specified pointer is displayed
|
||||
|
Reference in New Issue
Block a user