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 的渲染调用,并检查终端输入生命周期的处理方式;issue 指出 kittyKeyboard 激活和现有的 isNewlineShortcutKey parser 是相关的入口点。启用 kitty keyboard protocol,保留 Ctrl+J 和 Enter 的行为,并处理退出和信号触发时的协议清理。在使用 kitty protocol 的终端中通过 cmd 使用 AAA、Shift+Enter、BBB 和 Enter 进行验证,并确认 Ctrl+J 仍然会插入换行符。
由索引模型根据 Issue 内容生成。
评估
- 领域
- cli
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 活跃
- 描述清晰度
- 描述清楚
- 新手友好度
- 78/100