Skip to content

Commit

Permalink
fix(cellbuf): clear below cursor on inline mode height change
Browse files Browse the repository at this point in the history
Fixes: b780e1b (fix(cellbuf): tidy and simplify clearBottom and clearUpdate)
  • Loading branch information
aymanbagabas committed Feb 10, 2025
1 parent b780e1b commit 01265dd
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions cellbuf/screen.go
Original file line number Diff line number Diff line change
Expand Up @@ -1116,17 +1116,20 @@ func (s *Screen) clearBottom(total int) (top int) {
if canClearWithBlank {
var row int
for row = total - 1; row >= 0; row-- {
oldLine := s.curbuf.Line(row)
newLine := s.newbuf.Line(row)

var col int
var ok bool
for col, ok = 0, true; ok && col < last; col++ {
ok = cellEqual(s.newbuf.Cell(col, row), blank)
ok := true
for col = 0; ok && col < last; col++ {
ok = cellEqual(newLine.At(col), blank)
}
if !ok {
break
}

for col = 0; ok && col < last; col++ {
ok = cellEqual(s.curbuf.Cell(col, row), blank)
ok = len(oldLine) == last && cellEqual(oldLine.At(col), blank)
}
if !ok {
top = row
Expand Down Expand Up @@ -1285,7 +1288,11 @@ func (s *Screen) render() {
s.curbuf.Height() > 0 &&
s.curbuf.Height() > s.newbuf.Height()

if s.clear || partialClear {
if partialClear {
s.clearBelow(nil, s.newbuf.Height()-1)
}

if s.clear {
s.clearUpdate()
s.clear = false
} else if len(s.touch) > 0 {
Expand Down

0 comments on commit 01265dd

Please sign in to comment.