Fix alt modifier ignored in ANSI_SEQUENCES_KEYS tuple branch#6379
Open
angelsen wants to merge 1 commit intoTextualize:mainfrom
Open
Fix alt modifier ignored in ANSI_SEQUENCES_KEYS tuple branch#6379angelsen wants to merge 1 commit intoTextualize:mainfrom
angelsen wants to merge 1 commit intoTextualize:mainfrom
Conversation
The `_sequence_to_key_events` method accepts an `alt` parameter but the
tuple branch (matching keys like Enter, Space, Backspace, Tab, and all
Ctrl+letter keys) never applied it. The single-character fallback branch
handled alt correctly, but keys resolved through the tuple branch lost
their alt modifier entirely.
For example, Alt+Enter sends ESC+CR from the terminal. The parser
correctly detected the ESC prefix and passed alt=True into
_sequence_to_key_events("\r", alt=True), but the tuple branch yielded
Key("enter") without checking alt.
Apply the alt prefix in the tuple branch, matching the pattern already
used in the single-character branch.
Add test cases for alt+enter and alt+space to the existing test_keys
parametrize block.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6378
Summary
The
_sequence_to_key_eventsmethod's tuple branch (keys like Enter, Space, Backspace, Tab) ignored thealtparameter, silently dropping the alt modifier. The single-character branch handled it correctly — this applies the same pattern to the tuple branch.alt+prefix in tuple branch whenalt=True, matching existing single-character branch patternalt+enterandalt+spacetest cases to existingtest_keysparametrize blockTest plan
pytest tests/test_xterm_parser.py -k test_keys(9/9 pass)test_xterm_parser.pytests still passkey='alt+enter'in GNOME Console + tmuxCo-Authored-By: Claude Opus 4.6 noreply@anthropic.com