Feature request: emit a distinct CSI-u sequence for Ctrl+Enter in terminal blocks
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 功能
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- typescript
- 领域
- cli
调研方向
从 frontend/app/view/term/term-model.ts 中的 handleTerminalKeydown() 开始,将现有的 Shift+Enter 处理与所请求的 Ctrl+Enter 情况进行比较。验证 Enter、Shift+Enter、Ctrl+Enter 和 Alt+Enter 的原始字节,确认现有的 Enter 行为保持不变,并确认新序列在所述平台上都能正常工作。
由索引模型根据 Issue 内容生成。
描述
Feature description
Please add terminal-block handling for Ctrl+Enter so WaveTerm emits a distinct key sequence instead of collapsing it to the same byte as Enter/newline.
A practical default would be to send the CSI-u representation for Ctrl+Enter:
ESC [ 13 ; 5 u
or, as a JavaScript string:
"\x1b[13;5u"
This would let terminal applications distinguish Ctrl+Enter from plain Enter and Shift+Enter.
Why this matters
Many interactive terminal applications and coding/chat CLIs support configurable input behavior such as:
Enterinserts a newlineCtrl+Entersubmits/sends the message
This is useful for multi-line prompts in AI/coding tools and other REPL-like terminal UIs.
Today, WaveTerm can already special-case modified Enter keys. PR #2523 added related handling for Shift+Enter newline support in frontend/app/view/term/term-model.ts. This request is the analogous missing case for Ctrl+Enter.
Current behavior
Testing in WaveTerm with a raw byte reader shows:
Enter -> 0a
Shift+Enter -> 0a
Ctrl+Enter -> 0a
Alt+Enter -> 1b 0a
So Enter, Shift+Enter, and Ctrl+Enter are indistinguishable to the program running inside the terminal. Alt+Enter is distinguishable because it carries an ESC prefix.
Expected behavior
Ctrl+Enter should produce a distinct sequence, for example:
Ctrl+Enter -> 1b 5b 31 33 3b 35 75
which is:
\x1b[13;5u
Terminal applications that understand CSI-u can then bind ctrl+enter separately from enter.
Suggested implementation
In frontend/app/view/term/term-model.ts, inside handleTerminalKeydown(), add a Ctrl:Enter branch near the existing Shift:Enter branch:
if (keyutil.checkKeyPressed(waveEvent, "Ctrl:Enter")) {
this.sendDataToController("\x1b[13;5u");
event.preventDefault();
event.stopPropagation();
return false;
}
This mirrors the existing approach used for Shift:Enter, but sends a standard CSI-u modified-key sequence instead of a newline byte.
Validation
After applying this locally, the raw-byte test becomes:
Enter -> 0a
Shift+Enter -> 0a
Ctrl+Enter -> 1b 5b 31 33 3b 35 75
Alt+Enter -> 1b 0a
With that output, applications such as Pi can configure:
{
"tui.input.newLine": ["enter", "shift+enter", "ctrl+j"],
"tui.input.submit": ["ctrl+enter"]
}
and get the intended behavior without local WaveTerm binary patching.
Related work
- #2523 added terminal input improvements, including
Shift+Enternewline support. - This request extends the same terminal-block keydown handling pattern to
Ctrl+Enter.
Acceptance criteria
-
Ctrl+Enterin a terminal block emits\x1b[13;5uor another documented distinct Ctrl+Enter sequence. -
EnterandShift+Enterbehavior remains unchanged. - The behavior works on Linux, macOS, and Windows where the browser/Electron key event exposes
Ctrl+Enter. - The behavior is documented if WaveTerm has terminal key handling documentation.
- 主要语言
- Go
- 星标
- 22.3k
- 派生
- 1.1k
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
wavetermdev/waveterm 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
wavetermdev/waveterm#3481 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
wavetermdev/waveterm#3435 ·
-
难度 1/5 1 小时以内 新手友好度 85/100
wavetermdev/waveterm#3432 ·
-
enhancement triage
难度 2/5 1-3 小时 新手友好度 82/100
wavetermdev/waveterm#3431 ·
-
难度 2/5 1-3 小时 新手友好度 86/100
wavetermdev/waveterm#3428 ·
查看 wavetermdev/waveterm 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 1/5 1 小时以内 新手友好度 84/100
-
enhancement needs triage
难度 2/5 1-3 小时 新手友好度 68/100
-
kind/cleanup
难度 2/5 1-3 小时 新手友好度 88/100
kubernetes-sigs/kueue#15947 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
sympozium-ai/sympozium#627 ·