Fix repaint when syncing and clearing scroll area

This commit is contained in:
Christian Rocha 2020-06-19 18:03:12 -04:00
parent 673752658f
commit c0ce48dfdd
No known key found for this signature in database
GPG Key ID: D6CC7A16E5878018
1 changed files with 8 additions and 2 deletions

View File

@ -253,15 +253,21 @@ func (r *renderer) handleMessages(msg Msg) {
case clearScrollAreaMsg: case clearScrollAreaMsg:
r.clearIgnoredLines() r.clearIgnoredLines()
// Force a repaint on the area where the scrollable stuff was in this
// update cycle
r.mtx.Lock()
r.lastRender = ""
r.mtx.Unlock()
case syncScrollAreaMsg: case syncScrollAreaMsg:
// Re-render scrolling area // Re-render scrolling area
r.clearIgnoredLines() r.clearIgnoredLines()
r.setIgnoredLines(msg.topBoundary, msg.bottomBoundary) r.setIgnoredLines(msg.topBoundary, msg.bottomBoundary)
r.insertTop(msg.lines, msg.topBoundary, msg.bottomBoundary) r.insertTop(msg.lines, msg.topBoundary, msg.bottomBoundary)
// Clear buffer to force non-scrolling stuff to repaint // Force non-scrolling stuff to repaint in this update cycle
r.mtx.Lock() r.mtx.Lock()
r.buf.Reset() r.lastRender = ""
r.mtx.Unlock() r.mtx.Unlock()
case scrollUpMsg: case scrollUpMsg: