mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-15 11:56:37 +02:00
fix rendering issues caused by resizing
This commit is contained in:
parent
0df6ac6140
commit
76697280c9
2
go.mod
2
go.mod
@ -20,7 +20,7 @@ require (
|
|||||||
github.com/imdario/mergo v0.3.11
|
github.com/imdario/mergo v0.3.11
|
||||||
github.com/integrii/flaggy v1.4.0
|
github.com/integrii/flaggy v1.4.0
|
||||||
github.com/jesseduffield/go-git/v5 v5.1.2-0.20201006095850-341962be15a4
|
github.com/jesseduffield/go-git/v5 v5.1.2-0.20201006095850-341962be15a4
|
||||||
github.com/jesseduffield/gocui v0.3.1-0.20210412111008-6ef019af3724
|
github.com/jesseduffield/gocui v0.3.1-0.20210412113212-ee65bd542c08
|
||||||
github.com/jesseduffield/termbox-go v0.0.0-20200823212418-a2289ed6aafe // indirect
|
github.com/jesseduffield/termbox-go v0.0.0-20200823212418-a2289ed6aafe // indirect
|
||||||
github.com/jesseduffield/yaml v2.1.0+incompatible
|
github.com/jesseduffield/yaml v2.1.0+incompatible
|
||||||
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0
|
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0
|
||||||
|
2
go.sum
2
go.sum
@ -112,6 +112,8 @@ github.com/jesseduffield/gocui v0.3.1-0.20210410011117-a2bb4baca390 h1:Es72JiUjt
|
|||||||
github.com/jesseduffield/gocui v0.3.1-0.20210410011117-a2bb4baca390/go.mod h1:QWq79xplEoyhQO+dgpk3sojjTVRKjQklyTlzm5nC5Kg=
|
github.com/jesseduffield/gocui v0.3.1-0.20210410011117-a2bb4baca390/go.mod h1:QWq79xplEoyhQO+dgpk3sojjTVRKjQklyTlzm5nC5Kg=
|
||||||
github.com/jesseduffield/gocui v0.3.1-0.20210412111008-6ef019af3724 h1:U70Do3/OSw5n/oLJGPWsQHnos2p0yq8yAeD2muioJhQ=
|
github.com/jesseduffield/gocui v0.3.1-0.20210412111008-6ef019af3724 h1:U70Do3/OSw5n/oLJGPWsQHnos2p0yq8yAeD2muioJhQ=
|
||||||
github.com/jesseduffield/gocui v0.3.1-0.20210412111008-6ef019af3724/go.mod h1:QWq79xplEoyhQO+dgpk3sojjTVRKjQklyTlzm5nC5Kg=
|
github.com/jesseduffield/gocui v0.3.1-0.20210412111008-6ef019af3724/go.mod h1:QWq79xplEoyhQO+dgpk3sojjTVRKjQklyTlzm5nC5Kg=
|
||||||
|
github.com/jesseduffield/gocui v0.3.1-0.20210412113212-ee65bd542c08 h1:d003y2GByfR3PqN/JvxNuqyo8vx4m0epwY2hW7sNU80=
|
||||||
|
github.com/jesseduffield/gocui v0.3.1-0.20210412113212-ee65bd542c08/go.mod h1:QWq79xplEoyhQO+dgpk3sojjTVRKjQklyTlzm5nC5Kg=
|
||||||
github.com/jesseduffield/termbox-go v0.0.0-20200823212418-a2289ed6aafe h1:qsVhCf2RFyyKIUe/+gJblbCpXMUki9rZrHuEctg6M/E=
|
github.com/jesseduffield/termbox-go v0.0.0-20200823212418-a2289ed6aafe h1:qsVhCf2RFyyKIUe/+gJblbCpXMUki9rZrHuEctg6M/E=
|
||||||
github.com/jesseduffield/termbox-go v0.0.0-20200823212418-a2289ed6aafe/go.mod h1:anMibpZtqNxjDbxrcDEAwSdaJ37vyUeM1f/M4uekib4=
|
github.com/jesseduffield/termbox-go v0.0.0-20200823212418-a2289ed6aafe/go.mod h1:anMibpZtqNxjDbxrcDEAwSdaJ37vyUeM1f/M4uekib4=
|
||||||
github.com/jesseduffield/yaml v2.1.0+incompatible h1:HWQJ1gIv2zHKbDYNp0Jwjlj24K8aqpFHnMCynY1EpmE=
|
github.com/jesseduffield/yaml v2.1.0+incompatible h1:HWQJ1gIv2zHKbDYNp0Jwjlj24K8aqpFHnMCynY1EpmE=
|
||||||
|
2
vendor/github.com/jesseduffield/gocui/edit.go
generated
vendored
2
vendor/github.com/jesseduffield/gocui/edit.go
generated
vendored
@ -430,7 +430,7 @@ func (v *View) mergeLines(y int) error {
|
|||||||
v.writeMutex.Lock()
|
v.writeMutex.Lock()
|
||||||
defer v.writeMutex.Unlock()
|
defer v.writeMutex.Unlock()
|
||||||
|
|
||||||
v.tainted = true
|
v.clearViewLines()
|
||||||
|
|
||||||
_, y, err := v.realPosition(0, y)
|
_, y, err := v.realPosition(0, y)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
10
vendor/github.com/jesseduffield/gocui/gui.go
generated
vendored
10
vendor/github.com/jesseduffield/gocui/gui.go
generated
vendored
@ -272,7 +272,7 @@ func (g *Gui) SetView(name string, x0, y0, x1, y1 int, overlaps byte) (*View, er
|
|||||||
|
|
||||||
if v, err := g.View(name); err == nil {
|
if v, err := g.View(name); err == nil {
|
||||||
if v.x0 != x0 || v.x1 != x1 || v.y0 != y0 || v.y1 != y1 {
|
if v.x0 != x0 || v.x1 != x1 || v.y0 != y0 || v.y1 != y1 {
|
||||||
v.tainted = true
|
v.clearViewLines()
|
||||||
}
|
}
|
||||||
|
|
||||||
v.x0 = x0
|
v.x0 = x0
|
||||||
@ -660,11 +660,7 @@ func (g *Gui) handleEvent(ev *GocuiEvent) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g *Gui) onResize() {
|
func (g *Gui) onResize() {
|
||||||
for _, v := range g.views {
|
// not sure if we actually need this
|
||||||
// wonder if we should be calling this in other contexts e.g. whenever the view's dimensions change in general
|
|
||||||
v.FlushStaleCells()
|
|
||||||
}
|
|
||||||
// Not sure if we actually need this
|
|
||||||
// g.screen.Sync()
|
// g.screen.Sync()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -677,7 +673,7 @@ func (g *Gui) flush() error {
|
|||||||
// if GUI's size has changed, we need to redraw all views
|
// if GUI's size has changed, we need to redraw all views
|
||||||
if maxX != g.maxX || maxY != g.maxY {
|
if maxX != g.maxX || maxY != g.maxY {
|
||||||
for _, v := range g.views {
|
for _, v := range g.views {
|
||||||
v.tainted = true
|
v.clearViewLines()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g.maxX, g.maxY = maxX, maxY
|
g.maxX, g.maxY = maxX, maxY
|
||||||
|
21
vendor/github.com/jesseduffield/gocui/view.go
generated
vendored
21
vendor/github.com/jesseduffield/gocui/view.go
generated
vendored
@ -48,7 +48,12 @@ type View struct {
|
|||||||
// tained is true if the viewLines must be updated
|
// tained is true if the viewLines must be updated
|
||||||
tainted bool
|
tainted bool
|
||||||
|
|
||||||
// internal representation of the view's buffer
|
// internal representation of the view's buffer. We will keep viewLines around
|
||||||
|
// from a previous render until we explicitly set them to nil, allowing us to
|
||||||
|
// render the same content twice without flicker. Wherever we want to render
|
||||||
|
// something without any chance of old content appearing (e.g. when actually
|
||||||
|
// rendering new content or if the view is resized) we should set tainted to
|
||||||
|
// true and viewLines to nil
|
||||||
viewLines []viewLine
|
viewLines []viewLine
|
||||||
|
|
||||||
// writeMutex protects locks the write process
|
// writeMutex protects locks the write process
|
||||||
@ -155,6 +160,14 @@ type View struct {
|
|||||||
KeybindOnEdit bool
|
KeybindOnEdit bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// call this in the event of a view resize, or if you want to render new content
|
||||||
|
// without the chance of old content still appearing, or if you want to remove
|
||||||
|
// a line from the existing content
|
||||||
|
func (v *View) clearViewLines() {
|
||||||
|
v.tainted = true
|
||||||
|
v.viewLines = nil
|
||||||
|
}
|
||||||
|
|
||||||
type searcher struct {
|
type searcher struct {
|
||||||
searchString string
|
searchString string
|
||||||
searchPositions []cellPos
|
searchPositions []cellPos
|
||||||
@ -651,9 +664,8 @@ func (v *View) Clear() {
|
|||||||
defer v.writeMutex.Unlock()
|
defer v.writeMutex.Unlock()
|
||||||
|
|
||||||
v.rewind()
|
v.rewind()
|
||||||
v.tainted = true
|
|
||||||
v.lines = nil
|
v.lines = nil
|
||||||
v.viewLines = nil
|
v.clearViewLines()
|
||||||
v.clearRunes()
|
v.clearRunes()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -683,8 +695,7 @@ func (v *View) FlushStaleCells() {
|
|||||||
v.writeMutex.Lock()
|
v.writeMutex.Lock()
|
||||||
defer v.writeMutex.Unlock()
|
defer v.writeMutex.Unlock()
|
||||||
|
|
||||||
v.tainted = true
|
v.clearViewLines()
|
||||||
v.viewLines = nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *View) rewind() {
|
func (v *View) rewind() {
|
||||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -149,7 +149,7 @@ github.com/jesseduffield/go-git/v5/utils/merkletrie/filesystem
|
|||||||
github.com/jesseduffield/go-git/v5/utils/merkletrie/index
|
github.com/jesseduffield/go-git/v5/utils/merkletrie/index
|
||||||
github.com/jesseduffield/go-git/v5/utils/merkletrie/internal/frame
|
github.com/jesseduffield/go-git/v5/utils/merkletrie/internal/frame
|
||||||
github.com/jesseduffield/go-git/v5/utils/merkletrie/noder
|
github.com/jesseduffield/go-git/v5/utils/merkletrie/noder
|
||||||
# github.com/jesseduffield/gocui v0.3.1-0.20210412111008-6ef019af3724
|
# github.com/jesseduffield/gocui v0.3.1-0.20210412113212-ee65bd542c08
|
||||||
## explicit
|
## explicit
|
||||||
github.com/jesseduffield/gocui
|
github.com/jesseduffield/gocui
|
||||||
# github.com/jesseduffield/termbox-go v0.0.0-20200823212418-a2289ed6aafe
|
# github.com/jesseduffield/termbox-go v0.0.0-20200823212418-a2289ed6aafe
|
||||||
|
Loading…
x
Reference in New Issue
Block a user