Don't show buffer search UI on ProjectSearchView

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
Nathan Sobo 2022-02-25 16:14:45 -07:00
parent ed6c8b1836
commit dea40c5d1a
3 changed files with 8858 additions and 8842 deletions

File diff suppressed because it is too large Load Diff

View File

@ -142,14 +142,15 @@ impl Toolbar for FindBar {
self.pending_search.take();
if let Some(editor) = item.and_then(|item| item.act_as::<Editor>(cx)) {
self.active_editor_subscription =
Some(cx.subscribe(&editor, Self::on_active_editor_event));
self.active_editor = Some(editor);
self.update_matches(false, cx);
true
} else {
false
if editor.read(cx).searchable() {
self.active_editor_subscription =
Some(cx.subscribe(&editor, Self::on_active_editor_event));
self.active_editor = Some(editor);
self.update_matches(false, cx);
return true;
}
}
false
}
fn on_dismiss(&mut self, cx: &mut ViewContext<Self>) {
@ -295,6 +296,8 @@ impl FindBar {
});
cx.focus(&find_bar);
}
} else {
cx.propagate_action();
}
});
}

View File

@ -23,6 +23,7 @@ action!(ToggleFocus);
pub fn init(cx: &mut MutableAppContext) {
cx.add_bindings([
Binding::new("cmd-shift-F", ToggleFocus, Some("ProjectFindView")),
Binding::new("cmd-f", ToggleFocus, Some("ProjectFindView")),
Binding::new("cmd-shift-F", Deploy, Some("Workspace")),
Binding::new("enter", Search, Some("ProjectFindView")),
]);
@ -140,6 +141,7 @@ impl Item for ProjectFind {
settings.clone(),
cx,
);
editor.set_searchable(false);
editor.set_nav_history(Some(nav_history));
editor
}),
@ -305,6 +307,7 @@ impl ItemView for ProjectFindView {
.update(cx, |editor, cx| editor.scroll_position(cx));
let mut editor = Editor::for_buffer(excerpts, Some(project), self.settings.clone(), cx);
editor.set_searchable(false);
editor.set_nav_history(Some(nav_history));
editor.set_scroll_position(scroll_position, cx);
editor