feat: enter key can be used to close process search widget (#1890)

Added the ability to press Enter after typing a search term in the Proc widget, making it more Vim-like for those with muscle-memory for Vim's '/' search.
This commit is contained in:
gitgoggles
2025-12-01 00:04:56 +00:00
committed by GitHub
parent 3d2832a5d5
commit 6c81caffd2
+28 -10
View File
@@ -448,17 +448,35 @@ impl App {
// Not the best way of doing things for now but works as glue.
self.process_kill_dialog.on_enter();
} else if !self.is_in_dialog() {
if let BottomWidgetType::ProcSort = self.current_widget.widget_type {
if let Some(proc_widget_state) = self
.states
.proc_state
.widget_states
.get_mut(&(self.current_widget.widget_id - 2))
{
proc_widget_state.use_sort_table_value();
self.move_widget_selection(&WidgetDirection::Right);
self.is_force_redraw = true;
match self.current_widget.widget_type {
BottomWidgetType::ProcSearch => {
if let Some(proc_widget_state) = self
.states
.proc_state
.get_mut_widget_state(self.current_widget.widget_id - 1)
{
if proc_widget_state.is_search_enabled() {
proc_widget_state.proc_search.search_state.is_enabled = false;
self.move_widget_selection(&WidgetDirection::Up);
self.is_force_redraw = true;
}
}
}
BottomWidgetType::ProcSort => {
if let Some(proc_widget_state) = self
.states
.proc_state
.get_mut_widget_state(self.current_widget.widget_id - 2)
{
proc_widget_state.use_sort_table_value();
if proc_widget_state.is_sort_open {
proc_widget_state.is_sort_open = false;
self.move_widget_selection(&WidgetDirection::Right);
self.is_force_redraw = true;
}
}
}
_ => {}
}
}
}