From 24ff66d4a9d6889988e4d7e373f33f4098870b9e Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Mon, 6 May 2024 09:40:02 +0900 Subject: [PATCH] Fix `change-preview` reset by `change-preview-window` Fix #3770 --- src/terminal.go | 1 + test/test_go.rb | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/terminal.go b/src/terminal.go index 918c4244..951b8c3b 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -4088,6 +4088,7 @@ func (t *Terminal) Loop() { // Reset preview options and apply the additional options t.previewOpts = t.initialPreviewOpts + t.previewOpts.command = currentPreviewOpts.command // Split window options tokens := strings.Split(a.a, "|") diff --git a/test/test_go.rb b/test/test_go.rb index 6cd44985..aa7b35f9 100755 --- a/test/test_go.rb +++ b/test/test_go.rb @@ -2693,6 +2693,13 @@ class TestGoFZF < TestBase end end + def test_change_preview_window_should_not_reset_change_preview + tmux.send_keys "#{FZF} --preview-window up,border-none --bind 'start:change-preview(echo hello)' --bind 'enter:change-preview-window(border-left)'", :Enter + tmux.until { |lines| assert_equal 'hello', lines[0] } + tmux.send_keys :Enter + tmux.until { |lines| assert_equal '│ hello', lines[0] } + end + def test_change_preview_window_rotate tmux.send_keys "seq 100 | #{FZF} --preview-window left,border-none --preview 'echo hello' --bind '" \ "a:change-preview-window(right|down|up|hidden|)'", :Enter