forked from Mirrors/bubbletea
Adjust comments + move some code around
This commit is contained in:
parent
ae9ea29c0e
commit
a152cce4b6
36
tea.go
36
tea.go
|
@ -176,23 +176,6 @@ func (p *Program) Start() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Report resizes to the renderer. This only matters if we're doing
|
|
||||||
// higher performance scroll-based rendering.
|
|
||||||
if size, ok := msg.(WindowSizeMsg); ok {
|
|
||||||
mrRenderer.width = size.width
|
|
||||||
mrRenderer.height = size.height
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle messages telling the renderer to ignore ranges of lines
|
|
||||||
if ignore, ok := msg.(IgnoreLinesMsg); ok {
|
|
||||||
mrRenderer.setIgnoredLines(ignore.from, ignore.to)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle messages telling the renderer to stop ignoring lines
|
|
||||||
if _, ok := msg.(IgnoreLinesMsg); ok {
|
|
||||||
mrRenderer.clearIgnoredLines()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Process batch commands
|
// Process batch commands
|
||||||
if batchedCmds, ok := msg.(batchMsg); ok {
|
if batchedCmds, ok := msg.(batchMsg); ok {
|
||||||
for _, cmd := range batchedCmds {
|
for _, cmd := range batchedCmds {
|
||||||
|
@ -201,6 +184,25 @@ func (p *Program) Start() error {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Report resizes to the renderer. Only necessary for special,
|
||||||
|
// performance-based rendering.
|
||||||
|
if size, ok := msg.(WindowSizeMsg); ok {
|
||||||
|
mrRenderer.width = size.width
|
||||||
|
mrRenderer.height = size.height
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle messages telling the main rendering routine to ignore
|
||||||
|
// ranges of lines. Useful for performance-based rendering.
|
||||||
|
if ignore, ok := msg.(IgnoreLinesMsg); ok {
|
||||||
|
mrRenderer.setIgnoredLines(ignore.from, ignore.to)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle messages telling the main rendering to stop ignoring
|
||||||
|
// lines. Useful when disabling any performance-based rendering.
|
||||||
|
if _, ok := msg.(IgnoreLinesMsg); ok {
|
||||||
|
mrRenderer.clearIgnoredLines()
|
||||||
|
}
|
||||||
|
|
||||||
model, cmd = p.update(msg, model) // run update
|
model, cmd = p.update(msg, model) // run update
|
||||||
cmds <- cmd // process command (if any)
|
cmds <- cmd // process command (if any)
|
||||||
mrRenderer.write(p.view(model)) // send view to renderer
|
mrRenderer.write(p.view(model)) // send view to renderer
|
||||||
|
|
Loading…
Reference in New Issue