Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unwanted artifacts on screen when scrolling text with a lot of unicode characters #693

Closed
darkhz opened this issue Jan 25, 2022 · 7 comments

Comments

@darkhz
Copy link

darkhz commented Jan 25, 2022

While dealing with text that has a lot of unicode, the characters end up "stuck" on the screen, and in the case of the table, the selector malfunctions. Please take a look at the video.

@rivo @tslocum, I'm really sorry for tagging, but I believe this issue to be critical. Any advise would be much appreciated.

unicode-bug-2022-01-25_17.11.03.mp4
@darkhz
Copy link
Author

darkhz commented Jan 26, 2022

An update on this issue:
The bug occurs on this line (util.go)

screen.SetContent(finalX+offset, y, main, comb, finalStyle)

Writing certain combined runes (?) to the output can cause the entire UI to break, with text being rendered incorrectly and so on.
Setting comb to nil temporarily solves this issue. I can provide another video to show this issue if you'd like.

@tslocum
Copy link
Contributor

tslocum commented Jan 28, 2022

Please share the text that causes this breakage as well as the application code responsible for displaying it.

@darkhz
Copy link
Author

darkhz commented Jan 30, 2022

@tslocum apologies for the delay.

The application code is simple enough, it can be anything that displays/handles text like a Table/TableCell, InputField, TextView, etc.

package main

import "github.com/rivo/tview"

func main() {
	App := tview.NewApplication()
	Input := tview.NewInputField()

	Input.SetLabel("Edit this: ")
	Input.SetText("🔥🔥🔥 में f कैसे लगाएं??जाने बहुत ही खास Colour")

	if err := App.SetRoot(Input, true).SetFocus(Input).Run(); err != nil {
		panic(err)
	}
}

You should notice certain characters "sticking" inside the inputfield.

(Weirdly, some editors like vim and micro also have problems with rendering combined runes. Micro handles unicode in a somewhat similar manner to tview, and the same thing occurs while editing text in micro - the entire UI breaks)

@rivo
Copy link
Owner

rivo commented Feb 16, 2022

Seems to be related to some issues in other packages. I've opened up issue gdamore/tcell#515.

@rivo
Copy link
Owner

rivo commented Feb 16, 2022

Also mattn/go-runewidth#59.

@rivo
Copy link
Owner

rivo commented Sep 11, 2022

I made a suggestion over at go-runewidth, see mattn/go-runewidth#59 (comment), and also submitted a PR (mattn/go-runewidth#63). When this PR gets accepted, your problem should be solved, at least after this change propagates via tcell (@gdamore) to tview.

I don't know how fast @mattn is with this. We'll see.

@rivo
Copy link
Owner

rivo commented Aug 26, 2023

Is this issue still relevant? I believe Unicode should work properly now. If there is no further comment soon, I will close this issue.

@rivo rivo closed this as completed Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants