hermes-agent/tests/cli
Teknium 70bc52e408
fix(cli): make Ctrl+Enter insert newline on WSL/SSH/Windows Terminal (#22777)
Native Windows, WSL, SSH sessions, and Windows Terminal all send
Ctrl+Enter as bare LF (c-j). Hermes was binding c-j as submit on
every POSIX platform, so Ctrl+Enter submitted instead of inserting
a newline on those terminals. Reported in #22379.

Add _preserve_ctrl_enter_newline() predicate that detects the
environments where Ctrl+Enter must produce a newline (sys.platform
== 'win32', SSH_CONNECTION/SSH_CLIENT/SSH_TTY env, WT_SESSION,
WSL_DISTRO_NAME, /proc/version 'microsoft' marker). Gate the
c-j-as-submit binding off in those environments and gate the
c-j-as-newline handler on. Local POSIX TTYs without those markers
(docker exec, plain ssh from a Mac) keep c-j as submit so plain
Enter still works on thin PTYs.

Add install_ctrl_enter_alias() in hermes_cli/pt_input_extras.py
mapping the three CSI-u / modifyOtherKeys variants of Ctrl+Enter
('\x1b[13;5u', '\x1b[27;5;13~', '\x1b[27;5;13u') to the
(Escape, ControlM) tuple Alt+Enter produces. This lets Kitty /
mintty / xterm-with-modifyOtherKeys users over SSH get a Ctrl+Enter
newline through the existing Alt+Enter handler.

9 new tests + extended existing test_lf_enter_binds_to_submit_handler_posix
to cover bare-local vs SSH branches.

Closes #22379.
2026-05-09 12:48:14 -07:00
..
__init__.py
test_branch_command.py
test_busy_input_mode_command.py
test_cli_approval_ui.py
test_cli_background_tui_refresh.py
test_cli_bracketed_paste_sanitizer.py
test_cli_browser_connect.py
test_cli_context_warning.py
test_cli_copy_command.py
test_cli_extension_hooks.py
test_cli_external_editor.py
test_cli_file_drop.py fix(cli): catch OSError in _resolve_attachment_path to prevent ENAMETOOLONG dropping long slash commands 2026-05-06 06:34:48 -07:00
test_cli_force_redraw.py fix(cli): recover classic CLI output after resize 2026-05-06 04:20:54 -07:00
test_cli_goal_interrupt.py fix(goals): Ctrl+C during /goal loop auto-pauses the goal (#21888) 2026-05-08 06:53:13 -07:00
test_cli_image_command.py
test_cli_init.py fix(cli): make Ctrl+Enter insert newline on WSL/SSH/Windows Terminal (#22777) 2026-05-09 12:48:14 -07:00
test_cli_interrupt_subagent.py
test_cli_loading_indicator.py
test_cli_markdown_rendering.py
test_cli_mcp_config_watch.py
test_cli_new_session.py feat: confirm prompt for destructive slash commands (#4069) (#22687) 2026-05-09 11:04:46 -07:00
test_cli_prefix_matching.py
test_cli_preloaded_skills.py
test_cli_provider_resolution.py
test_cli_reload_skills.py
test_cli_retry.py
test_cli_save_config_value.py
test_cli_secret_capture.py
test_cli_shift_enter_newline.py feat(cli): recognise Shift+Enter as a newline key 2026-05-08 16:26:51 -07:00
test_cli_shutdown_memory_messages.py
test_cli_skin_integration.py
test_cli_status_bar.py refactor: replace 'cmp' text with 🗜️ emoji in status bar 2026-05-07 05:27:45 -07:00
test_cli_status_command.py
test_cli_steer_busy_path.py
test_cli_terminal_response_sanitizer.py
test_cli_tools_command.py
test_cli_user_message_preview.py
test_compress_focus.py
test_cprint_bg_thread.py fix(cli): recover classic CLI output after resize 2026-05-06 04:20:54 -07:00
test_ctrl_enter_newline.py fix(cli): make Ctrl+Enter insert newline on WSL/SSH/Windows Terminal (#22777) 2026-05-09 12:48:14 -07:00
test_cwd_env_respect.py
test_destructive_slash_confirm.py feat: confirm prompt for destructive slash commands (#4069) (#22687) 2026-05-09 11:04:46 -07:00
test_fast_command.py
test_gquota_command.py
test_manual_compress.py
test_personality_none.py
test_quick_commands.py
test_reasoning_command.py
test_resume_display.py fix(cli): recover classic CLI output after resize 2026-05-06 04:20:54 -07:00
test_save_conversation_location.py
test_session_boundary_hooks.py
test_stream_delta_think_tag.py
test_surrogate_sanitization.py
test_tool_progress_scrollback.py
test_worktree.py
test_worktree_security.py