1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

fix flicker issue in main view

This commit is contained in:
Jesse Duffield
2021-04-06 17:00:37 +10:00
parent 6fc031c523
commit 8eb802d3a0
6 changed files with 65 additions and 14 deletions

View File

@ -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
}