diff --git a/crates/agent/src/active_thread.rs b/crates/agent/src/active_thread.rs index 46f924c153..de8553e1cc 100644 --- a/crates/agent/src/active_thread.rs +++ b/crates/agent/src/active_thread.rs @@ -1533,9 +1533,22 @@ impl ActiveThread { }); } - fn cancel_editing_message(&mut self, _: &menu::Cancel, _: &mut Window, cx: &mut Context) { + fn cancel_editing_message( + &mut self, + _: &menu::Cancel, + window: &mut Window, + cx: &mut Context, + ) { self.editing_message.take(); cx.notify(); + + if let Some(workspace) = self.workspace.upgrade() { + workspace.update(cx, |workspace, cx| { + if let Some(panel) = workspace.panel::(cx) { + panel.focus_handle(cx).focus(window); + } + }); + } } fn confirm_editing_message(