mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-21 02:24:09 -07:00
fix: preserve prompt text when cancelling streaming (#21103)
Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
@@ -1220,8 +1220,15 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
return;
|
||||
}
|
||||
|
||||
// If cancelling (shouldRestorePrompt=false), never modify the buffer
|
||||
// User is in control - preserve whatever text they typed, pasted, or restored
|
||||
if (!shouldRestorePrompt) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Restore the last message when shouldRestorePrompt=true
|
||||
const lastUserMessage = inputHistory.at(-1);
|
||||
let textToSet = shouldRestorePrompt ? lastUserMessage || '' : '';
|
||||
let textToSet = lastUserMessage || '';
|
||||
|
||||
const queuedText = getQueuedMessagesText();
|
||||
if (queuedText) {
|
||||
@@ -1229,7 +1236,7 @@ Logging in with Google... Restarting Gemini CLI to continue.
|
||||
clearQueue();
|
||||
}
|
||||
|
||||
if (textToSet || !shouldRestorePrompt) {
|
||||
if (textToSet) {
|
||||
buffer.setText(textToSet);
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user