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

fix(terminal/stream): correct invalid assertion #1590

Merged
merged 1 commit into from
Mar 17, 2024

Conversation

qwerasd205
Copy link
Collaborator

@qwerasd205 qwerasd205 commented Mar 17, 2024

The problem?

Current scalar stream handling logic doesn't really have a consistent expectation for how to handle 0x1B in the middle of a utf-8 code sequence.

The fix?

Removed assertion in nextUtf8 that expected it to never receive 0x1B, instead added logic so that if the utf-8 decoder ever emits 0x1B as a codepoint (e.g. when a code sequence is illegally terminated with it) it's sent to the parser to put it in the right mode

Notes

  • Could maybe bypass a couple layers of abstraction when sending the 0x1B from the utf-8 decoder to the parser, this was just a quick fix.
  • Could/should add unit tests for behavior of escapes interrupting utf-8 code sequences and similar edge cases.

@mitchellh mitchellh merged commit 5dc7384 into ghostty-org:main Mar 17, 2024
14 of 15 checks passed
@mitchellh mitchellh deleted the fix-stream branch March 17, 2024 23:45
@mitchellh
Copy link
Contributor

Danke

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

Successfully merging this pull request may close these issues.

None yet

2 participants