mirror of
https://github.com/junegunn/fzf.git
synced 2025-08-15 12:13:52 -07:00
Add --sync
option
This commit is contained in:
19
src/core.go
19
src/core.go
@@ -110,19 +110,8 @@ func Run(options *Options) {
|
||||
}
|
||||
pattern := patternBuilder([]rune(patternString))
|
||||
|
||||
looping := true
|
||||
eventBox.Unwatch(EvtReadNew)
|
||||
for looping {
|
||||
eventBox.Wait(func(events *util.Events) {
|
||||
for evt := range *events {
|
||||
switch evt {
|
||||
case EvtReadFin:
|
||||
looping = false
|
||||
return
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
eventBox.WaitFor(EvtReadFin)
|
||||
|
||||
snapshot, _ := chunkList.Snapshot()
|
||||
merger, cancelled := matcher.scan(MatchRequest{
|
||||
@@ -142,6 +131,12 @@ func Run(options *Options) {
|
||||
}
|
||||
}
|
||||
|
||||
// Synchronous search
|
||||
if opts.Sync {
|
||||
eventBox.Unwatch(EvtReadNew)
|
||||
eventBox.WaitFor(EvtReadFin)
|
||||
}
|
||||
|
||||
// Go interactive
|
||||
go matcher.Loop()
|
||||
|
||||
|
Reference in New Issue
Block a user