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

x/term: unaware of unicode double width characters, creates phantom when for instance δΉ’ or πŸ˜€ is present in the history #68880

Open
ldemailly opened this issue Aug 15, 2024 · 4 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@ldemailly
Copy link

ldemailly commented Aug 15, 2024

Go version

go1.22.6

Output of go env in your module/workspace:

same issue on macos (terminal or iterm2), linux or windows 11 (terminal.app)

What did you do?

type or paste "πŸ˜€, type backspace, a space is inserted
use up/down repeatedly previous prompt and current keep shifting right

What did you see happen?

see above

What did you expect to see?

πŸ˜€ works like any other character

@gopherbot gopherbot added this to the Unreleased milestone Aug 15, 2024
@ldemailly ldemailly changed the title x/tem: unaware of emoji width (double width) creates phantom when for instance πŸ˜€ is present in the history x/tem: unaware of unicode double width characters, creates phantom when for instance δΉ’ or πŸ˜€ is present in the history Aug 15, 2024
@ldemailly
Copy link
Author

same with δΉ’δΉ“ for instance

@ldemailly
Copy link
Author

Seems like wcwidth(3) is what is needed and it's unclear https://pkg.go.dev/golang.org/x/text/width would cover that (probably for δΉ’ but not πŸ˜€?)

@ldemailly
Copy link
Author

https://github.com/rivo/uniseg would work/help but isn't any x/ or stdlib/ (or is there a copy somewhere?) https://go.dev/play/p/BO1YmXhdb0F

@seankhliao seankhliao changed the title x/tem: unaware of unicode double width characters, creates phantom when for instance δΉ’ or πŸ˜€ is present in the history x/term: unaware of unicode double width characters, creates phantom when for instance δΉ’ or πŸ˜€ is present in the history Aug 15, 2024
ldemailly added a commit to fortio/term that referenced this issue Aug 15, 2024
@cagedmantis cagedmantis added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 16, 2024
@cagedmantis
Copy link
Contributor

cc @rsc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants