summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2024-03-27 17:25:56 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2024-03-27 17:25:56 +0900
commit008fb9d258e47815a7c36f462bfb0a7fe08ec44f (patch)
treec73bb7df813f6dab765dd660ffbb5d7a31660641 /src
parentdb6db49ed642caf9cbe716f80d4fa40052118068 (diff)
downloadfzf-008fb9d258e47815a7c36f462bfb0a7fe08ec44f.tar.gz
Fix reload and reload-sync behaviors
https://github.com/junegunn/fzf/discussions/3696#discussioncomment-8915593
Diffstat (limited to 'src')
-rw-r--r--src/core.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/core.go b/src/core.go
index 3abda89c..f6c5a50d 100644
--- a/src/core.go
+++ b/src/core.go
@@ -245,11 +245,8 @@ func Run(opts *Options, version string, revision string) {
delay := true
ticks++
input := func() []rune {
- reloaded := snapshotRevision != inputRevision
paused, input := terminal.Input()
- if reloaded && paused {
- query = []rune{}
- } else if !paused {
+ if !paused {
query = input
}
return query
@@ -278,6 +275,9 @@ func Run(opts *Options, version string, revision string) {
useSnapshot = false
}
if !useSnapshot {
+ if snapshotRevision != inputRevision {
+ query = []rune{}
+ }
snapshot, count = chunkList.Snapshot()
snapshotRevision = inputRevision
}
@@ -319,10 +319,13 @@ func Run(opts *Options, version string, revision string) {
break
}
if !useSnapshot {
- newSnapshot, _ := chunkList.Snapshot()
+ newSnapshot, newCount := chunkList.Snapshot()
// 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
- if command == nil || len(newSnapshot) > 0 {
+ if command == nil || newCount > 0 {
+ if snapshotRevision != inputRevision {
+ query = []rune{}
+ }
snapshot = newSnapshot
snapshotRevision = inputRevision
}