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

textarea/textinput: control characters in input cause misbehavior/crashes during navigation #263

Open
knz opened this issue Oct 2, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@knz
Copy link
Contributor

knz commented Oct 2, 2022

If I trick textarea/textinput to accept control characters in its input (most easily, by using control characters in the input of SetValue, but also possible via bug #466, textarea/textinput get confused:

  • the width computation for the control characters is wrong
  • navigating the cursor from a line containing control characters to the previous/next line can cause the bubble to panic (because the width computation is wrong)

This is most noticeable when inserting a Tab character (ASCII 9) but some other control characters also display weird behavior.

FWIW, the patch in #214 fixes this by using the (new) function tea.SanitizeRunes on the input string. I'm not sure that's the best approach, but it works.

@knz
Copy link
Contributor Author

knz commented Oct 5, 2022

Note: this issue is compounded (and can be made worse) by charmbracelet/lipgloss#108

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants