Skip to content

feat(opencode): double-escape to clear prompt input#22126

Open
guarzo wants to merge 1 commit intoanomalyco:devfrom
guarzo:feat/double-escape-clear-prompt
Open

feat(opencode): double-escape to clear prompt input#22126
guarzo wants to merge 1 commit intoanomalyco:devfrom
guarzo:feat/double-escape-clear-prompt

Conversation

@guarzo
Copy link
Copy Markdown

@guarzo guarzo commented Apr 12, 2026

Issue for this PR

Closes #7319

Type of change

  • New feature

What does this PR do?

Adds double-escape to clear the prompt input when idle. First Escape shows a hint (esc again to clear) in the status bar; second Escape within 2 seconds clears the input. No-op when input is empty or when a session is running.

There's already a solid implementation in #7320. This is an alternative approach in case maintainers want to compare:

  • Command-based — uses command.register() like all other keybinds; the key is configurable as input_clear_prompt in config (defaults to escape)
  • Visual hint — first press shows esc again to clear in the idle status bar, matching the existing session interrupt hint pattern
  • 2s window instead of 300ms — more forgiving timing
  • Timer cleanup on unmountclearTimeout in onCleanup to avoid a stale callback firing against a disposed store

Happy to close this if #7320 moves forward.

How did you verify your code works?

bun typecheck passes. Manually tested:

  1. Idle + non-empty: first Esc shows hint, second Esc within 2s clears input
  2. Hint auto-dismisses after 2s with no second press, input unchanged
  3. Idle + empty: Esc is a no-op (command guard prevents it)
  4. Session running: Esc fires session_interrupt as before

Screenshots / recordings

asciicast

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Apr 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Related PR Found

PR #7320: feat: add double-ESC keybind to clear input field
#7320

Why they're related: This is the exact alternative PR mentioned in your PR description. PR #22126 (the current PR) is an alternative implementation approach to #7320 that addresses the same feature request (#7319). Both implement double-escape to clear prompt input, but with different tradeoffs:

As noted in your PR, you're aware of #7320 and are offering this as a comparison for the maintainers to evaluate.

@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Apr 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@guarzo guarzo force-pushed the feat/double-escape-clear-prompt branch 2 times, most recently from 402f6a3 to 1eb7b90 Compare April 12, 2026 08:59
@guarzo guarzo force-pushed the feat/double-escape-clear-prompt branch from 1eb7b90 to 5bdcfa6 Compare April 12, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Add double-ESC to clear input field

1 participant