diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2021-02-01 23:14:21 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2021-02-01 23:14:21 +0900 |
commit | c862af09f29c6ea0a6b60e480aa0b6e6f760d2de (patch) | |
tree | 66c2575f9a6ea31612f8e379b5e689aedf777160 | |
parent | 1cfeec0ca3fc254e770776765c9e912dc4ab301a (diff) |
Fix toggle-preview-wrap action
Fix #2336
-rw-r--r-- | src/terminal.go | 2 | ||||
-rwxr-xr-x | test/test_go.rb | 13 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/terminal.go b/src/terminal.go index 5d78c6b9..f5fb4803 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -2222,6 +2222,8 @@ func (t *Terminal) Loop() { case actTogglePreviewWrap: if t.hasPreviewWindow() { t.previewOpts.wrap = !t.previewOpts.wrap + // Reset preview version so that full redraw occurs + t.previewed.version = 0 req(reqPreviewRefresh) } case actToggleSort: diff --git a/test/test_go.rb b/test/test_go.rb index 142b2d1a..8f805895 100755 --- a/test/test_go.rb +++ b/test/test_go.rb @@ -1864,6 +1864,19 @@ class TestGoFZF < TestBase tmux.send_keys "#{FZF} --preview 'seq 1000 | nl' --preview-window down:noborder:follow", :Enter tmux.until { |lines| assert_equal '1000 1000', lines[-1].strip } end + + def test_toggle_preview_wrap + tmux.send_keys "#{FZF} --preview 'for i in $(seq $FZF_PREVIEW_COLUMNS); do echo -n .; done; echo wrapped; echo 2nd line' --bind ctrl-w:toggle-preview-wrap", :Enter + 2.times do + tmux.until { |lines| assert_includes lines[2], '2nd line' } + tmux.send_keys 'C-w' + tmux.until do |lines| + assert_includes lines[2], 'wrapped' + assert_includes lines[3], '2nd line' + end + tmux.send_keys 'C-w' + end + end end module TestShell |