forked from Mirrors/bubbletea
fix: renderer only stops once
Ensure the tea renderer can be stopped and restarted more than once.
This commit is contained in:
parent
32e3027ec1
commit
a136799ed3
|
@ -73,7 +73,12 @@ func (r *standardRenderer) start() {
|
||||||
if r.ticker == nil {
|
if r.ticker == nil {
|
||||||
r.ticker = time.NewTicker(r.framerate)
|
r.ticker = time.NewTicker(r.framerate)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Since the renderer can be restarted after a stop, we need to reset
|
||||||
|
// the done channel and its corresponding sync.Once.
|
||||||
|
r.once = sync.Once{}
|
||||||
r.done = make(chan struct{})
|
r.done = make(chan struct{})
|
||||||
|
|
||||||
go r.listen()
|
go r.listen()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue