Skip to content

Commit d17cf8b

Browse files
committed
fixes #621 Unicode disappears if requested twice on the same place on Windows
1 parent 547b110 commit d17cf8b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

cell.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 The TCell Authors
1+
// Copyright 2024 The TCell Authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use file except in compliance with the License.
@@ -16,6 +16,7 @@ package tcell
1616

1717
import (
1818
"os"
19+
"reflect"
1920

2021
runewidth "github.com/mattn/go-runewidth"
2122
)
@@ -53,8 +54,14 @@ func (cb *CellBuffer) SetContent(x int, y int,
5354
if x >= 0 && y >= 0 && x < cb.w && y < cb.h {
5455
c := &cb.cells[(y*cb.w)+x]
5556

56-
for i := 1; i < c.width; i++ {
57-
cb.SetDirty(x+i, y, true)
57+
// Wide characters: we want to mark the "wide" cells
58+
// dirty as well as the base cell, to make sure we consider
59+
// both cells as dirty together. We only need to do this
60+
// if we're changing content
61+
if (c.width > 0) && (mainc != c.currMain || !reflect.DeepEqual(combc, c.currComb)) {
62+
for i := 0; i < c.width; i++ {
63+
cb.SetDirty(x+i, y, true)
64+
}
5865
}
5966

6067
c.currComb = append([]rune{}, combc...)

0 commit comments

Comments
 (0)