CommandCodeAI / CommandCodeAI/command-code
Shift+Enter can't insert a newline
還沒有人認領這個 Issue。
- 主要語言
- 沒有語言資料
- 星號
- 4k
- 分支
- 350
- PR 合併指標
- 30 天內沒有已合併 PR
描述
Summary
Shift+Enter submits the prompt instead of inserting a newline, so multi-line prompts are impossible without knowing the undocumented Ctrl+J fallback. The input parser already accepts the enhanced Shift+Enter sequences; the app never activates the kitty keyboard protocol, so capable terminals keep sending a bare CR.
Expected Behavior
Enter submits, Shift+Enter inserts a newline — as the help panel states: "Shift+Enter / Alt+Enter → Insert a newline". tui.input.newLine already defaults to ["shift+enter","ctrl+j"] .
Actual Behavior
Shift+Enter behaves exactly like Enter: the prompt submits immediately. Only Ctrl+J inserts a newline.
Cause: the build bundles ink 7.1.0 but never sets kittyKeyboard , and contains no protocol push ( \x1b[>1u ). The parser does accept the encoded sequence ( isNewlineShortcutKey handles \x1b[13;2u , \x1b[27;2;13~ and peers), so only the activation is missing.
Steps to reproduce the issue
- Run cmd in a kitty-protocol terminal (WezTerm here; it needs enable_kitty_keyboard = true ).
- Type AAA , press Shift+Enter, type BBB , press Enter.
- Observed: submits on Shift+Enter, only AAA is sent. Expected: two lines.
Pushing \x1b[>1u around the binary from a zsh wrapper makes Shift+Enter send \x1b[13;2u and work correctly, which confirms the terminal and parser are fine.
Command Code Version
1.53.1
Operating System
Arch Linux 7.2.4-arch1-2 / Hyprland 0.56.2 (Wayland)
Terminal/IDE
WezTerm 20260716-195552-76b606ec
Shell
zsh 5.9.2
Session file (optional)
No response
Fix prompt (optional)
Enable the kitty keyboard protocol in the Ink render call — Ink supports it since 6.7.0:
render(<App />, { kittyKeyboard: { mode: 'enabled' } });
Use 'enabled' , not 'auto' (auto-detection fails under tmux). Pop with \x1b[<u on exit and in signal handlers. The parser already handles the sequences, so no parser change is needed. Keep Ctrl+J as the universal fallback and document that WezTerm needs enable_kitty_keyboard = true .
Check: cmd → AAA → Shift+Enter → BBB → Enter must show two lines; Ctrl+J must still insert a newline and Enter must still submit.
Additional context
No response
貢獻指南
這個儲存庫沒有索引到貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
找出 Ink 的 render 呼叫,並檢查終端輸入生命週期的處理方式;issue 指出 kittyKeyboard activation 與現有的 isNewlineShortcutKey parser 是相關的進入點。啟用 kitty keyboard protocol,保留 Ctrl+J 和 Enter 的行為,並處理結束時以及收到 signals 時的 protocol cleanup。在使用 kitty protocol 的終端機中透過 cmd 使用 AAA、Shift+Enter、BBB 和 Enter 進行驗證,並確認 Ctrl+J 仍會插入換行。
由索引模型根據 Issue 內容生成。
評估
- 領域
- cli
- Issue 類型
- 缺陷
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 活躍度
- 活躍
- 描述清晰度
- 描述清楚
- 新手友好度
- 78/100