feat: save prompt to history when cleared with Ctrl+C

When users press Ctrl+C to clear the input field, the current prompt
is now saved to history before clearing. This allows users to navigate
back to cleared prompts using arrow keys, preventing loss of work.

Addresses #11489
This commit is contained in:
Ariane Emory
2026-02-01 21:01:15 -05:00
parent 2c82e6c6ae
commit 738d6c8899

View File

@@ -832,6 +832,10 @@ export function Prompt(props: PromptProps) {
// If no image, let the default paste behavior continue
}
if (keybind.match("input_clear", e) && store.prompt.input !== "") {
history.append({
...store.prompt,
mode: store.mode,
})
input.clear()
input.extmarks.clear()
setStore("prompt", {