diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2020-07-27 00:15:25 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2020-07-27 00:27:03 +0900 |
commit | 0f9cb5590ec0a397143a7a4caf003a54885f4375 (patch) | |
tree | 68f3e5e8adf27919e3656d741ecadce6d5f6f2c8 /test | |
parent | c0a83b27eb0e2a9a1f631d04830a7dc6d762a951 (diff) |
Add preview window option for setting the initial scroll offset
Close #1057
Close #2120
# Initial scroll offset is set to the line number of each line of
# git grep output *minus* 5 lines
git grep --line-number '' |
fzf --delimiter : --preview 'nl {1}' --preview-window +{2}-5
Diffstat (limited to 'test')
-rwxr-xr-x | test/test_go.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test_go.rb b/test/test_go.rb index e1e22575..75e84ec4 100755 --- a/test/test_go.rb +++ b/test/test_go.rb @@ -1787,6 +1787,24 @@ class TestGoFZF < TestBase tmux.until { |lines| refute_includes lines[1], '2' } tmux.until { |lines| assert_includes lines[1], '[111]' } end + + def test_preview_scroll_begin_constant + tmux.send_keys "echo foo 123 321 | #{FZF} --preview 'seq 1000' --preview-window left:+123", :Enter + tmux.until { |lines| lines.item_count == 1 } + tmux.until { |lines| assert_match %r{123.*123/1000}, lines[1] } + end + + def test_preview_scroll_begin_expr + tmux.send_keys "echo foo 123 321 | #{FZF} --preview 'seq 1000' --preview-window left:+{3}", :Enter + tmux.until { |lines| lines.item_count == 1 } + tmux.until { |lines| assert_match %r{321.*321/1000}, lines[1] } + end + + def test_preview_scroll_begin_and_offset + tmux.send_keys "echo foo 123 321 | #{FZF} --preview 'seq 1000' --preview-window left:+{2}-2", :Enter + tmux.until { |lines| lines.item_count == 1 } + tmux.until { |lines| assert_match %r{121.*121/1000}, lines[1] } + end end module TestShell |