Skip to content

Commit

Permalink
fix(cellbuf): clear the rest of the lines after painting a new frame
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Dec 5, 2024
1 parent 5b2105a commit 3dbda97
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions cellbuf/screen_write.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func setContent(
}
}

if x+width >= rect.X()+rect.Width() || y >= rect.Y()+rect.Height() {
if x+width > rect.X()+rect.Width() || y > rect.Y()+rect.Height() {
break
}

Expand Down Expand Up @@ -111,16 +111,13 @@ func setContent(
}
case ansi.Equal(seq, "\n"):
// Reset the rest of the line
for x < rect.X()+rect.Width() {
d.Draw(x, y, nil) //nolint:errcheck
x++
}
d.ClearInRect(Rect(x, y, rect.X()+rect.Width(), rect.Y()+rect.Height()))

y++
// XXX: We gotta reset the x position here because we're moving
// to the next line. We shouldn't have any "\r\n" sequences,
// those are replaced above.
x = 0
x = rect.X()
}
}

Expand All @@ -129,12 +126,11 @@ func setContent(
data = data[n:]
}

// Clear the rest of the row
d.ClearInRect(Rect(x, y, rect.Width(), 1))

y++
// Clear the rest of the lines
d.ClearInRect(Rect(rect.X(), y, rect.Width(), rect.Height()))
if y < rect.Height() {
// Clear the rest of the lines
d.ClearInRect(Rect(rect.X(), y, rect.X()+rect.Width(), rect.Y()+rect.Height()))
}

return linew
}
Expand Down

0 comments on commit 3dbda97

Please sign in to comment.