mirror of
https://github.com/taigrr/bubbletea.git
synced 2026-04-14 00:38:37 -07:00
Pull batch processing into the internal message switch
This commit is contained in:
18
tea.go
18
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)
|
||||
|
||||
Reference in New Issue
Block a user