Forward keypress bug fixed.

This commit is contained in:
Storm Dragon
2026-05-14 20:10:11 -04:00
parent 8966275071
commit a8e4d7bb2a
5 changed files with 91 additions and 5 deletions
+43
View File
@@ -217,6 +217,35 @@ def test_pty_backspace_with_fenrir_key_synthesizes_shortcut_events():
assert second_event["data"]["event_state"] == 0
@pytest.mark.unit
@pytest.mark.parametrize(
"sequence",
[
b"\x08",
b"\x1b[3~",
b"\x1b[3;5~",
b"\x1b[27;5;8~",
b"\x1b[27;5;127~",
b"\x1b[8;5u",
b"\x1b[127;5u",
],
)
def test_pty_xterm_backspace_variants_with_fenrir_key_synthesize_shortcut_events(
sequence,
):
pty_driver = PtyDriver()
event_queue = Mock()
pty_driver.env = {
"input": {"curr_input": ["KEY_FENRIR"]},
}
handled = pty_driver.synthesize_backspace_shortcut(sequence, event_queue)
assert handled is True
first_event = event_queue.put.call_args_list[0].args[0]
assert first_event["data"]["event_name"] == "KEY_BACKSPACE"
@pytest.mark.unit
def test_pty_plain_backspace_is_not_synthesized():
pty_driver = PtyDriver()
@@ -229,3 +258,17 @@ def test_pty_plain_backspace_is_not_synthesized():
assert handled is False
event_queue.put.assert_not_called()
@pytest.mark.unit
def test_pty_plain_delete_sequence_is_not_synthesized():
pty_driver = PtyDriver()
event_queue = Mock()
pty_driver.env = {
"input": {"curr_input": []},
}
handled = pty_driver.synthesize_backspace_shortcut(b"\x1b[3~", event_queue)
assert handled is False
event_queue.put.assert_not_called()