mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-11-18 03:49:50 -06:00
WIP Upstream tcell fix
This commit is contained in:
1 parent
aa76e4a74b
commit
ec992c2bd2
1 file changed
+11
-12
+11
-12
@@ -23,20 +23,15 @@ type cell struct {
|
||||
lastStyle Style
|
||||
width int
|
||||
lock bool
|
||||
lastWidth int8 // width of lastStr, or 0 when lastStr marks a redraw
|
||||
redraw bool // draw the cell even if its content and style are unchanged
|
||||
lastWidth int8 // width of lastStr, or 0 while redraw is set
|
||||
}
|
||||
|
||||
func (c *cell) setDirty(dirty bool) {
|
||||
c.redraw = dirty
|
||||
if dirty {
|
||||
// Empty cells use currStr == "" until they are first drawn, at which
|
||||
// point SetDirty(false) normalizes them to a space. Using "" as the
|
||||
// dirty marker for an untouched empty cell would therefore leave
|
||||
// lastStr == currStr and fail to force a redraw.
|
||||
if c.currStr == "" {
|
||||
c.lastStr = " "
|
||||
} else {
|
||||
c.lastStr = ""
|
||||
}
|
||||
// What the terminal shows is unknown until the cell is drawn.
|
||||
c.lastStr = ""
|
||||
c.lastWidth = 0
|
||||
} else {
|
||||
if c.currStr == "" {
|
||||
@@ -159,14 +154,18 @@ func (cb *CellBuffer) Invalidate() {
|
||||
}
|
||||
|
||||
// Dirty checks if a character at the given location needs to be
|
||||
// refreshed on the physical display. This returns true if the cell
|
||||
// content is different since the last time it was marked clean.
|
||||
// refreshed on the physical display. This returns true if the cell was
|
||||
// marked dirty, or if its content is different since the last time it
|
||||
// was marked clean.
|
||||
func (cb *CellBuffer) Dirty(x, y int) bool {
|
||||
if x >= 0 && y >= 0 && x < cb.w && y < cb.h {
|
||||
c := &cb.cells[(y*cb.w)+x]
|
||||
if c.lock {
|
||||
return false
|
||||
}
|
||||
if c.redraw {
|
||||
return true
|
||||
}
|
||||
if c.lastStyle != c.currStyle {
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user