fix: esc w/ queued messages overwrites draft in composer (#4237)

Instead of overwriting the contents of the composer when pressing
<kbd>Esc</kbd> when there's a queued message, prepend the queued
message(s) to the composer draft.
This commit is contained in:
Jeremy Rose
2025-09-25 10:07:27 -07:00
committed by GitHub
parent d61dea6fe6
commit 103adcdf2d
4 changed files with 43 additions and 3 deletions

View File

@@ -427,12 +427,20 @@ impl ChatWidget {
// If any messages were queued during the task, restore them into the composer.
if !self.queued_user_messages.is_empty() {
let combined = self
let queued_text = self
.queued_user_messages
.iter()
.map(|m| m.text.clone())
.collect::<Vec<_>>()
.join("\n");
let existing_text = self.bottom_pane.composer_text();
let combined = if existing_text.is_empty() {
queued_text
} else if queued_text.is_empty() {
existing_text
} else {
format!("{queued_text}\n{existing_text}")
};
self.bottom_pane.set_composer_text(combined);
// Clear the queue and update the status indicator list.
self.queued_user_messages.clear();