mirror of
https://github.com/taigrr/bubbletea.git
synced 2026-04-02 02:59:09 -07:00
fix: race condition on repaint
This commit is contained in:
committed by
Christian Muehlhaeuser
parent
b237b7fbec
commit
50a8461fbf
@@ -230,7 +230,9 @@ func (r *standardRenderer) write(s string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *standardRenderer) repaint() {
|
func (r *standardRenderer) repaint() {
|
||||||
|
r.mtx.Lock()
|
||||||
r.lastRender = ""
|
r.lastRender = ""
|
||||||
|
r.mtx.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *standardRenderer) altScreen() bool {
|
func (r *standardRenderer) altScreen() bool {
|
||||||
@@ -361,9 +363,7 @@ func (r *standardRenderer) handleMessages(msg Msg) {
|
|||||||
|
|
||||||
// Force a repaint on the area where the scrollable stuff was in this
|
// Force a repaint on the area where the scrollable stuff was in this
|
||||||
// update cycle
|
// update cycle
|
||||||
r.mtx.Lock()
|
r.repaint()
|
||||||
r.lastRender = ""
|
|
||||||
r.mtx.Unlock()
|
|
||||||
|
|
||||||
case syncScrollAreaMsg:
|
case syncScrollAreaMsg:
|
||||||
// Re-render scrolling area
|
// Re-render scrolling area
|
||||||
@@ -372,9 +372,7 @@ func (r *standardRenderer) handleMessages(msg Msg) {
|
|||||||
r.insertTop(msg.lines, msg.topBoundary, msg.bottomBoundary)
|
r.insertTop(msg.lines, msg.topBoundary, msg.bottomBoundary)
|
||||||
|
|
||||||
// Force non-scrolling stuff to repaint in this update cycle
|
// Force non-scrolling stuff to repaint in this update cycle
|
||||||
r.mtx.Lock()
|
r.repaint()
|
||||||
r.lastRender = ""
|
|
||||||
r.mtx.Unlock()
|
|
||||||
|
|
||||||
case scrollUpMsg:
|
case scrollUpMsg:
|
||||||
r.insertTop(msg.lines, msg.topBoundary, msg.bottomBoundary)
|
r.insertTop(msg.lines, msg.topBoundary, msg.bottomBoundary)
|
||||||
|
|||||||
Reference in New Issue
Block a user