Skip to content

Rendering issue when overwriting characters with a multi-rune character #976

@stefanhaller

Description

@stefanhaller

I'm testing this against tcell v3, commit a5d9742.

The following simple addition to the hello demo shows a rendering problem. We first draw two 'T' characters, and then we overwrite the first of these with a multi-rune emoji. On some terminals, the second T remains visible after this.

diff --git a/demos/hello/hello.go b/demos/hello/hello.go
index 5fa9a96..538e97e 100644
--- a/demos/hello/hello.go
+++ b/demos/hello/hello.go
@@ -29,6 +29,9 @@ func displayHelloWorld(s tcell.Screen) {
 	x := w/2 - 7
 	y := h/2 - 1
 	style := tcell.StyleDefault.Foreground(color.CadetBlue.TrueColor()).Background(color.White)
+	x_ := x
+	y_ := y - 2
+	s.PutStrStyled(x_, y_, "TT", tcell.StyleDefault.Foreground(color.Red))
 	s.PutStrStyled(x, y, "Hello, World!", style)
 	x = w/2 - 9
 	y += 2
@@ -39,6 +42,9 @@ func displayHelloWorld(s tcell.Screen) {
 	x += len("ESC")
 	s.PutStr(x, y, " to exit.")
 	s.Show()
+
+	s.PutStr(x_, y_, "⚠️")
+	s.Show()
 }
 
 // This program just prints "Hello, World!".  Press ESC to exit.

Rendering is as expected in ghostty and kitty, but the second 'T' remains visible in iTerm2 and alacritty:

Image Image

I'm not knowledgable enough with terminal stuff to tell whether this is a bug in these terminals, or whether it's tcell's responsibility to clear out the second 'T' somehow in the second Show call.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions