Skip to content

fix(tui): ESC no longer exits YOLO; Ctrl+C copies selection to clipboard#3051

Merged
esengine merged 1 commit into
esengine:main-v2from
CnsMaple:fix/esc-yolo-and-ctrl-c-copy
Jun 4, 2026
Merged

fix(tui): ESC no longer exits YOLO; Ctrl+C copies selection to clipboard#3051
esengine merged 1 commit into
esengine:main-v2from
CnsMaple:fix/esc-yolo-and-ctrl-c-copy

Conversation

@CnsMaple

@CnsMaple CnsMaple commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

问题

1. ESC 意外退出 YOLO 模式

空闲时按 ESC 会调用 SetBypass(false),将 YOLO 模式(--dangerously-skip-permissions)静默还原为 auto。用户仅想清空输入或双击 ESC 呼出回滚选择器时,却丢失了 YOLO 状态。

2. Ctrl+C 无法复制选中文本

空闲时用鼠标选中文本后按 Ctrl+C,触发的却是"再按一次退出"序列,而不是复制到剪贴板。Ctrl+C 复制是标准终端约定。

修复

ESC → YOLO

删除了 ESC 处理中的 case m.ctrl.Bypass() 分支。YOLO 模式现在通过 Shift+Tab 循环(normal → plan → YOLO → normal)退出。

修改文件: internal/cli/chat_tui.go — ESC switch 分支(删除了 case m.ctrl.Bypass(): m.ctrl.SetBypass(false)

Ctrl+C → 复制选中文本

在通用按键清除选中状态之前保存它;Ctrl+C 处理中先检查是否有选中文本,有则复制到剪贴板,不触发退出序列。

修改文件: internal/cli/chat_tui.go — 在 KeyPress 入口处保存 sel := m.sel,Ctrl+C 分支新增选中文本检测+复制逻辑

测试

新增 TestCtrlCCopySelection — 验证选中+Ctrl+C 复制、清除选中、不启动退出、后续 Ctrl+C 正常退出。

Closes: N/A (无对应 issue)

Two behavioral fixes:

1. ESC no longer disables YOLO mode (--dangerously-skip-permissions).
   Previously, pressing ESC while idle in YOLO mode called SetBypass(false),
   silently reverting to 'auto'. Now ESC when idle in YOLO mode just clears
   input or arms the double-Esc rewind gesture — same as normal mode. YOLO
   is only exited via Shift+Tab cycle or --yolo flag restart.

2. Ctrl+C on an empty composer with an active text selection copies the
   selected text to clipboard (standard terminal convention) instead of
   arming the double-press-to-quit gesture. The selection state is saved
   before the generic keystroke-clears-selection path at the top of the
   KeyPress handler.

Fixes: ESC → YOLO exit; Ctrl+C → copy selection
@github-actions github-actions Bot added the v2 Go rewrite (1.x) — main-v2 branch, active development label Jun 4, 2026
@esengine esengine merged commit 174d344 into esengine:main-v2 Jun 4, 2026
1 check passed
@CnsMaple CnsMaple deleted the fix/esc-yolo-and-ctrl-c-copy branch June 9, 2026 02:56
esengine pushed a commit that referenced this pull request Jun 9, 2026
Complete #3051: drop the plan-mode arm from the Esc handler so mode switches are exclusively Shift+Tab driven (Esc must not silently drop to a less-permissive mode). Also hoist Ctrl+C selection-copy above clear-input so copying a selection no longer wipes a half-typed draft.
SuMuxi66 pushed a commit to SuMuxi66/DeepSeek-Reasonix that referenced this pull request Jun 10, 2026
Complete esengine#3051: drop the plan-mode arm from the Esc handler so mode switches are exclusively Shift+Tab driven (Esc must not silently drop to a less-permissive mode). Also hoist Ctrl+C selection-copy above clear-input so copying a selection no longer wipes a half-typed draft.
dorokuma pushed a commit to dorokuma/DeepSeek-Reasonix that referenced this pull request Jun 10, 2026
Complete esengine#3051: drop the plan-mode arm from the Esc handler so mode switches are exclusively Shift+Tab driven (Esc must not silently drop to a less-permissive mode). Also hoist Ctrl+C selection-copy above clear-input so copying a selection no longer wipes a half-typed draft.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants