The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test: align submit bindings with multiline default
John Lussierb3447c21299f
diff --git a/tests/cli/test_cli_init.py b/tests/cli/test_cli_init.pyindex 4de51de7204..bcad5af82ae 100644--- a/tests/cli/test_cli_init.py+++ b/tests/cli/test_cli_init.py@@ -150,14 +150,14 @@ class TestBusyInputMode:class TestPromptToolkitTerminalCompatibility:- def test_lf_enter_binds_to_submit_handler_posix(self):- """Some thin PTYs deliver Enter as LF/c-j instead of CR/enter.+ def test_lf_enter_binding_respects_multiline_shortcuts(self):+ """Ctrl+J is reserved by default, with legacy LF-submit available as an opt-out.- On a bare local POSIX TTY (no SSH/WSL/WT/Ghostty) we keep c-j → submit so- Enter works on thin PTYs (docker exec, certain ssh configurations).- In WSL, SSH sessions, Windows Terminal, and Ghostty we leave c-j- unbound here so it can be used as the Ctrl+Enter newline keystroke- without conflicting with submit. See issue #22379.+ Some thin POSIX PTYs deliver plain Enter as LF/c-j instead of CR/enter.+ The default keeps c-j free for multiline input; disabling multiline+ shortcuts restores c-j → submit on bare local POSIX terminals. Windows,+ WSL, SSH sessions, Windows Terminal, and Ghostty always reserve c-j for+ the Ctrl+Enter/Ctrl+J newline binding. See issue #22379.The native-Windows arm of this behaviour is``test_windows_leaves_ctrl_j_unbound`` below — it has to run on a real@@ -176,13 +176,26 @@ class TestPromptToolkitTerminalCompatibility:def submit_handler(event):return None- # Bare local POSIX (no SSH/WSL markers): both enter and c-j submit.+ # Default: Enter submits while c-j stays free for the newline binding.+ # (Runs on the POSIX CI job; the native-Windows arm is the marked test+ # below, so no sys.platform fake is needed here.)with _patch.dict(_os.environ, {}, clear=True), \_patch("builtins.open", side_effect=OSError("no /proc")):kb = KeyBindings()_bind_prompt_submit_keys(kb, submit_handler)bindings = {tuple(key.value for key in binding.keys): binding.handler for binding in kb.bindings}assert bindings[("c-m",)] is submit_handler+ assert ("c-j",) not in bindings++ # Legacy opt-out: bare POSIX LF/c-j submits for thin PTYs.+ kb = KeyBindings()+ _bind_prompt_submit_keys(+ kb,+ submit_handler,+ multiline_shortcuts_enabled=False,+ )+ bindings = {tuple(key.value for key in binding.keys): binding.handler for binding in kb.bindings}+ assert bindings[("c-m",)] is submit_handlerassert bindings[("c-j",)] is submit_handler# POSIX over SSH: c-j stays free so Ctrl+Enter (sent as LF by