From 5209e95bc7132004637aef61b1dfd9e1e489f8a2 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Tue, 29 Mar 2022 22:25:48 +0900 Subject: [PATCH] Make preview updated when reload and change-query are combined Fix #2744 --- CHANGELOG.md | 2 +- src/terminal.go | 1 + test/test_go.rb | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 616d438..061bf85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ CHANGELOG fzf --nth=-1 --no-hscroll --ellipsis='' | awk '{print $2}' ``` -- Increased TTY buffer limit (#2748) +- Bug fixes and improvements 0.29.0 ------ diff --git a/src/terminal.go b/src/terminal.go index 9ea0c1a..44dea49 100644 --- a/src/terminal.go +++ b/src/terminal.go @@ -673,6 +673,7 @@ func (t *Terminal) UpdateList(merger *Merger, reset bool) { t.merger = merger if reset { t.selected = make(map[int32]selectedItem) + t.version++ } t.mutex.Unlock() t.reqBox.Set(reqInfo, nil) diff --git a/test/test_go.rb b/test/test_go.rb index bd95060..74f9851 100755 --- a/test/test_go.rb +++ b/test/test_go.rb @@ -2077,6 +2077,15 @@ class TestGoFZF < TestBase tmux.until { |lines| assert_includes lines[1], '4' } end + def test_reload_and_change_preview_should_update_preview + tmux.send_keys "seq 3 | #{FZF} --bind 'ctrl-t:reload(echo 4)+change-preview(echo {})'", :Enter + tmux.until { |lines| assert_equal 3, lines.item_count } + tmux.until { |lines| refute_includes lines[1], '1' } + tmux.send_keys 'C-t' + tmux.until { |lines| assert_equal 1, lines.item_count } + tmux.until { |lines| assert_includes lines[1], '4' } + end + def test_scroll_off tmux.send_keys "seq 1000 | #{FZF} --scroll-off=3 --bind l:last", :Enter tmux.until { |lines| assert_equal 1000, lines.item_count }