Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: race condition on repaint #330

Merged
merged 1 commit into from Jun 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 4 additions & 6 deletions standard_renderer.go
Expand Up @@ -230,7 +230,9 @@ func (r *standardRenderer) write(s string) {
}

func (r *standardRenderer) repaint() {
r.mtx.Lock()
r.lastRender = ""
r.mtx.Unlock()
}

func (r *standardRenderer) altScreen() bool {
Expand Down Expand Up @@ -361,9 +363,7 @@ func (r *standardRenderer) handleMessages(msg Msg) {

// Force a repaint on the area where the scrollable stuff was in this
// update cycle
r.mtx.Lock()
r.lastRender = ""
r.mtx.Unlock()
r.repaint()

case syncScrollAreaMsg:
// Re-render scrolling area
Expand All @@ -372,9 +372,7 @@ func (r *standardRenderer) handleMessages(msg Msg) {
r.insertTop(msg.lines, msg.topBoundary, msg.bottomBoundary)

// Force non-scrolling stuff to repaint in this update cycle
r.mtx.Lock()
r.lastRender = ""
r.mtx.Unlock()
r.repaint()

case scrollUpMsg:
r.insertTop(msg.lines, msg.topBoundary, msg.bottomBoundary)
Expand Down