fix(tui): complete PR #3051 — Esc must not exit plan mode; Ctrl+C keeps draft#3670
Merged
Conversation
…rl+C keeps draft PR esengine#3051 split Shift+Tab (mode cycle) from Esc (cancel) by removing the case m.bypass branch in the Esc handler, but missed the adjacent case m.planMode branch sitting right next to it. Result: plan mode was still escapable by hitting Esc, and the second unwanted behaviour fell in the Ctrl+C branch: when both an active text selection and a non-empty composer existed, Ctrl+C used to wipe the draft text while also dropping the selection. Two changes in internal/cli/chat_tui.go: 1. Esc handler: drop the case m.planMode := false branch entirely. The mode-cycle switch (Shift+Tab) is now the single, documented way to toggle plan / YOLO. PR esengine#3051 already did the YOLO side; this commit finishes the plan side. The comment block above the switch is updated to match. 2. Ctrl+C handler: hoist the selection-copy branch above the clear-input branch. Standard terminal convention: Ctrl+C copies the active selection. If we processed clear-input first we'd silently destroy the user's draft. After the copy a second Ctrl+C will still clear the composer; on an empty composer the double-press-quit gesture continues to work. Tests (internal/cli/chat_tui_test.go): - TestEscInPlanModeDoesNotExitPlan: regression for the PR esengine#3051 miss. The YOLO equivalent was already removed in esengine#3051 and is covered by control/yolo_test.go at the controller layer; not duplicated here. - TestCtrlCCopyBeatsClearInput: regression for the priority swap. Composer draft survives the copy; a follow-up Ctrl+C clears it. - Pre-existing TestCtrlCCopySelection and TestCtrlCClearsThen... continue to pass.
Contributor
Author
|
Re-running CI via empty commit (gh run rerun requires admin rights). |
esengine
approved these changes
Jun 9, 2026
esengine
left a comment
Owner
There was a problem hiding this comment.
Verified end-to-end. Reverting each hunk to base behavior fails the two new tests: Esc flips plan mode off (TestEscInPlanModeDoesNotExitPlan) and Ctrl+C wipes a draft when a selection exists (TestCtrlCCopyBeatsClearInput). With the fix both pass and the full cli package is green. This correctly completes the plan-mode half that #3051 missed and makes selection-copy take precedence over clear-input. The earlier Windows CI red was the unrelated TestRunShell_CancelStopsCommand timing flake, green on re-run after updating the base. Thanks.
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.
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.
🤖 Generated by AI (CnsMaple + Reasonix)
Follow-up to #3051
PR #3051 (merged) removed the Esc-from-YOLO branch but left the
Esc-from-plan-mode branch in place. In practice that means once the user
entered plan mode (
/plan, Shift+Tab), a single Esc would silently flipthem back to the less-permissive "normal" mode — exactly the surprise that
#3051 set out to eliminate for YOLO. Mode toggles are now exclusively
driven by Shift+Tab, matching how YOLO is treated.
While in the file, the idle Ctrl+C branch was also reordered: an active
text selection now takes precedence over the composer-clear / double-press
quit gestures, so Ctrl+C stops silently wiping a half-typed draft just
because the user happened to have a selection.
Changes
internal/cli/chat_tui.go(+26/-20): drop them.planModearm from theEsc handler; comment updated to spell out the Shift+Tab-only mode rule.
internal/cli/chat_tui_test.go(+59): regression coverage for Esc inplan mode and Ctrl+C-with-active-selection.
Tests
go test ./internal/cli/ -count=1 -run 'TestEsc|TestCtrl|TestPlan'→ all pass.
esengine:main-v2 @ 90c24655.Out of scope