Cargo.lock 🔗
@@ -2486,7 +2486,6 @@ dependencies = [
"postage",
"project",
"regex",
- "search",
"serde",
"serde_derive",
"settings",
Piotr Osiewicz created
Cargo.lock | 1
crates/feedback/Cargo.toml | 1
crates/search/src/buffer_search.rs | 84 ++++++++---------------
crates/terminal_view/src/terminal_panel.rs | 3
4 files changed, 32 insertions(+), 57 deletions(-)
@@ -2486,7 +2486,6 @@ dependencies = [
"postage",
"project",
"regex",
- "search",
"serde",
"serde_derive",
"settings",
@@ -18,7 +18,6 @@ gpui = { path = "../gpui" }
language = { path = "../language" }
menu = { path = "../menu" }
project = { path = "../project" }
-search = { path = "../search" }
settings = { path = "../settings" }
theme = { path = "../theme" }
ui = { path = "../ui" }
@@ -431,57 +431,42 @@ pub trait SearchActionsRegistrar {
}
impl BufferSearchBar {
- pub fn register_inner(
- registrar: &mut impl SearchActionsRegistrar,
- supported_options: &workspace::searchable::SearchOptions,
- ) {
- // supported_options controls whether the action is registered in the first place,
- // but we still perform dynamic checks as e.g. if a view (like Workspace) uses SearchableItemHandle, they cannot know in advance
- // whether a given option is supported.
- if supported_options.case {
- registrar.register_handler(|this, action: &ToggleCaseSensitive, cx| {
- if this.supported_options().case {
- this.toggle_case_sensitive(action, cx);
- }
- });
- }
- if supported_options.word {
- registrar.register_handler(|this, action: &ToggleWholeWord, cx| {
- if this.supported_options().word {
- this.toggle_whole_word(action, cx);
- }
- });
- }
+ pub fn register_inner(registrar: &mut impl SearchActionsRegistrar) {
+ registrar.register_handler(|this, action: &ToggleCaseSensitive, cx| {
+ if this.supported_options().case {
+ this.toggle_case_sensitive(action, cx);
+ }
+ });
- if supported_options.replacement {
- registrar.register_handler(|this, action: &ToggleReplace, cx| {
- if this.supported_options().replacement {
- this.toggle_replace(action, cx);
- }
- });
- }
+ registrar.register_handler(|this, action: &ToggleWholeWord, cx| {
+ if this.supported_options().word {
+ this.toggle_whole_word(action, cx);
+ }
+ });
- if supported_options.regex {
- registrar.register_handler(|this, _: &ActivateRegexMode, cx| {
- if this.supported_options().regex {
- this.activate_search_mode(SearchMode::Regex, cx);
- }
- });
- }
+ registrar.register_handler(|this, action: &ToggleReplace, cx| {
+ if this.supported_options().replacement {
+ this.toggle_replace(action, cx);
+ }
+ });
+
+ registrar.register_handler(|this, _: &ActivateRegexMode, cx| {
+ if this.supported_options().regex {
+ this.activate_search_mode(SearchMode::Regex, cx);
+ }
+ });
registrar.register_handler(|this, _: &ActivateTextMode, cx| {
this.activate_search_mode(SearchMode::Text, cx);
});
- if supported_options.regex {
- registrar.register_handler(|this, action: &CycleMode, cx| {
- if this.supported_options().regex {
- // If regex is not supported then search has just one mode (text) - in that case there's no point in supporting
- // cycling.
- this.cycle_mode(action, cx)
- }
- });
- }
+ registrar.register_handler(|this, action: &CycleMode, cx| {
+ if this.supported_options().regex {
+ // If regex is not supported then search has just one mode (text) - in that case there's no point in supporting
+ // cycling.
+ this.cycle_mode(action, cx)
+ }
+ });
registrar.register_handler(|this, action: &SelectNextMatch, cx| {
this.select_next_match(action, cx);
@@ -500,6 +485,7 @@ impl BufferSearchBar {
cx.propagate();
});
registrar.register_handler(|this, deploy, cx| {
+ dbg!("Deploying?");
this.deploy(deploy, cx);
})
}
@@ -522,15 +508,7 @@ impl BufferSearchBar {
});
}
}
- Self::register_inner(
- workspace,
- &workspace::searchable::SearchOptions {
- case: true,
- word: true,
- regex: true,
- replacement: true,
- },
- );
+ Self::register_inner(workspace);
}
pub fn new(cx: &mut ViewContext<Self>) -> Self {
let query_editor = cx.new_view(|cx| Editor::single_line(cx));
@@ -19,7 +19,6 @@ use workspace::{
dock::{DockPosition, Panel, PanelEvent},
item::Item,
pane,
- searchable::SearchableItem,
ui::Icon,
Pane, Workspace,
};
@@ -359,7 +358,7 @@ impl Render for TerminalPanel {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
let div = div();
let mut registrar = ActionsRegistrar { div: Some(div), cx };
- BufferSearchBar::register_inner(&mut registrar, &TerminalView::supported_options());
+ BufferSearchBar::register_inner(&mut registrar);
registrar.div.unwrap().size_full().child(self.pane.clone())
}
}