From bb45763b39cf7a8047b0c499e6d1a2ac5f8d0847 Mon Sep 17 00:00:00 2001 From: ClementTsang Date: Thu, 30 Apr 2020 15:29:36 -0400 Subject: [PATCH] feature: Add alt-h and alt-l to move left/right within widget --- CHANGELOG.md | 6 ++++-- README.md | 14 +++++++------- src/constants.rs | 7 ++++--- src/main.rs | 2 ++ 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 289993d4..72b604aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [#114](https://github.com/ClementTsang/bottom/pull/114): Process state per process. +- [#134](https://github.com/ClementTsang/bottom/pull/134): `hjkl` movement to delete dialog (credit to [andys8](https://github.com/andys8)). + +- [#59](https://github.com/ClementTsang/bottom/issues/59): `Alt-h` and `Alt-l` to move left/right in query (and rest of the app actually). + ### Changes - Changed default colours for highlighted borders and table headers to light blue - this is mostly to deal with Powershell colour conflicts. @@ -42,8 +46,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [#70](https://github.com/ClementTsang/bottom/issues/70): Redesigned help menu to allow for scrolling. -- [#134](https://github.com/ClementTsang/bottom/pull/134): Added `hjkl` movement to delete dialog. - - [#59](https://github.com/ClementTsang/bottom/issues/59): Moved maximization key to `e`, renamed feature to _expanding_ the widget. Done to allow for the `` key to be used later for a more intuitive usage. - [#59](https://github.com/ClementTsang/bottom/issues/59): Redesigned search menu and query. diff --git a/README.md b/README.md index 1f3d8f2f..c8d432c9 100644 --- a/README.md +++ b/README.md @@ -226,10 +226,10 @@ Run using `btm`. #### Battery bindings -| | | -| ------- | -------------------------- | -| `Left` | Go to the next battery | -| `Right` | Go to the previous battery | +| | | +| -------------- | -------------------------- | +| `Left, Alt-h` | Go to the next battery | +| `Right, Alt-l` | Go to the previous battery | ## Features @@ -255,9 +255,9 @@ In addition, bottom also currently has the following features: ### Process filtering -On any process widget, hit `/` to bring up a search bar. If the layout has -multiple process widgets, note this search is independent of other widgets. Searching -supports regex, matching case, and matching entire words. Use `Tab` to toggle between + + +On any process widget, hit `/` to bring up a search bar. If the layout has multiple process widgets, note this search is independent of other widgets. Searching supports regex, matching case, and matching entire words. Use `Tab` to toggle between searching by PID and by process name. ### Zoom diff --git a/src/constants.rs b/src/constants.rs index cd4cd173..6920f401 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -52,7 +52,7 @@ pub const HELP_CONTENTS_TEXT: [&str; 6] = [ pub const GENERAL_HELP_TEXT: [&str; 20] = [ "1 - General bindings\n", "q, Ctrl-c Quit\n", - "Esc Close dialog windows, search, widgets, or exit maximized mode\n", + "Esc Close dialog windows, search, widgets, or exit expanded mode\n", "Ctrl-r Reset display and any collected data\n", "f Freeze/unfreeze updating with new data\n", "Ctrl-Arrow \n", @@ -90,6 +90,7 @@ pub const PROCESS_HELP_TEXT: [&str; 8] = [ "Ctrl-f, / Open process search widget", ]; +// FIXME: [QUERY] This likely needs to be updated. pub const SEARCH_HELP_TEXT: [&str; 13] = [ "4 - Process search bindings\n", "Tab Toggle between searching for PID and name\n", @@ -102,8 +103,8 @@ pub const SEARCH_HELP_TEXT: [&str; 13] = [ "Alt-c/F1 Toggle matching case\n", "Alt-w/F2 Toggle matching the entire word\n", "Alt-r/F3 Toggle using regex\n", - "Left Move cursor left\n", - "Right Move cursor right", + "Left, Alt-h Move cursor left\n", + "Right, Alt-l Move cursor right", ]; pub const BATTERY_HELP_TEXT: [&str; 3] = [ diff --git a/src/main.rs b/src/main.rs index eecdd7da..7d31f718 100644 --- a/src/main.rs +++ b/src/main.rs @@ -323,6 +323,8 @@ fn handle_key_event_or_break( KeyCode::Char('r') | KeyCode::Char('R') => { app.toggle_search_regex(); } + KeyCode::Char('h') => app.on_left_key(), + KeyCode::Char('l') => app.on_right_key(), _ => {} } } else if let KeyModifiers::CONTROL = event.modifiers {