summaryrefslogtreecommitdiff
path: root/client/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'client/main.go')
-rw-r--r--client/main.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/client/main.go b/client/main.go
index 5993cf6..707cf7e 100644
--- a/client/main.go
+++ b/client/main.go
@@ -28,19 +28,21 @@ func main() {
defer globalApp.Stop()
drawTick := time.Tick(time.Second / 60)
- redraw := true
for {
select {
case m := <-globalApp.Messages():
m.Handle(globalApp)
- redraw = true
+ globalApp.redraw = true
case e := <-tui.Events():
globalApp.onInput(e)
- redraw = true
+ globalApp.redraw = true
case <-drawTick:
- if redraw {
- for i := 0; i < 2; i++ {
- // some information takes two passes to propogate
+ if globalApp.redraw {
+ globalApp.show()
+ tui.DrawLayout()
+ // multi-pass
+ for globalApp.redraw {
+ globalApp.redraw = false
tui.Clear()
globalApp.show()
tui.DrawLayout()
@@ -48,12 +50,11 @@ func main() {
if tui.Present() != nil {
os.Exit(-1)
}
- redraw = false
}
case text := <-globalApp.activePaste:
globalApp.onPaste(text)
globalApp.activePaste = nil
- redraw = true
+ globalApp.redraw = true
}
if globalApp.quit == true {
return