From f5b034095a74ae88410bf3383c39b1e99c0f36a0 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 18 Feb 2015 00:51:44 +0900 Subject: Fix race condition in asynchronous -1 and -0 --- src/core.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/core.go') diff --git a/src/core.go b/src/core.go index 71e3aa96..ea97b4e6 100644 --- a/src/core.go +++ b/src/core.go @@ -149,11 +149,11 @@ func Run(options *Options) { reading = reading && evt == EvtReadNew snapshot, count := chunkList.Snapshot() terminal.UpdateCount(count, !reading) - matcher.Reset(snapshot, terminal.Input(), false) + matcher.Reset(snapshot, terminal.Input(), false, !reading) case EvtSearchNew: snapshot, _ := chunkList.Snapshot() - matcher.Reset(snapshot, terminal.Input(), true) + matcher.Reset(snapshot, terminal.Input(), true, !reading) delay = false case EvtSearchProgress: @@ -170,7 +170,7 @@ func Run(options *Options) { if opts.Select1 && count > 1 || opts.Exit0 && !opts.Select1 && count > 0 { deferred = false terminal.startChan <- true - } else if !reading { + } else if val.final { if opts.Exit0 && count == 0 || opts.Select1 && count == 1 { if opts.PrintQuery { fmt.Println(opts.Query) -- cgit v1.2.3