fix(cli): preserve LF as newline in Warp terminal (Shift+Enter regression #22908)#23921
Open
MrFrogIsMe wants to merge 1 commit into
Open
fix(cli): preserve LF as newline in Warp terminal (Shift+Enter regression #22908)#23921MrFrogIsMe wants to merge 1 commit into
MrFrogIsMe wants to merge 1 commit into
Conversation
…sion) Warp sends Shift+Enter as bare LF (c-j), identical to Ctrl+Enter on Windows Terminal. Without this fix, _preserve_ctrl_enter_newline() returns False on macOS and _bind_prompt_submit_keys() binds c-j to submit — making Shift+Enter submit the message instead of inserting a newline. Fix: detect TERM_PROGRAM=WarpTerminal (set by Warp for all sessions) and treat it the same as WT_SESSION / SSH / WSL — preserve c-j as the newline keybinding so Shift+Enter works as expected. Fixes NousResearch#22908
1 task
This was referenced May 14, 2026
13 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Warp terminal sends Shift+Enter as bare LF (
c-j), exactly the same byte that Windows Terminal sends for Ctrl+Enter. On macOS,_preserve_ctrl_enter_newline()returnsFalse, so_bind_prompt_submit_keys()bindsc-jto submit — meaning Shift+Enter submits the message instead of inserting a newline.This is a regression from commit
5044e1cbf(fix(cli): submit LF enter in thin PTYs), which was correct for docker-exec / thin PTY environments, but inadvertently broke Warp users.Fixes #22908.
Root Cause
Warp sets
TERM_PROGRAM=WarpTerminalfor every shell session. Checking this env var is the same pattern already used forWT_SESSION(Windows Terminal).Fix
Add a Warp detection branch to
_preserve_ctrl_enter_newline():When this returns
True,_bind_prompt_submit_keys()skips thec-j → submitbinding, and the separately registered@kb.add('c-j')newline handler fires for Shift+Enter instead.Testing
test_warp_terminal_preserves_newline— asserts the fix triggers forTERM_PROGRAM=WarpTerminaltest_non_warp_macos_does_not_preserve— asserts other macOS terminals (Terminal.app, iTerm2) are unaffectedtests/cli/test_ctrl_enter_newline.pypassAffected Terminals