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

Unknown CSI inputs result in garbage key events #466

Closed
knz opened this issue Sep 27, 2022 · 2 comments · Fixed by #467
Closed

Unknown CSI inputs result in garbage key events #466

knz opened this issue Sep 27, 2022 · 2 comments · Fixed by #467
Labels
bug Something isn't working

Comments

@knz
Copy link
Contributor

knz commented Sep 27, 2022

When a terminal CSI sequence is not recognized by bubbletea, it is not completely ignored; instead, bubbletea will match the initial escape byte and the character immediately afterwards as a single key with the alt modifier, then interpret the rest as regular key inputs. For example, ESC [ 1003 h gets parsed as alt+1, then 0, then 0, then 3, then h.

Since the CSI sequences all have a regular structure, they could be parsed and ignored as a single unit.

(The definition is strict: a CSI sequence starts with ESC [ and terminates with a byte value in the range 0x40 to 0x7E.)

@muesli
Copy link
Contributor

muesli commented Sep 27, 2022

Could you elaborate how such a sequence would be triggered?

@knz
Copy link
Contributor Author

knz commented Sep 27, 2022

Could you elaborate how such a sequence would be triggered?

For example until #396 gets merged, if you press Shift+Home in xterm you get:

  • 1 key message for Alt+1
  • 1 separate message for a single ; character
  • 1 separate message for 2
  • 1 final message for H.

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

Successfully merging a pull request may close this issue.

2 participants