From 6d235bceee66bd6b7ca2de8311a3deae4793bfa8 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 18 May 2016 02:06:52 +0900 Subject: Add jump and jump-accept actions for --bind jump and jump-accept implement EasyMotion-like movement in fzf. Suggested by @mhrebenyuk. Close #569. --- test/test_go.rb | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'test') diff --git a/test/test_go.rb b/test/test_go.rb index 02bf08d2..8f336932 100644 --- a/test/test_go.rb +++ b/test/test_go.rb @@ -1181,6 +1181,43 @@ class TestGoFZF < TestBase tmux.send_keys :Enter end + def test_jump + tmux.send_keys "seq 1000 | #{fzf "--multi --jump-labels 12345 --bind 'ctrl-j:jump'"}", :Enter + tmux.until { |lines| lines[-2] == ' 1000/1000' } + tmux.send_keys 'C-j' + tmux.until { |lines| lines[-7] == '5 5' } + tmux.until { |lines| lines[-8] == ' 6' } + tmux.send_keys '5' + tmux.until { |lines| lines[-7] == '> 5' } + tmux.send_keys :Tab + tmux.until { |lines| lines[-7] == ' >5' } + tmux.send_keys 'C-j' + tmux.until { |lines| lines[-7] == '5>5' } + tmux.send_keys '2' + tmux.until { |lines| lines[-4] == '> 2' } + tmux.send_keys :Tab + tmux.until { |lines| lines[-4] == ' >2' } + tmux.send_keys 'C-j' + tmux.until { |lines| lines[-7] == '5>5' } + + # Press any key other than jump labels to cancel jump + tmux.send_keys '6' + tmux.until { |lines| lines[-3] == '> 1' } + tmux.send_keys :Tab + tmux.until { |lines| lines[-3] == '>>1' } + tmux.send_keys :Enter + assert_equal %w[5 2 1], readonce.split($/) + end + + def test_jump_accept + tmux.send_keys "seq 1000 | #{fzf "--multi --jump-labels 12345 --bind 'ctrl-j:jump-accept'"}", :Enter + tmux.until { |lines| lines[-2] == ' 1000/1000' } + tmux.send_keys 'C-j' + tmux.until { |lines| lines[-7] == '5 5' } + tmux.send_keys '3' + assert_equal '3', readonce.chomp + end + private def writelines path, lines File.unlink path while File.exists? path -- cgit v1.2.3