diff options
-rw-r--r-- | aerc.go | 1 | ||||
-rw-r--r-- | lib/ui/ui.go | 33 |
2 files changed, 17 insertions, 17 deletions
@@ -241,6 +241,7 @@ func main() { setWindowTitle() } + go ui.Run() for !ui.ShouldExit() { for aerc.Tick() { // Continue updating our internal state diff --git a/lib/ui/ui.go b/lib/ui/ui.go index 596000a5..7cff5754 100644 --- a/lib/ui/ui.go +++ b/lib/ui/ui.go @@ -85,23 +85,6 @@ func (state *UI) Close() { func (state *UI) Tick() bool { more := false - select { - case event := <-state.tcEvents: - if event, ok := event.(*tcell.EventResize); ok { - state.screen.Clear() - width, height := event.Size() - state.ctx = NewContext(width, height, state.screen, state.onPopover) - state.Content.Invalidate() - } - // if we have a popover, and it can handle the event, it does so - if state.popover == nil || !state.popover.Event(event) { - // otherwise, we send the event to the main content - state.Content.Event(event) - } - more = true - default: - } - wasInvalid := atomic.SwapInt32(&state.invalid, 0) if wasInvalid != 0 { if state.popover != nil { @@ -126,3 +109,19 @@ func (state *UI) Tick() bool { func (state *UI) EnableMouse() { state.screen.EnableMouse() } + +func (state *UI) Run() { + for event := range state.tcEvents { + if event, ok := event.(*tcell.EventResize); ok { + state.screen.Clear() + width, height := event.Size() + state.ctx = NewContext(width, height, state.screen, state.onPopover) + state.Content.Invalidate() + } + // if we have a popover, and it can handle the event, it does so + if state.popover == nil || !state.popover.Event(event) { + // otherwise, we send the event to the main content + state.Content.Event(event) + } + } +} |