Skip to content

feat(tui): open undo selector on double-Esc - #1220

Merged
liruifengv merged 4 commits into
mainfrom
feat/double-esc-undo
Jun 30, 2026
Merged

feat(tui): open undo selector on double-Esc#1220
liruifengv merged 4 commits into
mainfrom
feat/double-esc-undo

Conversation

@liruifengv

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue. This is a small UX convenience on top of the existing /undo command.

Problem

Undo is only reachable through the /undo slash command. When a prompt goes wrong, the natural reflex is to hit Esc, but a single Esc is already reserved for cancelling streaming output, compaction, and popups. There is no quick keyboard path to reach the undo selector while idle.

What changed

  • Pressing Esc twice while idle now opens the undo selector (equivalent to /undo with no arguments), so users can pick how many prompts to roll back.
  • A short double-press window (600 ms) keeps two deliberate, far-apart presses from accidentally triggering undo.
  • The single-Esc behaviors are untouched: it still cancels streaming output, cancels compaction, and closes popups. Any of those consuming paths, or any text input, disarms the pending double-press so undo never fires by accident.
  • Added controller tests for the double-Esc trigger, the single-press no-op, window expiry, and the streaming-does-not-undo case.
  • Documented the shortcut in the English and Chinese keyboard reference.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

Pressing Esc twice while idle now opens the undo selector, equivalent to running /undo with no arguments. Esc during streaming, compaction, or with a popup open keeps its cancel/close behavior and does not arm the double-press.
@changeset-bot

changeset-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cf67e5a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jun 30, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@cf67e5a
npx https://pkg.pr.new/@moonshot-ai/kimi-code@cf67e5a

commit: cf67e5a

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fd46246ffb

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/kimi-code/src/tui/controllers/editor-keyboard.ts
A pending double-Esc was only cleared by text changes, so a sequence like Esc, Ctrl-C, Esc within the window still opened the undo selector. Fire an onNonEscapeInput hook for every non-Escape key and clear the pending state there, so the shortcut only triggers for two consecutive Escape presses.
@liruifengv

Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 1b5f43f551

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@liruifengv
liruifengv merged commit ec51324 into main Jun 30, 2026
9 checks passed
@liruifengv
liruifengv deleted the feat/double-esc-undo branch June 30, 2026 07:42
@github-actions github-actions Bot mentioned this pull request Jun 30, 2026
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.

1 participant