aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-01-14 21:11:33 -0500
committerDrew DeVault <sir@cmpwn.com>2019-01-14 21:11:33 -0500
commit0b37441f177a46d40aad55f4553fa844bd4dbf6d (patch)
tree0b35fe7f1ba580745bf9ee2cbe371e79a28f3149
parent8492a21a51c107f743a32231746bf5d38e9b1ccd (diff)
Make repeated invalidations more efficient
-rw-r--r--lib/ui/ui.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/ui/ui.go b/lib/ui/ui.go
index 8a390f3..8fabf59 100644
--- a/lib/ui/ui.go
+++ b/lib/ui/ui.go
@@ -78,6 +78,16 @@ func (state *UI) Tick() bool {
}
state.Content.Event(event)
case <-state.invalidations:
+ for {
+ // Flush any other pending invalidations
+ select {
+ case <-state.invalidations:
+ break
+ default:
+ goto done
+ }
+ }
+ done:
state.Content.Draw(state.ctx)
state.screen.Show()
default: