Skip to content
Snippets Groups Projects
Unverified Commit 87874bba authored by Junegunn Choi's avatar Junegunn Choi
Browse files

Remove redundant read event when --sync is used

parent c304fc43
No related branches found
No related tags found
No related merge requests found
......@@ -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:
......
......@@ -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() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment