mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-23 05:34:57 +02:00
Only generate regexes during regex mode
This commit is contained in:
parent
9baff73350
commit
c0df2e6c33
37
src/app.rs
37
src/app.rs
@ -233,6 +233,17 @@ impl App {
|
|||||||
if !self.is_in_dialog() && self.is_searching() {
|
if !self.is_in_dialog() && self.is_searching() {
|
||||||
if let ApplicationPosition::ProcessSearch = self.current_application_position {
|
if let ApplicationPosition::ProcessSearch = self.current_application_position {
|
||||||
self.use_simple = !self.use_simple;
|
self.use_simple = !self.use_simple;
|
||||||
|
|
||||||
|
// Update to latest (when simple is on this is not updated)
|
||||||
|
if !self.use_simple {
|
||||||
|
self.current_regex = if self.current_search_query.is_empty() {
|
||||||
|
BASE_REGEX.clone()
|
||||||
|
} else {
|
||||||
|
regex::Regex::new(&(self.current_search_query))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force update to process display in GUI
|
||||||
self.update_process_gui = true;
|
self.update_process_gui = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -266,12 +277,13 @@ impl App {
|
|||||||
self.current_search_query
|
self.current_search_query
|
||||||
.remove(self.current_cursor_position);
|
.remove(self.current_cursor_position);
|
||||||
|
|
||||||
// TODO: [OPT] this runs even while in simple... consider making this only run if they toggle back to regex!
|
if !self.use_simple {
|
||||||
self.current_regex = if self.current_search_query.is_empty() {
|
self.current_regex = if self.current_search_query.is_empty() {
|
||||||
BASE_REGEX.clone()
|
BASE_REGEX.clone()
|
||||||
} else {
|
} else {
|
||||||
regex::Regex::new(&(self.current_search_query))
|
regex::Regex::new(&(self.current_search_query))
|
||||||
};
|
};
|
||||||
|
}
|
||||||
self.update_process_gui = true;
|
self.update_process_gui = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -352,12 +364,13 @@ impl App {
|
|||||||
.insert(self.current_cursor_position, caught_char);
|
.insert(self.current_cursor_position, caught_char);
|
||||||
self.current_cursor_position += 1;
|
self.current_cursor_position += 1;
|
||||||
|
|
||||||
// TODO: [OPT] this runs even while in simple... consider making this only run if they toggle back to regex!
|
if !self.use_simple {
|
||||||
self.current_regex = if self.current_search_query.is_empty() {
|
self.current_regex = if self.current_search_query.is_empty() {
|
||||||
BASE_REGEX.clone()
|
BASE_REGEX.clone()
|
||||||
} else {
|
} else {
|
||||||
regex::Regex::new(&(self.current_search_query))
|
regex::Regex::new(&(self.current_search_query))
|
||||||
};
|
};
|
||||||
|
}
|
||||||
self.update_process_gui = true;
|
self.update_process_gui = true;
|
||||||
} else {
|
} else {
|
||||||
match caught_char {
|
match caught_char {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user