Repository navigation
Conversation
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
Member
|
This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2. — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊 |
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.
Demo
Double Esc before the reply starts: the turn stops, the message is reverted, and the text comes back in the input. It is then edited and resent. (mp4)
Issue for this PR
Closes #52537
Type of change
What does this PR do?
Claude Code-style "oops, unsend": pressing Esc twice after submitting a prompt, before the reply has shown any text or tool output, aborts the turn, reverts that exact message, and puts its text and attachments back in the input. The first Esc shows "esc again to undo" instead of "esc again to interrupt" when this applies. Once the reply is visible (or if you've already started typing a new draft), Esc behaves exactly as before.
I started with a fixed 2s window like #36538, but time to first token is often 3-10s and people press Esc twice slower than that, so the window kept missing. Keying it on "has the reply shown anything yet" matches what you actually want to undo.
How it works:
session.promptalready acceptsmessageID) and remembers it with the prompt.session.abortandsession.revertrun on that message ID. Abort can take a few seconds to settle, so restoring first keeps it from feeling ignored. That's the same revert flow/undouses, so/redostill works.This revives #36538 (closed by stale-PR cleanup), plus the first-message fix and the don't-clobber-a-new-draft guard.
How did you verify your code works?
bun test src/component/prompt/quick-undo.test.ts(5 tests) andbun run typecheckinpackages/tuiScreenshots / recordings
Behavioral only. After Esc Esc right after sending, the transcript shows "1 message reverted · ctrl+x r or /redo to restore" and the prompt contains the original text.
Checklist