mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-06-01 15:10:47 +00:00
Remove invalid 'result' event when using --sync option
When the search for the initial query doesn't finish immediately fzf would trigger an invalid 'result' event for an empty query. seq 100 | fzf --query 99 --bind result:accept --sync # Prints 99 seq 1000000 | fzf --query 99 --bind result:accept --sync # Should print 99, but fzf would print 1
This commit is contained in:
parent
f864f8b5f7
commit
d8bfb6712d
|
@ -812,7 +812,7 @@ e.g.
|
||||||
.TP
|
.TP
|
||||||
.B "--sync"
|
.B "--sync"
|
||||||
Synchronous search for multi-staged filtering. If specified, fzf will launch
|
Synchronous search for multi-staged filtering. If specified, fzf will launch
|
||||||
ncurses finder only after the input stream is complete.
|
the finder only after the input stream is complete.
|
||||||
|
|
||||||
.RS
|
.RS
|
||||||
e.g. \fBfzf --multi | fzf --sync\fR
|
e.g. \fBfzf --multi | fzf --sync\fR
|
||||||
|
|
|
@ -298,8 +298,7 @@ func Run(opts *Options, version string, revision string) {
|
||||||
total = count
|
total = count
|
||||||
terminal.UpdateCount(total, !reading, value.(*string))
|
terminal.UpdateCount(total, !reading, value.(*string))
|
||||||
if opts.Sync {
|
if opts.Sync {
|
||||||
opts.Sync = false
|
terminal.UpdateList(PassMerger(&snapshot, opts.Tac, snapshotRevision), false)
|
||||||
terminal.UpdateList(PassMerger(&snapshot, opts.Tac, snapshotRevision))
|
|
||||||
}
|
}
|
||||||
if heightUnknown && !deferred {
|
if heightUnknown && !deferred {
|
||||||
determine(!reading)
|
determine(!reading)
|
||||||
|
@ -384,7 +383,7 @@ func Run(opts *Options, version string, revision string) {
|
||||||
determine(val.final)
|
determine(val.final)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
terminal.UpdateList(val)
|
terminal.UpdateList(val, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1067,7 +1067,7 @@ func (t *Terminal) UpdateProgress(progress float32) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateList updates Merger to display the list
|
// UpdateList updates Merger to display the list
|
||||||
func (t *Terminal) UpdateList(merger *Merger) {
|
func (t *Terminal) UpdateList(merger *Merger, triggerResultEvent bool) {
|
||||||
t.mutex.Lock()
|
t.mutex.Lock()
|
||||||
prevIndex := minItem.Index()
|
prevIndex := minItem.Index()
|
||||||
reset := t.revision != merger.Revision()
|
reset := t.revision != merger.Revision()
|
||||||
|
@ -1118,7 +1118,7 @@ func (t *Terminal) UpdateList(merger *Merger) {
|
||||||
t.eventChan <- one
|
t.eventChan <- one
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if t.hasResultActions {
|
if triggerResultEvent && t.hasResultActions {
|
||||||
t.eventChan <- tui.Result.AsEvent()
|
t.eventChan <- tui.Result.AsEvent()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user