Short-ciruit the message loop when processing batched commands

This commit is contained in:
Christian Rocha 2020-04-03 18:31:40 -04:00
parent cd63ed1e44
commit 4a41a61919
No known key found for this signature in database
GPG Key ID: D6CC7A16E5878018
1 changed files with 3 additions and 2 deletions

5
tea.go
View File

@ -212,10 +212,11 @@ func (p *Program) Start() error {
} }
// Process batch commands // Process batch commands
if b, ok := msg.(batchMsg); ok { if batchedCmds, ok := msg.(batchMsg); ok {
for _, cmd := range b { for _, cmd := range batchedCmds {
cmds <- cmd cmds <- cmd
} }
continue
} }
p.model, cmd = p.update(msg, p.model) // run update p.model, cmd = p.update(msg, p.model) // run update