summaryrefslogtreecommitdiffstats
path: root/pkg/gui/tasks_adapter.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-04-06 17:00:37 +1000
committerJesse Duffield <jessedduffield@gmail.com>2021-04-06 19:34:32 +1000
commit8eb802d3a090e16026ad0acfa69844f85229e2c1 (patch)
tree238de64d51a281896827f867ab5dcb92547af067 /pkg/gui/tasks_adapter.go
parent6fc031c523cfb8aa1a249997f76e24e8934b9a73 (diff)
fix flicker issue in main view
Diffstat (limited to 'pkg/gui/tasks_adapter.go')
-rw-r--r--pkg/gui/tasks_adapter.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/pkg/gui/tasks_adapter.go b/pkg/gui/tasks_adapter.go
index bc2fb8a24..d24344b49 100644
--- a/pkg/gui/tasks_adapter.go
+++ b/pkg/gui/tasks_adapter.go
@@ -83,13 +83,23 @@ func (gui *Gui) getManager(view *gocui.View) *tasks.ViewBufferManager {
gui.Log,
view,
func() {
- view.Clear()
+ // we could clear here, but that actually has the effect of causing a flicker
+ // where the view may contain no content momentarily as the gui refreshes.
+ // Instead, we're rewinding the write pointer so that we will just start
+ // overwriting the existing content from the top down. Once we've reached
+ // the end of the content do display, we call view.FlushStaleCells() to
+ // clear out the remaining content from the previous render.
+ view.Rewind()
},
func() {
gui.g.Update(func(*gocui.Gui) error {
return nil
})
- })
+ },
+ func() {
+ view.FlushStaleCells()
+ },
+ )
gui.viewBufferManagerMap[view.Name()] = manager
}