1
0
mirror of https://github.com/gdamore/tcell.git synced 2025-04-24 13:48:51 +08:00

Speed up SetContent by checking length of combining characters before reflect.DeepEqual

This commit is contained in:
kivattt 2024-07-27 01:17:46 +02:00
parent 838e4215ea
commit 3741a964f1

View File

@ -58,7 +58,7 @@ func (cb *CellBuffer) SetContent(x int, y int,
// dirty as well as the base cell, to make sure we consider
// both cells as dirty together. We only need to do this
// if we're changing content
if (c.width > 0) && (mainc != c.currMain || !reflect.DeepEqual(combc, c.currComb)) {
if (c.width > 0) && (mainc != c.currMain || (len(combc) > 0 && len(combc) == len(c.currComb) && !reflect.DeepEqual(combc, c.currComb))) {
for i := 0; i < c.width; i++ {
cb.SetDirty(x+i, y, true)
}