Make preview updated when reload and change-query are combined

Fix #2744
This commit is contained in:
Junegunn Choi 2022-03-29 22:25:48 +09:00
parent ef67a45702
commit 5209e95bc7
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627
3 changed files with 11 additions and 1 deletions

View File

@ -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
------

View File

@ -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)

View File

@ -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 }