mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-12-23 03:19:01 +00:00
Fix caching when reload and query change triggered by the same binding
This commit is contained in:
parent
fb76893e18
commit
b7c2e8cb67
@ -1,6 +1,10 @@
|
|||||||
CHANGELOG
|
CHANGELOG
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
0.41.0
|
||||||
|
------
|
||||||
|
- Bug fixes
|
||||||
|
|
||||||
0.40.0
|
0.40.0
|
||||||
------
|
------
|
||||||
- Added `zero` event that is triggered when there's no match
|
- Added `zero` event that is triggered when there's no match
|
||||||
|
@ -320,15 +320,16 @@ func Run(opts *Options, version string, revision string) {
|
|||||||
if !changed {
|
if !changed {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
reset := false
|
||||||
if !useSnapshot {
|
if !useSnapshot {
|
||||||
newSnapshot, _ := chunkList.Snapshot()
|
newSnapshot, _ := chunkList.Snapshot()
|
||||||
// We want to avoid showing empty list when reload is triggered
|
// We want to avoid showing empty list when reload is triggered
|
||||||
// and the query string is changed at the same time i.e. command != nil && changed
|
// and the query string is changed at the same time i.e. command != nil && changed
|
||||||
if command == nil || len(newSnapshot) > 0 {
|
if command == nil || len(newSnapshot) > 0 {
|
||||||
snapshot = newSnapshot
|
snapshot = newSnapshot
|
||||||
|
reset = clearCache()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
reset := !useSnapshot && clearCache()
|
|
||||||
matcher.Reset(snapshot, input(reset), true, !reading, sort, reset)
|
matcher.Reset(snapshot, input(reset), true, !reading, sort, reset)
|
||||||
delay = false
|
delay = false
|
||||||
|
|
||||||
|
@ -2866,6 +2866,24 @@ class TestGoFZF < TestBase
|
|||||||
tmux.send_keys "(echo foo; echo bar) | #{FZF} --bind 'load:reload-sync(sleep 60)+change-query(bar)'", :Enter
|
tmux.send_keys "(echo foo; echo bar) | #{FZF} --bind 'load:reload-sync(sleep 60)+change-query(bar)'", :Enter
|
||||||
tmux.until { |lines| assert_equal 1, lines.match_count }
|
tmux.until { |lines| assert_equal 1, lines.match_count }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_reload_and_change_cache
|
||||||
|
tmux.send_keys "echo bar | #{FZF} --bind 'zero:change-header(foo)+reload(echo foo)+clear-query'", :Enter
|
||||||
|
expected = <<~OUTPUT
|
||||||
|
> bar
|
||||||
|
1/1
|
||||||
|
>
|
||||||
|
OUTPUT
|
||||||
|
tmux.until { assert_block(expected, _1) }
|
||||||
|
tmux.send_keys :z
|
||||||
|
expected = <<~OUTPUT
|
||||||
|
> foo
|
||||||
|
foo
|
||||||
|
1/1
|
||||||
|
>
|
||||||
|
OUTPUT
|
||||||
|
tmux.until { assert_block(expected, _1) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module TestShell
|
module TestShell
|
||||||
|
Loading…
Reference in New Issue
Block a user