Repository navigation
兼容 Claude Code 自定义 Chat 快捷键 - #21
Merged
Merged
Conversation
- toTmuxSubmitKey 仅保留终端真正可发送的键(Enter / Meta+Enter / Alt+Enter); 移除 ctrl+enter / shift+enter——终端默认无法与普通 Enter 区分,发送 C-Enter/S-Enter 只会静默不提交,改为走 fail-fast 报清晰原因 - selectSubmitKey 去掉 submitKeys 为空时无条件回退 Enter 的分支:仅当 Enter 仍为内置提交(未被改键)时才回退,Enter 被改成 chat:newline 又无可发送提交键 时直接 fail-fast,避免打完字后只插换行、永不提交 - 失败文案不再写死 cmd+enter,统一描述可发送/不可发送键集合 - 为 CLAUDE_CODE_SUBMIT_KEY 环境变量补充用途注释 - 新增 3 个测试:ctrl+enter-only fail-fast、enter=newline 无提交键 fail-fast、 环境变量覆盖生效
deepcoldy
approved these changes
May 20, 2026
deepcoldy
left a comment
Owner
There was a problem hiding this comment.
感谢 @YYX413 的贡献!这个 PR 干净地解决了 #20,设计也很到位 —— 默认无 keybindings 配置时行为完全保持不变,向后兼容没有任何风险。
经过 Claude + Codex 双人 review,已在 head f7c5ae5 上收敛了几处边界:
- 可发送提交键白名单收窄到
Enter/Meta+Enter/Alt+Enter(Ctrl/Shift/Cmd+Enter终端无法可靠区分,改为 fail-fast 报清晰原因,避免「假装提交」); enter=chat:newline且无可发送 submit key 时,在写入前就 fail-fast,不会污染输入框;- 失败文案改为通用描述,并补了
CLAUDE_CODE_SUBMIT_KEY注释;新增 3 个测试,68/68 通过、tsc干净。
LGTM,合并。再次感谢 🙏
This was referenced Oct 29, 2026
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.
变更摘要
writeInput时动态读取 Claude Code Chat 快捷键配置~/.claude/keybindings.json,不修改用户配置。enter配置为chat:newline时,嵌入换行使用普通 Enter,最终提交优先使用可通过终端发送的提交键,例如meta+enter->M-Enter。cmd+enter这类 tmux/PTY 无法合成的提交键可用时,在写入输入框前失败并返回明确原因,避免污染 Claude Code 输入框。Fixes #20
验证
pnpm vitest run test/write-input.test.ts:通过,65 个测试全部通过。pnpm build:通过,tsc和 dashboard bundle 均完成。~/.claude/keybindings.json;当前配置下 adapter 发送 Enter、Enter,最后发送 M-Enter。botmux start/status/stop路径可用。说明
cmd+enter通常无法通过 tmux/PTY 合成发送,因此 adapter 会优先选择meta+enter这类终端可发送的提交绑定。如果enter被配置为换行且没有可发送的提交键,botmux 现在会在写入前失败,并报告清晰的配置原因。