feat(tui):改进 TAB 模式切换并稳定斜杠/粘贴输入行为#562
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
| return strings.ContainsRune(chunk, '\n') || strings.ContainsRune(chunk, '\r') || strings.ContainsRune(chunk, '\t') | ||
| // Once a paste transaction starts, keep absorbing rune chunks until debounce flush. | ||
| // This avoids fragmenting one long paste into repeated summary tokens. | ||
| return true |
There was a problem hiding this comment.
pasteTxnActive now makes every subsequent non-Paste rune event part of the paste transaction until the debounce flush fires. That widens a false positive into a real input regression: an IME commit or any other multi-rune key event can start the transaction, and then normal typing typed immediately after it gets swallowed and summarized as paste content. The previous logic still required the follow-up chunks to look paste-like; I think that guard needs to stay in some form, plus a regression test for "paste starts, then the user types normally before flush".
| @@ -112,8 +97,7 @@ func (k keyMap) ShortHelp() []key.Binding { | |||
| func (k keyMap) FullHelp() [][]key.Binding { | |||
| return [][]key.Binding{ | |||
There was a problem hiding this comment.
This PR turns Tab into the primary plan/build toggle, but that shortcut is still absent from the help surfaces (ShortHelp/FullHelp, and the startup quick actions are unchanged too). As shipped, the feature is only discoverable if someone already knows it exists, so the user-facing help is now out of sync with the behavior.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
背景
这组改动主要聚焦 TUI 输入交互的一致性和可预期性,覆盖三类问题:
TAB切换plan/build模式能力落地,并修复输入态下无法切换的问题。改动概览
1) slash 补全与废弃能力清理
TAB补全时的替换范围问题(避免多词命令补全后残留异常字符)。Ctrl+O文件浏览入口移除。TAB承接模式切换)。对应 commit:
2e387dac2) 新增 TAB 切换 plan/build(含后端透传)
TAB在 TUI 中切换plan/build的能力。对应 commit:
0d2241443) 修复“输入时无法切换 plan/build”
TAB事件优先级:保留“补全优先”,移除“输入态 Tab 插入制表符”的抢占。plan/build(有补全候选时仍优先补全)。对应 commit:
1ea96dfd4) 粘贴行为修复(误判与长文本重复 token)
[paste N LINE]token 的问题:对应 commit:
1151ea6e影响与兼容性
TAB在输入框中的语义已调整为“补全优先,其次模式切换”,不再用于插入制表符。测试
已执行:
go test ./internal/tui/...关键用例覆盖:
TAB模式切换。