diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2022-12-27 01:01:06 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2022-12-27 01:08:42 +0900 |
commit | 12af069dcad672b1563388c61ec33ba8a86c013e (patch) | |
tree | 887acd14cfe3ee74b6e181129765e27d9660fcb6 /test/test_go.rb | |
parent | d42e708d3140aab099b30014a9cbebafb8b66692 (diff) |
Add pos(...) action to move the cursor to the numeric position
# Put the cursor on the 10th item
seq 100 | fzf --sync --bind 'start:pos(10)'
# Put the cursor on the 10th to last item
seq 100 | fzf --sync --bind 'start:pos(-10)'
Close #3069
Close #395
Diffstat (limited to 'test/test_go.rb')
-rwxr-xr-x | test/test_go.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/test_go.rb b/test/test_go.rb index 4c424396..2956d189 100755 --- a/test/test_go.rb +++ b/test/test_go.rb @@ -1605,6 +1605,21 @@ class TestGoFZF < TestBase tmux.send_keys :Enter end + def test_pos + tmux.send_keys %(seq 1000 | #{FZF} --bind 'a:pos(3),b:pos(-3),c:pos(1),d:pos(-1),e:pos(0)' --preview 'echo {}/{}'), :Enter + tmux.until { |lines| assert_equal 1000, lines.match_count } + tmux.send_keys :a + tmux.until { |lines| assert_includes lines[1], ' 3/3' } + tmux.send_keys :b + tmux.until { |lines| assert_includes lines[1], ' 998/998' } + tmux.send_keys :c + tmux.until { |lines| assert_includes lines[1], ' 1/1' } + tmux.send_keys :d + tmux.until { |lines| assert_includes lines[1], ' 1000/1000' } + tmux.send_keys :e + tmux.until { |lines| assert_includes lines[1], ' 1/1' } + end + def test_accept_non_empty tmux.send_keys %(seq 1000 | #{fzf('--print-query --bind enter:accept-non-empty')}), :Enter tmux.until { |lines| assert_equal 1000, lines.match_count } |