fix(cli): preserve Ctrl-J newline in CR/LF terminals - #32860
Conversation
862c602 to
ee4b548
Compare
|
Refresh update: I rebased this branch onto current Updated head: Targeted local verification on the updated head:
GitHub Actions is still blocked at the fork workflow approval gate ( |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for extending the existing environment-gated classic-CLI behavior. Current main still binds c-j to submit when _preserve_ctrl_enter_newline() is false (cli.py:3189-3190), while its predicate has no WezTerm, Warp, or Kitty marker (cli.py:3149-3171), so the PR targets a live path.
Problems
cli.py:2486addsWarpTerminalto the new allowlist, buttests/cli/test_ctrl_enter_newline.py:66-77only adds WezTerm and Kitty coverage. The Warp branch would be unprotected.
Suggested changes
- Add a
TERM_PROGRAM=WarpTerminalregression case; ideally verify the resulting_bind_prompt_submit_keys()binding as well as the predicate result.
Automated hermes-sweeper review.
| @@ -2483,16 +2483,19 @@ def _patched_vt100_feed(self_parser, data: str) -> None: | |||
| ) | |||
|
|
|||
|
|
|||
| _RAW_LF_NEWLINE_TERM_PROGRAMS = {"WezTerm", "WarpTerminal"} | |||
There was a problem hiding this comment.
WarpTerminal is introduced here but has no matching regression fixture: the added tests cover WezTerm and Kitty only. Please add a WarpTerminal environment case so every allowlisted TERM_PROGRAM value is covered.
ee4b548 to
94b4ef5
Compare
|
Thanks — addressed on current head
Targeted verification: Please re-review when convenient. |
Summary
c-jas a newline key in known local terminals that distinguish Enter (CR) from Ctrl-J/Ctrl+Enter (LF)KITTY_WINDOW_IDWhy
On Linux WezTerm, Ctrl-J reaches prompt_toolkit as bare LF (
c-j). Hermes currently bindsc-jto submit on local POSIX terminals, so Ctrl-J submits the turn instead of inserting a newline.The existing #22379 fix already avoids binding
c-jto submit in Windows, WSL, SSH, and Windows Terminal environments where LF represents a distinct newline-intent keystroke. This PR extends that same environment-gated approach to known local CR/LF-distinguishing terminal environments instead of enabling blanket POSIX behavior.Related work
c-jsubmit enabled for unrecognized local thin PTYs.Test plan
python -m pytest tests/cli/test_ctrl_enter_newline.py -o addopts= -q