Skip to content

fix(ui): recognize ctrl+enter as newline in prompt input (#169) - #276

Open
innocarpe wants to merge 1 commit into
lessweb:mainfrom
innocarpe:fix/169-ctrl-enter
Open

fix(ui): recognize ctrl+enter as newline in prompt input (#169)#276
innocarpe wants to merge 1 commit into
lessweb:mainfrom
innocarpe:fix/169-ctrl-enter

Conversation

@innocarpe

Copy link
Copy Markdown

Summary

  • Ctrl+Enter now inserts a newline in the prompt input instead of submitting, matching Shift+Enter behavior.

Why

Terminals with modifyOtherKeys enabled report Ctrl+Enter as ESC[13;5u / ESC[27;5;13~. These sequences were not recognized, so Ctrl+Enter either did nothing or submitted the message depending on the terminal.

Changes

  • packages/cli/src/ui/hooks/useTerminalInput.ts: recognize Ctrl+Enter sequences as return + ctrl.
  • packages/cli/src/ui/views/PromptInput.tsx: getPromptReturnKeyAction treats ctrl as newline; footer hint updated.
  • packages/cli/src/tests/prompt-input-keys.test.ts: tests for the new sequences.

Validation

  • npm run typecheck
  • npm test — prompt input key tests pass ✅

Closes #169

Terminals with modifyOtherKeys enabled report Ctrl+Enter as ESC[13;5u / ESC[27;5;13~. Parse these as return+ctrl and let getPromptReturnKeyAction insert a newline instead of submitting.

(cherry picked from commit f1806d508241a9e8519ed8f493ffc4be8b78c6a4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Ctrl+Enter 换行不生效(同设备Claude Code/Codex正常)

1 participant