Skip to content

Commit

Permalink
fix(cellbuf): optimize put cell and equal cell
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Jan 23, 2025
1 parent 06d7d16 commit 62850e9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cellbuf/screen.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,9 @@ func (s *Screen) Height() int {
// cellEqual returns whether the two cells are equal. A nil cell is considered
// a [BlankCell].
func cellEqual(a, b *Cell) bool {
if a == b {
return true
}
if a == nil {
a = &BlankCell
}
Expand Down Expand Up @@ -572,7 +575,10 @@ func (s *Screen) putAttrCell(cell *Cell) {
// }

s.updatePen(cell)
s.buf.WriteString(cell.String()) //nolint:errcheck
s.buf.WriteRune(cell.Rune) //nolint:errcheck
for _, c := range cell.Comb {
s.buf.WriteRune(c) //nolint:errcheck
}
s.cur.X += cell.Width
if cell.Width > 0 {
s.queuedText = true
Expand Down

0 comments on commit 62850e9

Please sign in to comment.