From d3e62e3d74bdc55872bbdf92c01d18aa00b0affd Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Sun, 20 Mar 2022 17:12:39 +0200 Subject: [PATCH] utilities/dialogs.rs: use conf shortcuts for scroll {up, down} --- src/components/utilities/dialogs.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/components/utilities/dialogs.rs b/src/components/utilities/dialogs.rs index 66d95eda..747cb3ce 100644 --- a/src/components/utilities/dialogs.rs +++ b/src/components/utilities/dialogs.rs @@ -185,7 +185,9 @@ impl Component for UIDialo } return true; } - (UIEvent::Input(Key::Down), SelectorCursor::Unfocused) => { + (UIEvent::Input(ref key), SelectorCursor::Unfocused) + if shortcut!(key == shortcuts["general"]["scroll_down"]) => + { if self.single_only { for c in self.content.row_iter(0..(width - 1), 0) { self.content[c] @@ -206,7 +208,9 @@ impl Component for UIDialo self.dirty = true; return true; } - (UIEvent::Input(Key::Up), SelectorCursor::Entry(c)) if c > 0 => { + (UIEvent::Input(ref key), SelectorCursor::Entry(c)) + if shortcut!(key == shortcuts["general"]["scroll_up"]) && c > 0 => + { if self.single_only { // Redraw selection for c in self.content.row_iter(0..(width - 1), c) { @@ -506,7 +510,9 @@ impl Component for UIConfirmationDialog { } return true; } - (UIEvent::Input(Key::Up), SelectorCursor::Entry(c)) if c > 0 => { + (UIEvent::Input(ref key), SelectorCursor::Entry(c)) + if shortcut!(key == shortcuts["general"]["scroll_up"]) && c > 0 => + { if self.single_only { // Redraw selection for c in self.content.row_iter(0..(width - 1), c) { @@ -856,10 +862,11 @@ impl Selec } fn draw(&mut self, grid: &mut CellBuffer, area: Area, context: &mut Context) { + let shortcuts = context.settings.shortcuts.general.key_values(); let navigate_help_string = format!( - "Navigate options with {}, {}, select with {}", - Key::Up, - Key::Down, + "Navigate options with {} to go down, {} to go up, select with {}", + shortcuts["scroll_down"], + shortcuts["scroll_up"], Key::Char('\n') ); let width = std::cmp::max(