From 726f787b891ba91eb2fc64cc232470fa5c0a3cd8 Mon Sep 17 00:00:00 2001 From: Clement Tsang <34804052+ClementTsang@users.noreply.github.com> Date: Wed, 12 Aug 2026 20:40:41 -0400 Subject: [PATCH] bug: fix close logic when pressing enter in sort menu (#2191) There was an if-condition that only ran if the sort state was false. But this would never be hit since `use_sort_table_value` always set it to false beforehand, so it would be stuck focusing on a hidden menu. --- CHANGELOG.md | 6 ++++++ src/app.rs | 8 +++----- src/widgets/process_table.rs | 1 - 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f305979e..dab1e4e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,12 @@ That said, these are more guidelines rather than hard rules, though the project --- +## 0.14.8/0.15.0 - Unreleased + +### Bug Fixes + +- [2191](https://github.com/ClementTsang/bottom/pull/2191): Fix close logic when pressing enter in sort menu. + ## 0.14.7 - 2026-07-27 ### Features diff --git a/src/app.rs b/src/app.rs index fa9a928c..2f732a4b 100644 --- a/src/app.rs +++ b/src/app.rs @@ -512,13 +512,11 @@ impl App { .states .proc_state .get_mut_widget_state(self.current_widget.widget_id - 2) + && proc_widget_state.is_sort_open { 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; - } + self.move_widget_selection(&WidgetDirection::Right); + self.is_force_redraw = true; } } _ => {} diff --git a/src/widgets/process_table.rs b/src/widgets/process_table.rs index f353c99c..74bf0666 100644 --- a/src/widgets/process_table.rs +++ b/src/widgets/process_table.rs @@ -1130,7 +1130,6 @@ impl ProcWidgetState { /// sort table if possible, then closes the sort table. pub(crate) fn use_sort_table_value(&mut self) { self.table.set_sort_index(self.sort_table.current_index()); - self.is_sort_open = false; self.force_rerender_and_update(); }