mirror of
https://github.com/taigrr/bubbletea.git
synced 2026-04-02 02:59:09 -07:00
Mutex protect buffer access in standard renderer
This commit is contained in:
@@ -88,6 +88,9 @@ func (r *standardRenderer) listen() {
|
||||
|
||||
// flush renders the buffer.
|
||||
func (r *standardRenderer) flush() {
|
||||
r.mtx.Lock()
|
||||
defer r.mtx.Unlock()
|
||||
|
||||
if r.buf.Len() == 0 || r.buf.String() == r.lastRender {
|
||||
// Nothing to do
|
||||
return
|
||||
@@ -95,9 +98,6 @@ func (r *standardRenderer) flush() {
|
||||
|
||||
out := new(bytes.Buffer)
|
||||
|
||||
r.mtx.Lock()
|
||||
defer r.mtx.Unlock()
|
||||
|
||||
// Clear any lines we painted in the last render.
|
||||
if r.linesRendered > 0 {
|
||||
for i := r.linesRendered - 1; i > 0; i-- {
|
||||
|
||||
Reference in New Issue
Block a user