Vouch request: configurable Escape-clears-input behavior (escapeClearBehavior) #4183
Closed
xaviergmail
started this conversation in
General
Replies: 1 comment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi maintainers — per CONTRIBUTING I am opening a Discussion before a PR and requesting a vouch (
!vouch @xaviergmail).What I would like to contribute
A small, opt-in TUI quality-of-life setting. Today single-Escape on a non-empty draft unconditionally clears the composer with no way to recover the text. As a vim user I reflexively hit Escape mid-prompt and lose long drafts.
Proposed: a new
escapeClearBehaviorsetting, defaultdiscard(current behavior, byte-for-byte), plus two opt-in modes:discard— clear the draft (unchanged default)history— save the draft to prompt history first (Up Arrow restores it), then clear — via the existingCustomEditor.clearDraft(text)none— leave the draft untouched;Ctrl+Cstill clearsBoth idle-clear sites in
InputController.onEscape(main view and focused-subagent view) honor the setting. Fornoneat the main site the Escape is still consumed (double-Esc timer + streaming-escape arm reset) so a no-op Esc cannot seed a spurious/tree|/branchbacktrack. Bash/python mode-exit clears are untouched.Scope
6 files, +145/-3:
packages/coding-agent/src/config/settings-schema.ts— new enum settingpackages/coding-agent/src/modes/controllers/input-controller.ts— gate both clear sitesdocs/settings.md,docs/keybindings.md— documentedpackages/coding-agent/CHANGELOG.md—### Addedentrypackages/coding-agent/test/input-controller-escape.test.ts— +5 tests (all 3 behaviors at both sites)Verified locally:
bun test input-controller-escape.test.ts→ 35 pass / 0 fail;check:typesclean;biome checkclean.Branch is ready on my fork: https://github.com/xaviergmail/oh-my-pi/tree/feat/configurable-escape-clear-input
Happy to adjust the naming/defaults/approach to your preference before I open the PR. Thanks!
All reactions