mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-23 05:34:57 +02:00
Add support for searching while frozen
This commit is contained in:
parent
40be97eaf4
commit
7e442330ba
15
src/app.rs
15
src/app.rs
@ -34,7 +34,7 @@ pub struct App {
|
|||||||
// Sorting
|
// Sorting
|
||||||
pub process_sorting_type: processes::ProcessSorting,
|
pub process_sorting_type: processes::ProcessSorting,
|
||||||
pub process_sorting_reverse: bool,
|
pub process_sorting_reverse: bool,
|
||||||
pub to_be_resorted: bool,
|
pub update_process_gui: bool,
|
||||||
// Positioning
|
// Positioning
|
||||||
pub scroll_direction: ScrollDirection,
|
pub scroll_direction: ScrollDirection,
|
||||||
pub currently_selected_process_position: i64,
|
pub currently_selected_process_position: i64,
|
||||||
@ -80,7 +80,7 @@ impl App {
|
|||||||
App {
|
App {
|
||||||
process_sorting_type: processes::ProcessSorting::CPU,
|
process_sorting_type: processes::ProcessSorting::CPU,
|
||||||
process_sorting_reverse: true,
|
process_sorting_reverse: true,
|
||||||
to_be_resorted: false,
|
update_process_gui: false,
|
||||||
temperature_type,
|
temperature_type,
|
||||||
update_rate_in_milliseconds,
|
update_rate_in_milliseconds,
|
||||||
show_average_cpu,
|
show_average_cpu,
|
||||||
@ -233,6 +233,7 @@ 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;
|
||||||
|
self.update_process_gui = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -271,6 +272,7 @@ impl App {
|
|||||||
} else {
|
} else {
|
||||||
regex::Regex::new(&(self.current_search_query))
|
regex::Regex::new(&(self.current_search_query))
|
||||||
};
|
};
|
||||||
|
self.update_process_gui = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -340,6 +342,7 @@ impl App {
|
|||||||
} else {
|
} else {
|
||||||
regex::Regex::new(&(self.current_search_query))
|
regex::Regex::new(&(self.current_search_query))
|
||||||
};
|
};
|
||||||
|
self.update_process_gui = true;
|
||||||
} else {
|
} else {
|
||||||
match caught_char {
|
match caught_char {
|
||||||
'/' => {
|
'/' => {
|
||||||
@ -406,7 +409,7 @@ impl App {
|
|||||||
self.process_sorting_reverse = true;
|
self.process_sorting_reverse = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.to_be_resorted = true;
|
self.update_process_gui = true;
|
||||||
self.currently_selected_process_position = 0;
|
self.currently_selected_process_position = 0;
|
||||||
}
|
}
|
||||||
'm' => {
|
'm' => {
|
||||||
@ -419,7 +422,7 @@ impl App {
|
|||||||
self.process_sorting_reverse = true;
|
self.process_sorting_reverse = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.to_be_resorted = true;
|
self.update_process_gui = true;
|
||||||
self.currently_selected_process_position = 0;
|
self.currently_selected_process_position = 0;
|
||||||
}
|
}
|
||||||
'p' => {
|
'p' => {
|
||||||
@ -434,7 +437,7 @@ impl App {
|
|||||||
self.process_sorting_reverse = false;
|
self.process_sorting_reverse = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.to_be_resorted = true;
|
self.update_process_gui = true;
|
||||||
self.currently_selected_process_position = 0;
|
self.currently_selected_process_position = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -448,7 +451,7 @@ impl App {
|
|||||||
self.process_sorting_reverse = false;
|
self.process_sorting_reverse = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.to_be_resorted = true;
|
self.update_process_gui = true;
|
||||||
self.currently_selected_process_position = 0;
|
self.currently_selected_process_position = 0;
|
||||||
}
|
}
|
||||||
'?' => {
|
'?' => {
|
||||||
|
@ -261,9 +261,9 @@ fn main() -> error::Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if app.to_be_resorted {
|
if app.update_process_gui {
|
||||||
handle_process_sorting(&mut app);
|
handle_process_sorting(&mut app);
|
||||||
app.to_be_resorted = false;
|
app.update_process_gui = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Event::MouseInput(event) => match event {
|
Event::MouseInput(event) => match event {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user