From a136799ed3730f4d162f95f63dfc8e419558945d Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Mon, 6 Mar 2023 14:23:51 +0100 Subject: [PATCH] fix: renderer only stops once Ensure the tea renderer can be stopped and restarted more than once. --- standard_renderer.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/standard_renderer.go b/standard_renderer.go index 17b44e2..edde56a 100644 --- a/standard_renderer.go +++ b/standard_renderer.go @@ -73,7 +73,12 @@ func (r *standardRenderer) start() { if r.ticker == nil { 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{}) + go r.listen() }