claude-code - 💡(How to fix) Fix AskUserQuestion: Escape destroys typed answers (breaks vi/vim users) [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#56890Fetched 2026-05-07 03:42:42
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×3commented ×1

The AskUserQuestion picker interprets the Escape key as "user declined the tool use," which immediately discards any text the user has typed into the free-text "Other" field. For users with a vi/vim editing workflow, Escape is a near-constant reflex (it returns to normal mode before any navigation), which silently destroys long, detailed answers with no recovery path and no warning.

Root Cause

  • Lost work. Users routinely lose multi-paragraph answers representing 30+ seconds to several minutes of careful composition.
  • Trust degradation. Users learn to avoid AskUserQuestion-driven workflows entirely (brainstorming skills, design questions, multi-step configuration prompts) because they cannot safely answer them.
  • Disproportionate impact on power users. vi/vim users — heavily represented in the developer audience Claude Code targets — are exactly the cohort hit by this. The user filing this report had to ask the assistant to permanently never use AskUserQuestion and instead ask questions in plain text in the response body.
  • No workaround in the user's hands. The user cannot disable the picker, cannot remap Escape, and cannot recover the text after it's destroyed.

Fix Action

Fix / Workaround

  • Lost work. Users routinely lose multi-paragraph answers representing 30+ seconds to several minutes of careful composition.
  • Trust degradation. Users learn to avoid AskUserQuestion-driven workflows entirely (brainstorming skills, design questions, multi-step configuration prompts) because they cannot safely answer them.
  • Disproportionate impact on power users. vi/vim users — heavily represented in the developer audience Claude Code targets — are exactly the cohort hit by this. The user filing this report had to ask the assistant to permanently never use AskUserQuestion and instead ask questions in plain text in the response body.
  • No workaround in the user's hands. The user cannot disable the picker, cannot remap Escape, and cannot recover the text after it's destroyed.
RAW_BUFFERClick to expand / collapse

Bug: AskUserQuestion treats Escape as "decline tool use" — destroys answers for vi/vim users

Summary

The AskUserQuestion picker interprets the Escape key as "user declined the tool use," which immediately discards any text the user has typed into the free-text "Other" field. For users with a vi/vim editing workflow, Escape is a near-constant reflex (it returns to normal mode before any navigation), which silently destroys long, detailed answers with no recovery path and no warning.

Environment

  • Tool affected: AskUserQuestion (the picker UI shown when the assistant uses this tool)
  • Editor habit: vi/vim (or anything that uses Escape for mode switching or readline vi mode in the shell — set -o vi, bindkey -v in zsh, editing-mode vi in .inputrc, etc.)
  • Platform: macOS (Darwin), but the keybinding behavior is not platform-specific
  • Claude Code surface: terminal CLI

Reproduction

  1. Configure the shell or readline for vi-mode (or simply be a vim/vi user whose muscle memory hits Escape constantly).
  2. The assistant uses AskUserQuestion with options that include a free-text "Other" field.
  3. Select "Other" and begin typing a long answer.
  4. At any point during composition, press Escape — to leave insert mode, to navigate, to cancel a completion, etc.
  5. Expected: Escape behaves like vi (mode switch, focus stays on the field, text preserved), or at minimum requires a confirmation ("Cancel and lose your answer? y/N") before discarding text.
  6. Actual: The picker immediately treats the keypress as a rejection of the tool use. Every character typed into the "Other" field is discarded with no recovery, no draft, no undo. The assistant receives "user rejected the tool" and proceeds as if no answer was given.

Impact

  • Lost work. Users routinely lose multi-paragraph answers representing 30+ seconds to several minutes of careful composition.
  • Trust degradation. Users learn to avoid AskUserQuestion-driven workflows entirely (brainstorming skills, design questions, multi-step configuration prompts) because they cannot safely answer them.
  • Disproportionate impact on power users. vi/vim users — heavily represented in the developer audience Claude Code targets — are exactly the cohort hit by this. The user filing this report had to ask the assistant to permanently never use AskUserQuestion and instead ask questions in plain text in the response body.
  • No workaround in the user's hands. The user cannot disable the picker, cannot remap Escape, and cannot recover the text after it's destroyed.

Suggested fixes (any one of these would resolve it)

  1. Don't treat Escape as decline when the free-text field is non-empty. Require a deliberate cancel action (Ctrl-C, a "Cancel" button, or typing :q in vi-mode picker) when there's unsaved text.
  2. Confirm before discarding. If Escape would discard a non-empty buffer, prompt "Cancel and lose your answer? y/N" first.
  3. Preserve the draft on cancel. Even if Escape cancels the tool use, write the typed text to a recoverable buffer/log so the assistant or user can recover it on the next turn.
  4. Detect vi/readline-vi mode (e.g., $EDITOR=vi*, set -o vi, readline mode in INPUTRC) and switch the picker to a vi-aware keymap where Escape is a no-op (or a mode switch within the field).
  5. Make Escape behavior configurable in ~/.claude/settings.json so vi users can opt out of "Escape = cancel."

Of these, (1) and (2) are the safest broad fixes; (4) is the most ergonomic for the affected cohort.

User note

This was filed at the user's explicit request after losing a detailed answer mid-brainstorm. Quote: "How much time has been wasted due to AskUserQuestion not being able to handle vi editor."

The assistant has now permanently disabled use of AskUserQuestion for this user via a memory entry and will only ask questions in plain text in the response body.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix AskUserQuestion: Escape destroys typed answers (breaks vi/vim users) [1 comments, 2 participants]