From 86c275c69b093b5e47e4a0b1a7d7cd382c46ae1a Mon Sep 17 00:00:00 2001 From: Zack Guo Date: Thu, 6 Apr 2017 17:20:54 +0800 Subject: [PATCH] Fix https://github.com/gizak/termui/issues/99 https://github.com/gizak/termui/issues/112 Now keyboard events will be handled in order, but the consequence is computation-intense may need to be moved to a seperate goroutine otherwise it may delay the next event call. --- events.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/events.go b/events.go index 16d9bd9..a41c953 100644 --- a/events.go +++ b/events.go @@ -126,7 +126,7 @@ func hookTermboxEvt() { e := termbox.PollEvent() for _, c := range sysEvtChs { - go func(ch chan Event) { + func(ch chan Event) { ch <- crtTermboxEvt(e) }(c) } @@ -244,7 +244,7 @@ func (es *EvtStream) Loop() { case "/sig/stoploop": return } - go func(a Event) { + func(a Event) { es.RLock() defer es.RUnlock() if pattern := es.match(a.Path); pattern != "" {