agent: Move focus to the panel after dismissing a user message edit (#31611)

Previously, when you clicked on a previous message to edit it and then
dismissed it, your focus would jump to the buffer. This caught me
several times as the most obvious place to return to for me was the
agent panel main message editor, so I can continue prompting something
else. And this is what this PR changes.

Release Notes:

- agent: Improved previous message editing UX by returning focus to the
main panel's text area after dismissing it.
This commit is contained in:
Danilo Leal 2025-05-28 15:24:58 -03:00 committed by GitHub
parent 77aa667bf3
commit e12106e025
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1533,9 +1533,22 @@ impl ActiveThread {
});
}
fn cancel_editing_message(&mut self, _: &menu::Cancel, _: &mut Window, cx: &mut Context<Self>) {
fn cancel_editing_message(
&mut self,
_: &menu::Cancel,
window: &mut Window,
cx: &mut Context<Self>,
) {
self.editing_message.take();
cx.notify();
if let Some(workspace) = self.workspace.upgrade() {
workspace.update(cx, |workspace, cx| {
if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
panel.focus_handle(cx).focus(window);
}
});
}
}
fn confirm_editing_message(