@@ 593,34 593,25 @@ func (app *App) Run() int {
updates := app.sync()
- // Resize with terminal
- go func() {
- var width, height int
- for range time.Tick(200 * time.Millisecond) {
- w, h := tui.TermSize(0)
- if w != width || h != height {
- updates <- func() {
- app.UI.Resize(w, h)
- app.UI.Render()
- }
- width, height = w, h
- }
- }
- }()
-
- // Refresh every minute
- go func() {
- for range time.Tick(time.Minute) {
- updates <- func() { app.UI.Render() }
- }
- }()
-
- // Mainloop
app.roomsScreen()
- app.UI.Resize(tui.TermSize(0))
+ width, height := tui.TermSize(0)
+ app.UI.Resize(width, height)
app.UI.Render()
+
+ // Mainloop
+ resize := time.Tick(200 * time.Millisecond)
+ refresh := time.Tick(time.Minute)
for {
select {
+ case <- resize:
+ w, h := tui.TermSize(0)
+ if w != width || h != height {
+ app.UI.Resize(w, h)
+ app.UI.Render()
+ width, height = w, h
+ }
+ case <- refresh:
+ app.UI.Render()
case ev := <- inputEvents:
if cmd, ok := app.UI.Handle(ev); ok {
code := app.Do(cmd)