mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-19 02:17:35 +03:00
Remove SearchOptions::REGEX.
A bit WIP as it awaits migration of buffer search to modes
This commit is contained in:
parent
0ca29e56c2
commit
c53554ead3
@ -209,12 +209,12 @@ impl View for BufferSearchBar {
|
||||
SearchOptions::WHOLE_WORD,
|
||||
cx,
|
||||
))
|
||||
.with_children(self.render_search_option(
|
||||
/*.with_children(self.render_search_option(
|
||||
supported_options.regex,
|
||||
"Regex",
|
||||
SearchOptions::REGEX,
|
||||
cx,
|
||||
))
|
||||
))*/
|
||||
.contained()
|
||||
.with_style(theme.search.option_button_group)
|
||||
.aligned(),
|
||||
@ -697,7 +697,7 @@ impl BufferSearchBar {
|
||||
active_searchable_item.clear_matches(cx);
|
||||
let _ = done_tx.send(());
|
||||
} else {
|
||||
let query = if self.search_options.contains(SearchOptions::REGEX) {
|
||||
let query = if true {
|
||||
match SearchQuery::regex(
|
||||
query,
|
||||
self.search_options.contains(SearchOptions::WHOLE_WORD),
|
||||
|
@ -2,7 +2,7 @@ use gpui::Action;
|
||||
|
||||
use crate::{ActivateRegexMode, ActivateSemanticMode, ActivateTextMode};
|
||||
// TODO: Update the default search mode to get from config
|
||||
#[derive(Copy, Clone, Default, PartialEq)]
|
||||
#[derive(Copy, Clone, Debug, Default, PartialEq)]
|
||||
pub(crate) enum SearchMode {
|
||||
#[default]
|
||||
Text,
|
||||
|
@ -736,15 +736,9 @@ impl ProjectSearchView {
|
||||
}).detach_and_log_err(cx);
|
||||
}
|
||||
SearchMode::Regex => {
|
||||
if !self.is_option_enabled(SearchOptions::REGEX) {
|
||||
self.toggle_search_option(SearchOptions::REGEX);
|
||||
}
|
||||
self.semantic_state = None;
|
||||
}
|
||||
SearchMode::Text => {
|
||||
if self.is_option_enabled(SearchOptions::REGEX) {
|
||||
self.toggle_search_option(SearchOptions::REGEX);
|
||||
}
|
||||
self.semantic_state = None;
|
||||
}
|
||||
}
|
||||
@ -992,7 +986,7 @@ impl ProjectSearchView {
|
||||
return None;
|
||||
}
|
||||
};
|
||||
if self.search_options.contains(SearchOptions::REGEX) {
|
||||
if self.current_mode == SearchMode::Regex {
|
||||
match SearchQuery::regex(
|
||||
text,
|
||||
self.search_options.contains(SearchOptions::WHOLE_WORD),
|
||||
@ -1011,6 +1005,7 @@ impl ProjectSearchView {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
debug_assert_ne!(self.current_mode, SearchMode::Semantic);
|
||||
Some(SearchQuery::text(
|
||||
text,
|
||||
self.search_options.contains(SearchOptions::WHOLE_WORD),
|
||||
@ -1139,9 +1134,6 @@ impl ProjectSearchView {
|
||||
|
||||
cx.propagate_action();
|
||||
}
|
||||
fn is_option_enabled(&self, option: SearchOptions) -> bool {
|
||||
self.search_options.contains(option)
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for ProjectSearchBar {
|
||||
|
@ -39,7 +39,6 @@ bitflags! {
|
||||
const NONE = 0b000;
|
||||
const WHOLE_WORD = 0b001;
|
||||
const CASE_SENSITIVE = 0b010;
|
||||
const REGEX = 0b100;
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,7 +67,6 @@ impl SearchOptions {
|
||||
let mut options = SearchOptions::NONE;
|
||||
options.set(SearchOptions::WHOLE_WORD, query.whole_word());
|
||||
options.set(SearchOptions::CASE_SENSITIVE, query.case_sensitive());
|
||||
options.set(SearchOptions::REGEX, query.is_regex());
|
||||
options
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ fn search(workspace: &mut Workspace, action: &Search, cx: &mut ViewContext<Works
|
||||
|
||||
if query.is_empty() {
|
||||
search_bar.set_search_options(
|
||||
SearchOptions::CASE_SENSITIVE | SearchOptions::REGEX,
|
||||
SearchOptions::CASE_SENSITIVE, // | SearchOptions::REGEX,
|
||||
cx,
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user