From afa53d8890f9635a7f85078ed086b311cbf1d658 Mon Sep 17 00:00:00 2001 From: kivattt Date: Sat, 27 Jul 2024 01:17:46 +0200 Subject: [PATCH] Speed up SetContent by checking length of combining characters before reflect.DeepEqual --- cell.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cell.go b/cell.go index 0debeee..474ea54 100644 --- a/cell.go +++ b/cell.go @@ -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) }