1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

reduce flicker without worrying about carriage returns

This commit is contained in:
Jesse Duffield
2021-04-09 20:16:35 +10:00
parent d5504fa5d0
commit 93fac1f312
10 changed files with 108 additions and 142 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.Reset()
},
func() {
gui.g.Update(func(*gocui.Gui) error {
return nil
})
})
},
func() {
view.FlushStaleCells()
},
)
gui.viewBufferManagerMap[view.Name()] = manager
}