Skip to content

fix(cli): preserve Ctrl-J newline on macOS#27688

Open
ForgedFinancial wants to merge 1 commit into
NousResearch:mainfrom
ForgedFinancial:fix/macos-ctrl-j-newline-2026-05-17
Open

fix(cli): preserve Ctrl-J newline on macOS#27688
ForgedFinancial wants to merge 1 commit into
NousResearch:mainfrom
ForgedFinancial:fix/macos-ctrl-j-newline-2026-05-17

Conversation

@ForgedFinancial

Copy link
Copy Markdown

Summary

  • Preserves Ctrl+J as a multiline newline shortcut on macOS instead of binding it to prompt submit
  • Updates the startup/tips copy to surface Ctrl+J first, while keeping Alt+Enter as a forwarded-terminal option
  • Adds focused regression coverage for macOS keybinding behavior and the multiline tip

Test plan

  • .venv/bin/python -m pytest -o addopts="-m 'not integration'" -q tests/cli/test_ctrl_enter_newline.py tests/cli/test_cli_init.py tests/hermes_cli/test_tips.py
  • direct keybinding assertion: macos_ctrl_j_preserve_and_keybinding_assertion=PASS
  • git diff --check

@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 18, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #25111 (same author, same approach, 3rd resubmission). The most comprehensive open fix for the Ctrl-J/c-j macOS keybinding issue is #22911, which also handles Warp terminal. Root issue: #22908.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused fix. I verified the underlying bug still exists on current main: _preserve_ctrl_enter_newline() has no native macOS branch at cli.py:2716-2751, so _bind_prompt_submit_keys() still binds c-j to submit at cli.py:2768-2770, and the newline handler only registers when that predicate is true at cli.py:11308-11322.

Problems

  • The handle_ctrl_enter_newline docstring is still Windows/WSL/SSH/Windows Terminal-specific at cli.py:11311-11320; after adding macOS, that inline documentation would be stale.
  • The PR diff for cli.py around _preserve_ctrl_enter_newline() includes user-specific wording (On Danny's MacBook). That should be generalized to the platform/terminal behavior and root issue [Bug]: Shift+Enter no longer inserts a newline in classic Hermes CLI #22908.

Suggested changes

  • Preserve the current main Ghostty detection branches at cli.py:2735-2740 while adding the macOS behavior, since those were merged after this PR was opened.
  • Update the newline-handler docstring at cli.py:11311-11320 to mention native macOS once darwin is included.
  • Replace the user-specific comment with neutral wording such as native macOS terminals that deliver the multiline shortcut as bare LF/c-j.

This is an automated hermes-sweeper review.

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.

3 participants