Ensure editor gets focused when selecting conversation

This commit is contained in:
Antonio Scandurra 2023-12-07 10:27:25 +01:00
parent d02ff42608
commit e96197d63b

View file

@ -891,8 +891,9 @@ impl AssistantPanel {
if search_bar.show(cx) { if search_bar.show(cx) {
search_bar.search_suggested(cx); search_bar.search_suggested(cx);
if action.focus { if action.focus {
let focus_handle = search_bar.focus_handle(cx);
search_bar.select_query(cx); search_bar.select_query(cx);
cx.focus_self(); cx.focus(&focus_handle);
} }
propagate = false propagate = false
} }
@ -1028,6 +1029,8 @@ impl AssistantPanel {
} }
fn open_conversation(&mut self, path: PathBuf, cx: &mut ViewContext<Self>) -> Task<Result<()>> { fn open_conversation(&mut self, path: PathBuf, cx: &mut ViewContext<Self>) -> Task<Result<()>> {
cx.focus(&self.focus_handle);
if let Some(ix) = self.editor_index_for_path(&path, cx) { if let Some(ix) = self.editor_index_for_path(&path, cx) {
self.set_active_editor_index(Some(ix), cx); self.set_active_editor_index(Some(ix), cx);
return Task::ready(Ok(())); return Task::ready(Ok(()));