Skip to content

fix(cli): preserve classic multiline on macOS#22911

Open
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:fix/22908-classic-cli-shift-enter
Open

fix(cli): preserve classic multiline on macOS#22911
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:fix/22908-classic-cli-shift-enter

Conversation

@LeonSGP43

Copy link
Copy Markdown
Contributor

Summary

  • keep c-j reserved for newline in the classic CLI on local macOS, so Shift+Enter paths that collapse to LF stop submitting the prompt
  • preserve the existing LF-submit behavior for thin PTYs via HERMES_CLI_SUBMIT_ON_LF=1
  • add regression coverage for macOS default behavior and the explicit LF-submit opt-in

Closes #22908.

Why this stays narrow

  • only touches classic CLI keybinding decisions in cli.py
  • keeps the existing Windows/WSL/SSH/WT Ctrl+Enter newline behavior intact
  • does not change TUI multiline shortcuts; #22909 remains separate

Verification

  • git diff --check
  • ./.venv/bin/python -m pytest tests/cli/test_cli_init.py tests/cli/test_ctrl_enter_newline.py tests/cli/test_cli_shift_enter_newline.py
  • uv sync --frozen --extra all
  • uv run --frozen ruff check .
  • env -i PATH="$PATH" HOME="$HOME" TERM="${TERM:-xterm-256color}" TZ=UTC LANG=C.UTF-8 LC_ALL=C.UTF-8 PYTHONHASHSEED=0 ./.venv/bin/python -m pytest -o addopts= --collect-only --ignore=tests/integration --ignore=tests/e2e -m 'not integration'
  • repo ruff/ty lint-diff against b67ea7ff474831743b14edefb6c9113cb12216e7 (touched files: 0 new ty diagnostics)

Left out

  • no TUI fallback shortcut changes
  • no docs changes beyond the code comments/tests needed to pin behavior

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard labels May 10, 2026
@hanzckernel

Copy link
Copy Markdown
Contributor

Verified this covers the Apple Terminal regression I hit after #22777:

  • local environment reports TERM_PROGRAM=Apple_Terminal
  • Ctrl+J/bare LF currently submits in classic CLI on v0.13.0
  • Apple Terminal does not reliably emit the Esc, Enter sequence for physical Option+Enter, so the practical fallback is only manual Esc then Enter or editor mode

I checked out this PR and ran the focused CLI coverage locally:

scripts/run_tests.sh tests/cli/test_cli_init.py tests/cli/test_ctrl_enter_newline.py tests/cli/test_cli_shift_enter_newline.py -q
51 passed in 3.83s

The HERMES_CLI_SUBMIT_ON_LF=1 escape hatch looks like the right way to preserve the thin-PTY behavior without making normal local macOS multiline input worse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Shift+Enter no longer inserts a newline in classic Hermes CLI

3 participants