bubbles
bubbles copied to clipboard
textarea/textinput: control characters in input cause misbehavior/crashes during navigation
trafficstars
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.
Note: this issue is compounded (and can be made worse) by https://github.com/charmbracelet/lipgloss/issues/108