change: Add WASD keys for widget selection movement

This commit is contained in:
ClementTsang 2020-08-11 21:19:55 -04:00
parent de8460cf9c
commit 60f4759494
4 changed files with 43 additions and 27 deletions

View File

@ -15,8 +15,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changes
- Added `WASD` as an alternative widget movement system.
- Changed to just support stable (and newer) Rust, due to library incompatibilities.
### Bug Fixes
## [0.4.5] - 2020-07-08
- No changes here, just an uptick for Crates.io using the wrong Cargo.lock.

View File

@ -181,25 +181,28 @@ Run using `btm`.
#### General
| | |
| -------------------------------------------------- | ---------------------------------------------------------------------------- |
| `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 |
| `Ctrl`-arrow key<br>`Shift`-arrow key<br>`H/J/K/L` | Move to a different widget (on macOS some keybindings may conflict) |
| `Left`, `h` | Move left within widget |
| `Down`, `j` | Move down within widget |
| `Up`,`k` | Move up within widget |
| `Right`, `l` | Move right within widget |
| `?` | Open help menu |
| `gg`, `Home` | Jump to the first entry |
| `Shift-g`, `End` | Jump to the last entry |
| `e` | Expand the currently selected widget |
| `+` | Zoom in on chart (decrease time range) |
| `-` | Zoom out on chart (increase time range) |
| `=` | Reset zoom |
| Mouse scroll | Table: Scroll<br>Chart: Zooms in or out by scrolling up or down respectively |
| | |
| ------------------------------------------- | ---------------------------------------------------------------------------- |
| `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 |
| `Ctrl-Left`<br>`Shift-Left`<br>`H`<br>`A` | Move widget selection left |
| `Ctrl-Right`<br>`Shift-Right`<br>`L`<br>`D` | Move widget selection right |
| `Ctrl-Up`<br>`Shift-Up`<br>`K`<br>`W` | Move widget selection up |
| `Ctrl-Down`<br>`Shift-Down`<br>`J`<br>`S` | Move widget selection down |
| `Left`, `h` | Move left within widget |
| `Down`, `j` | Move down within widget |
| `Up`,`k` | Move up within widget |
| `Right`, `l` | Move right within widget |
| `?` | Open help menu |
| `gg`, `Home` | Jump to the first entry |
| `Shift-g`, `End` | Jump to the last entry |
| `e` | Expand the currently selected widget |
| `+` | Zoom in on chart (decrease time range) |
| `-` | Zoom out on chart (increase time range) |
| `=` | Reset zoom |
| Mouse scroll | Table: Scroll<br>Chart: Zooms in or out by scrolling up or down respectively |
#### CPU bindings

View File

@ -1001,10 +1001,10 @@ impl App {
self.help_dialog_state.is_showing_help = true;
self.is_force_redraw = true;
}
'H' => self.move_widget_selection_left(),
'L' => self.move_widget_selection_right(),
'K' => self.move_widget_selection_up(),
'J' => self.move_widget_selection_down(),
'H' | 'A' => self.move_widget_selection_left(),
'L' | 'D' => self.move_widget_selection_right(),
'K' | 'W' => self.move_widget_selection_up(),
'J' | 'S' => self.move_widget_selection_down(),
' ' => self.on_space(),
'+' => self.zoom_in(),
'-' => self.zoom_out(),

View File

@ -51,15 +51,24 @@ pub const HELP_CONTENTS_TEXT: [&str; 6] = [
"5 - Battery widget",
];
pub const GENERAL_HELP_TEXT: [&str; 20] = [
pub const GENERAL_HELP_TEXT: [&str; 29] = [
"1 - General\n",
"q, Ctrl-c Quit\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",
"Shift-Arrow Move to a different widget\n",
"H/J/K/L \n",
"Ctrl-Left, \n",
"Shift-Left, Move widget selection left\n",
"H, A \n",
"Ctrl-Right, \n",
"Shift-Right, Move widget selection right\n",
"L, D \n",
"Ctrl-Up, \n",
"Shift-Up, Move widget selection up\n",
"K, W \n",
"Ctrl-Down, \n",
"Shift-Down, Move widget selection down\n",
"J, S \n",
"Left, h Move left within widget\n",
"Down, j Move down within widget\n",
"Up, k Move up within widget\n",