From 6c81caffd2ff9b3d059b8a20f0979375eeac34c8 Mon Sep 17 00:00:00 2001 From: gitgoggles <101480183+gitgoggles@users.noreply.github.com> Date: Mon, 1 Dec 2025 00:04:56 +0000 Subject: [PATCH] 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. --- src/app.rs | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/src/app.rs b/src/app.rs index 48318987..2957a804 100644 --- a/src/app.rs +++ b/src/app.rs @@ -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; + } + } + } + _ => {} } } }