Translate "escape" to "^" when XTermParser has to backtrack

This commit is contained in:
Darren Burns
2022-06-11 13:38:59 +01:00
parent 2f2d064d34
commit 1510739227
2 changed files with 25 additions and 24 deletions

View File

@@ -67,8 +67,8 @@ def test_cant_match_escape_sequence_too_long(parser):
assert len(events) == len(sequence)
assert all(isinstance(event, Key) for event in events)
# '\x1b' is translated to 'escape'
assert events[0].key == "escape"
# When we backtrack '\x1b' is translated to '^'
assert events[0].key == "^"
# The rest of the characters correspond to the expected key presses
events = events[1:]
@@ -87,7 +87,7 @@ def test_unknown_sequence_followed_by_known_sequence(parser):
sequence = unknown_sequence + known_sequence
events = parser.feed(sequence)
assert next(events).key == "escape"
assert next(events).key == "^"
assert next(events).key == "["
assert next(events).key == "?"
assert next(events).key == "end"