mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-27 07:34:27 +02:00
feature: Allow Ctrl-F and / to work in sort (#212)
Fixes a bug, and also allows `Ctrl-F` and `/` to work in the sort widget.
This commit is contained in:
parent
3d2fc76aa2
commit
6632714f26
37
src/app.rs
37
src/app.rs
@ -287,20 +287,25 @@ impl App {
|
|||||||
|
|
||||||
pub fn on_slash(&mut self) {
|
pub fn on_slash(&mut self) {
|
||||||
if !self.is_in_dialog() {
|
if !self.is_in_dialog() {
|
||||||
// FIXME: Add ProcSort too, it's annoying
|
match &self.current_widget.widget_type {
|
||||||
if let BottomWidgetType::Proc = self.current_widget.widget_type {
|
BottomWidgetType::Proc | BottomWidgetType::ProcSort => {
|
||||||
// Toggle on
|
// Toggle on
|
||||||
if let Some(proc_widget_state) = self
|
if let Some(proc_widget_state) = self.proc_state.get_mut_widget_state(
|
||||||
.proc_state
|
self.current_widget.widget_id
|
||||||
.get_mut_widget_state(self.current_widget.widget_id)
|
- match &self.current_widget.widget_type {
|
||||||
{
|
BottomWidgetType::ProcSort => 2,
|
||||||
proc_widget_state
|
_ => 0,
|
||||||
.process_search_state
|
},
|
||||||
.search_state
|
) {
|
||||||
.is_enabled = true;
|
proc_widget_state
|
||||||
self.move_widget_selection(&WidgetDirection::Down);
|
.process_search_state
|
||||||
self.is_force_redraw = true;
|
.search_state
|
||||||
|
.is_enabled = true;
|
||||||
|
self.move_widget_selection(&WidgetDirection::Down);
|
||||||
|
self.is_force_redraw = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -328,8 +333,10 @@ impl App {
|
|||||||
.set_to_sorted_index(&proc_widget_state.process_sorting_type);
|
.set_to_sorted_index(&proc_widget_state.process_sorting_type);
|
||||||
self.move_widget_selection(&WidgetDirection::Left);
|
self.move_widget_selection(&WidgetDirection::Left);
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, move right
|
// Otherwise, move right if currently on the sort widget
|
||||||
self.move_widget_selection(&WidgetDirection::Right);
|
if let BottomWidgetType::ProcSort = self.current_widget.widget_type {
|
||||||
|
self.move_widget_selection(&WidgetDirection::Right);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,6 +198,7 @@ impl BatteryDisplayWidget for Painter {
|
|||||||
// .map(|battery| Spans::from(battery.battery_name.clone())))
|
// .map(|battery| Spans::from(battery.battery_name.clone())))
|
||||||
// .collect::<Vec<_>>(),
|
// .collect::<Vec<_>>(),
|
||||||
// )
|
// )
|
||||||
|
// FIXME: [MOUSE] Support mouse for the tabs?
|
||||||
Tabs::default()
|
Tabs::default()
|
||||||
.titles(
|
.titles(
|
||||||
app_state
|
app_state
|
||||||
|
Loading…
x
Reference in New Issue
Block a user