From 6d55442c0c323259f165fbdb4df1a8f749fa3f67 Mon Sep 17 00:00:00 2001 From: Clement Tsang <34804052+ClementTsang@users.noreply.github.com> Date: Thu, 9 Jul 2026 05:06:53 -0400 Subject: [PATCH] bug: actually fix capitalized 'q' not exiting (#2137) Turns out it needs to be done through the shift branch. Oops. Also updates docs. --- CHANGELOG.md | 1 + docs/content/usage/general-usage.md | 2 +- src/constants.rs | 2 +- src/event.rs | 3 ++- src/lib.rs | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ce43c4b..2c9dbc4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ That said, these are more guidelines rather than hard rules, though the project ### Bug Fixes - [#2131](https://github.com/ClementTsang/bottom/pull/2131): Fix the config not accepting `Memory`, `Memory%`, `Total Read`, and `Total Write` process column aliases that the config schema advertised. +- [#2132](https://github.com/ClementTsang/bottom/pull/2132): Fix 'Q' not working as a quit shortcut. ## 0.14.3 - 2026-07-01 diff --git a/docs/content/usage/general-usage.md b/docs/content/usage/general-usage.md index 8b2ce96d..23082dcd 100644 --- a/docs/content/usage/general-usage.md +++ b/docs/content/usage/general-usage.md @@ -41,7 +41,7 @@ Note that key bindings are generally case-sensitive. | Binding | Action | | ------------------------------------------------------------ | ------------------------------------------------------------ | -| ++q++ , ++ctrl+c++ | Quit | +| ++q++, ++Q++, ++ctrl+c++ | Quit | | ++esc++ | Close dialog windows, search, widgets, or exit expanded mode | | ++ctrl+r++ | Reset display and any collected data | | ++f++ | Freeze/unfreeze updating with new data | diff --git a/src/constants.rs b/src/constants.rs index 6a31471f..f4d8d07b 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -28,7 +28,7 @@ const HELP_CONTENTS_TEXT: [&str; 12] = [ // TODO [Help]: Move to using tables for easier formatting? pub(crate) const GENERAL_HELP_TEXT: [&str; 24] = [ "1 - General", - "q, Ctrl-c Quit", + "q, Q, Ctrl-c Quit", "Esc Close dialog windows, search, widgets, or exit expanded mode", "Ctrl-r Reset display and any collected data", "f Freeze/unfreeze updating with new data", diff --git a/src/event.rs b/src/event.rs index 6c63c97e..bc504fd6 100644 --- a/src/event.rs +++ b/src/event.rs @@ -57,7 +57,7 @@ pub fn handle_key_event_or_break( if event.modifiers.is_empty() { match event.code { - KeyCode::Char('q' | 'Q') if !app.is_in_any_search() => return true, + KeyCode::Char('q') | KeyCode::Char('Q') if !app.is_in_any_search() => return true, KeyCode::End => app.skip_to_last(), KeyCode::Home => app.skip_to_first(), KeyCode::Up => app.on_up_key(), @@ -128,6 +128,7 @@ pub fn handle_key_event_or_break( KeyCode::Right => app.move_widget_selection(&WidgetDirection::Right), KeyCode::Up => app.move_widget_selection(&WidgetDirection::Up), KeyCode::Down => app.move_widget_selection(&WidgetDirection::Down), + KeyCode::Char('Q') if !app.is_in_any_search() => return true, KeyCode::Char(caught_char) => app.on_char_key(caught_char), _ => {} } diff --git a/src/lib.rs b/src/lib.rs index 28316b3b..700e4136 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -97,7 +97,7 @@ fn check_if_terminal() { eprintln!( "Warning: bottom is not being output to a terminal. Things might not work properly." ); - eprintln!("If you're stuck, press 'q' or 'Ctrl-c' to quit the program."); + eprintln!("If you're stuck, press 'q', 'Q', or 'Ctrl-c' to quit the program."); stderr().flush().expect("should succeed in flushing stderr"); thread::sleep(Duration::from_secs(1)); }