mirror of
https://github.com/taigrr/bubbletea.git
synced 2026-04-02 02:59:09 -07:00
Fix a race where artifacts could print when exiting a program
This commit also consolidates the exit operations for consistency's sake, and adds a kill() method to renderers for stopping them without performing any final rendering.
This commit is contained in:
@@ -61,13 +61,19 @@ func (r *standardRenderer) start() {
|
||||
go r.listen()
|
||||
}
|
||||
|
||||
// stop permanently halts the renderer.
|
||||
// stop permanently halts the renderer, rendering the final frame.
|
||||
func (r *standardRenderer) stop() {
|
||||
r.flush()
|
||||
clearLine(r.out)
|
||||
close(r.done)
|
||||
}
|
||||
|
||||
// kill halts the renderer. The final frame will not be rendered.
|
||||
func (r *standardRenderer) kill() {
|
||||
clearLine(r.out)
|
||||
close(r.done)
|
||||
}
|
||||
|
||||
// listen waits for ticks on the ticker, or a signal to stop the renderer.
|
||||
func (r *standardRenderer) listen() {
|
||||
for {
|
||||
|
||||
Reference in New Issue
Block a user