mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-30 14:17:02 +00:00
Honor SearchBar
being dismissed when changing the active item
This commit is contained in:
parent
42a7e573bc
commit
d7a39a2116
1 changed files with 2 additions and 4 deletions
|
@ -66,7 +66,7 @@ impl View for SearchBar {
|
|||
}
|
||||
|
||||
fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox {
|
||||
if self.dismissed {
|
||||
if self.dismissed || self.active_editor.is_none() {
|
||||
Empty::new().boxed()
|
||||
} else {
|
||||
let theme = cx.global::<Settings>().theme.clone();
|
||||
|
@ -129,6 +129,7 @@ impl View for SearchBar {
|
|||
|
||||
impl ToolbarItemView for SearchBar {
|
||||
fn set_active_pane_item(&mut self, item: Option<&dyn ItemHandle>, cx: &mut ViewContext<Self>) {
|
||||
cx.notify();
|
||||
self.active_editor_subscription.take();
|
||||
self.active_editor.take();
|
||||
self.pending_search.take();
|
||||
|
@ -139,12 +140,9 @@ impl ToolbarItemView for SearchBar {
|
|||
Some(cx.subscribe(&editor, Self::on_active_editor_event));
|
||||
self.active_editor = Some(editor);
|
||||
self.update_matches(false, cx);
|
||||
self.dismissed = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
self.dismiss(&Dismiss, cx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue