diff --git a/src/config/keymap_parser.rs b/src/config/keymap_parser.rs index c187af9..8bae101 100644 --- a/src/config/keymap_parser.rs +++ b/src/config/keymap_parser.rs @@ -215,6 +215,8 @@ impl From> for Keymap { impl Keymap { /// Try to parse a &[String] into a Vec of keycodes, at most the output will have 2 entries + /// This might fail on MacOS due to Backspace and Delete working in a different manner as to how they work on Linux & Windows + /// I think that on MacOS `Del` becomes `Fwd Del`, and `Backspace` becomes `Delete` fn try_parse_keycode(input: &[String]) -> Option> { let mut output = vec![]; @@ -246,6 +248,7 @@ impl Keymap { "f11" => Some(KeyCode::F(11)), "f12" => Some(KeyCode::F(12)), "backspace" => Some(KeyCode::Backspace), + // See MacOS not above "backtab" => Some(KeyCode::BackTab), "delete" => Some(KeyCode::Delete), "down" => Some(KeyCode::Down), @@ -394,7 +397,7 @@ mod tests { sort_by_id: gen_v(("[", "]")), sort_by_image: gen_v(("A", "B")), sort_by_rx: gen_v(("C", "D")), - sort_by_tx: gen_v(("backspace", "TAB")), + sort_by_tx: gen_v(("insert", "TAB")), sort_reset: gen_v(("up", "down")), toggle_help: gen_v(("home", "end")), toggle_mouse_capture: gen_v(("pagedown", "PAGEUP")), @@ -426,7 +429,7 @@ mod tests { sort_by_id: (KeyCode::Char('['), Some(KeyCode::Char(']'))), sort_by_image: (KeyCode::Char('A'), Some(KeyCode::Char('B'))), sort_by_rx: (KeyCode::Char('C'), Some(KeyCode::Char('D'))), - sort_by_tx: (KeyCode::Backspace, Some(KeyCode::Tab)), + sort_by_tx: (KeyCode::Insert, Some(KeyCode::Tab)), sort_reset: (KeyCode::Up, Some(KeyCode::Down)), toggle_help: (KeyCode::Home, Some(KeyCode::End)), toggle_mouse_capture: (KeyCode::PageDown, Some(KeyCode::PageUp)), diff --git a/src/ui/draw_blocks/help.rs b/src/ui/draw_blocks/help.rs index 49b1d0e..35ede46 100644 --- a/src/ui/draw_blocks/help.rs +++ b/src/ui/draw_blocks/help.rs @@ -581,7 +581,7 @@ mod tests { sort_by_id: (KeyCode::Char('/'), None), sort_by_image: (KeyCode::Char(','), None), sort_by_rx: (KeyCode::Char('.'), None), - sort_by_tx: (KeyCode::Backspace, None), + sort_by_tx: (KeyCode::Insert, None), sort_reset: (KeyCode::Up, None), toggle_help: (KeyCode::Home, None), toggle_mouse_capture: (KeyCode::PageDown, None), @@ -626,9 +626,9 @@ mod tests { sort_by_id: (KeyCode::Char('/'), Some(KeyCode::Char('='))), sort_by_image: (KeyCode::Char(','), Some(KeyCode::Char('\\'))), sort_by_rx: (KeyCode::Char('.'), Some(KeyCode::Char(']'))), - sort_by_tx: (KeyCode::Backspace, Some(KeyCode::BackTab)), + sort_by_tx: (KeyCode::Insert, Some(KeyCode::BackTab)), sort_reset: (KeyCode::Up, Some(KeyCode::Down)), - toggle_help: (KeyCode::Home, Some(KeyCode::Delete)), + toggle_help: (KeyCode::Home, Some(KeyCode::End)), toggle_mouse_capture: (KeyCode::PageDown, Some(KeyCode::PageUp)), }; @@ -671,7 +671,7 @@ mod tests { sort_by_id: (KeyCode::Char('/'), Some(KeyCode::Char('='))), sort_by_image: (KeyCode::Char(','), None), sort_by_rx: (KeyCode::Char('.'), Some(KeyCode::Char(']'))), - sort_by_tx: (KeyCode::Backspace, None), + sort_by_tx: (KeyCode::Insert, None), sort_reset: (KeyCode::Up, Some(KeyCode::Down)), toggle_help: (KeyCode::Home, None), toggle_mouse_capture: (KeyCode::PageDown, Some(KeyCode::PageUp)), diff --git a/src/ui/draw_blocks/snapshots/oxker__ui__draw_blocks__help__tests__draw_blocks_help_custom_keymap_one_definition.snap b/src/ui/draw_blocks/snapshots/oxker__ui__draw_blocks__help__tests__draw_blocks_help_custom_keymap_one_definition.snap index 52a69ec..384ea0a 100644 --- a/src/ui/draw_blocks/snapshots/oxker__ui__draw_blocks__help__tests__draw_blocks_help_custom_keymap_one_definition.snap +++ b/src/ui/draw_blocks/snapshots/oxker__ui__draw_blocks__help__tests__draw_blocks_help_custom_keymap_one_definition.snap @@ -39,7 +39,7 @@ expression: setup.terminal.backend() " │ ( / ) sort containers by id │ " " │ ( , ) sort containers by image │ " " │ ( . ) sort containers by rx │ " -" │ ( Backspace ) sort containers by tx │ " +" │ ( Insert ) sort containers by tx │ " " │ ( a ) close dialog │ " " │ ( k ) quit at any time │ " " │ │ " diff --git a/src/ui/draw_blocks/snapshots/oxker__ui__draw_blocks__help__tests__draw_blocks_help_custom_keymap_two_definitions.snap b/src/ui/draw_blocks/snapshots/oxker__ui__draw_blocks__help__tests__draw_blocks_help_custom_keymap_two_definitions.snap index 1e0241e..03504ba 100644 --- a/src/ui/draw_blocks/snapshots/oxker__ui__draw_blocks__help__tests__draw_blocks_help_custom_keymap_two_definitions.snap +++ b/src/ui/draw_blocks/snapshots/oxker__ui__draw_blocks__help__tests__draw_blocks_help_custom_keymap_two_definitions.snap @@ -26,7 +26,7 @@ expression: setup.terminal.backend() " │ ( u ) or ( v ) scroll list to start │ " " │ ( enter ) send docker container command │ " " │ ( g ) or ( h ) exec into a container │ " -" │ ( Home ) or ( Del ) toggle this help information - or click heading │ " +" │ ( Home ) or ( End ) toggle this help information - or click heading │ " " │ ( m ) or ( n ) save logs to file │ " " │ ( Page Down ) or ( Page Up ) toggle mouse capture - if disabled, text on screen can be selected & copied │ " " │ ( i ) or ( j ) enter filter mode │ " @@ -39,7 +39,7 @@ expression: setup.terminal.backend() " │ ( / ) or ( = ) sort containers by id │ " " │ ( , ) or ( \ ) sort containers by image │ " " │ ( . ) or ( ] ) sort containers by rx │ " -" │ ( Backspace ) or ( Back Tab ) sort containers by tx │ " +" │ ( Insert ) or ( Back Tab ) sort containers by tx │ " " │ ( a ) or ( b ) close dialog │ " " │ ( k ) or ( l ) quit at any time │ " " │ │ " diff --git a/src/ui/draw_blocks/snapshots/oxker__ui__draw_blocks__help__tests__draw_blocks_help_one_and_two_definitions.snap b/src/ui/draw_blocks/snapshots/oxker__ui__draw_blocks__help__tests__draw_blocks_help_one_and_two_definitions.snap index 7278795..f6dfd9d 100644 --- a/src/ui/draw_blocks/snapshots/oxker__ui__draw_blocks__help__tests__draw_blocks_help_one_and_two_definitions.snap +++ b/src/ui/draw_blocks/snapshots/oxker__ui__draw_blocks__help__tests__draw_blocks_help_one_and_two_definitions.snap @@ -39,7 +39,7 @@ expression: setup.terminal.backend() " │ ( / ) or ( = ) sort containers by id │ " " │ ( , ) sort containers by image │ " " │ ( . ) or ( ] ) sort containers by rx │ " -" │ ( Backspace ) sort containers by tx │ " +" │ ( Insert ) sort containers by tx │ " " │ ( a ) or ( b ) close dialog │ " " │ ( k ) quit at any time │ " " │ │ "