diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2017-08-20 01:58:51 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2017-08-20 01:58:51 +0900 |
commit | 87874bba88c315b11ce5da37c178e6fdedb8708a (patch) | |
tree | 05e00dc8f0550683dc02e02f7747c533c4bec44c /src | |
parent | c304fc43333c95467394ca2d6e5eddbbcdf99e3d (diff) |
Remove redundant read event when --sync is used
Diffstat (limited to 'src')
-rw-r--r-- | src/core.go | 4 | ||||
-rw-r--r-- | src/util/eventbox.go | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/core.go b/src/core.go index 6bb4b2e7..1c8182ea 100644 --- a/src/core.go +++ b/src/core.go @@ -188,6 +188,7 @@ func Run(opts *Options, revision string) { if opts.Sync { eventBox.Unwatch(EvtReadNew) eventBox.WaitFor(EvtReadFin) + eventBox.Unset(EvtReadNew) } // Go interactive @@ -216,6 +217,9 @@ func Run(opts *Options, revision string) { reading = reading && evt == EvtReadNew snapshot, count := chunkList.Snapshot() terminal.UpdateCount(count, !reading, value.(bool)) + if opts.Sync { + terminal.UpdateList(PassMerger(&snapshot, opts.Tac)) + } matcher.Reset(snapshot, terminal.Input(), false, !reading, sort) case EvtSearchNew: diff --git a/src/util/eventbox.go b/src/util/eventbox.go index b710cf1e..acd95616 100644 --- a/src/util/eventbox.go +++ b/src/util/eventbox.go @@ -45,6 +45,13 @@ func (b *EventBox) Set(event EventType, value interface{}) { b.cond.L.Unlock() } +// Unset turns off the event type on the box +func (b *EventBox) Unset(event EventType) { + b.cond.L.Lock() + delete(b.events, event) + b.cond.L.Unlock() +} + // Clear clears the events // Unsynchronized; should be called within Wait routine func (events *Events) Clear() { |