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

Proper escape sequence intermediate handling #3122

Closed
aymanbagabas opened this issue Dec 25, 2024 · 1 comment · Fixed by #4063
Closed

Proper escape sequence intermediate handling #3122

aymanbagabas opened this issue Dec 25, 2024 · 1 comment · Fixed by #4063
Labels
contributor friendly A well-scoped, approachable issue for someone looking to contributor. vt Control sequence related
Milestone

Comments

@aymanbagabas
Copy link
Member

Many escape sequences ignore intermediate bytes. For example, Erase Characters (ECH) CSI <n> X doesn't have any intermediate bytes, and something like CSI ? X should be ignored. Instead, Ghostty treat CSI ? X as if it was CSI X and erases a character at the current cursor position.

printf 'ABC\b\x1b[?X'

Current output:

AB_

The cursor is at the 3rd column

Expected output (invalid sequence is ignored):

ABC

The cursor is at the 4th column

@mitchellh mitchellh added the vt Control sequence related label Dec 25, 2024
@mitchellh
Copy link
Contributor

Ah yes that's right. This is some old stuff (in the Ghostty codebase). A lot of the original stream processing stuff ignored intermediates because we didn't handle them then! We should go back over and audit all the sequences that need this check and add it.

While doing so, we should ensure to add unit test coverage which is now available at the bottom of that file.

@mitchellh mitchellh added the contributor friendly A well-scoped, approachable issue for someone looking to contributor. label Dec 25, 2024
aymanbagabas added a commit to aymanbagabas/ghostty that referenced this issue Dec 30, 2024
This adds missing handling for CSI and ESC commands.

Fixes: ghostty-org#3122
mitchellh added a commit that referenced this issue Jan 2, 2025
This adds missing handling for CSI and ESC commands.

Fixes: #3122

Supersedes: #3132
@mitchellh mitchellh added this to the 1.0.2 milestone Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor friendly A well-scoped, approachable issue for someone looking to contributor. vt Control sequence related
Projects
None yet
2 participants