diff --git a/tea.go b/tea.go index 76d1d61..b1dfe24 100644 --- a/tea.go +++ b/tea.go @@ -422,8 +422,8 @@ func (p *Program) Start() error { return err case msg := <-msgs: - // Handle special messages - switch msg.(type) { + // Handle special internal messages + switch msg := msg.(type) { case quitMsg: p.ExitAltScreen() p.DisableMouseCellMotion() @@ -432,6 +432,12 @@ func (p *Program) Start() error { close(done) return nil + case batchMsg: + for _, cmd := range msg { + cmds <- cmd + } + continue + case enterAltScreenMsg: p.EnterAltScreen() @@ -452,14 +458,6 @@ func (p *Program) Start() error { hideCursor(p.output) } - // Process batch commands - if batchedCmds, ok := msg.(batchMsg); ok { - for _, cmd := range batchedCmds { - cmds <- cmd - } - continue - } - // Process internal messages for the renderer if r, ok := p.renderer.(*standardRenderer); ok { r.handleMessages(msg)