diff --git a/CHANGELOG.md b/CHANGELOG.md index 36348086..351c91ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,9 +18,11 @@ `Some(score)`: score determines the order of options, higher score, higher on the list of options. - Implement fuzzy search as default on Select and MultiSelect prompts. [#176](https://github.com/mikaelmello/inquire/pull/176) - Add new option on Select/MultiSelect prompts allowing to reset selection to the first item on filter-input changes. [#176](https://github.com/mikaelmello/inquire/pull/176) -- Keybindings Ctrl-p and Ctrl-n added for Up and Down actions +- Emacs-like keybindings added where applicable: + - Ctrl-p/Ctrl-n for up/down + - Ctrl-b/Ctrl-f for left/right + - Ctrl-j/Ctrl-g for enter/cancel - Added 'with_starting_filter_input' to both Select and MultiSelect, which allows for setting an initial value to the filter section of the prompt. -- Keybindings Ctrl-j and Ctrl-g added for Enter and Cancel actions ### Fixes diff --git a/inquire/src/prompts/dateselect/action.rs b/inquire/src/prompts/dateselect/action.rs index 1f9be932..451dc017 100644 --- a/inquire/src/prompts/dateselect/action.rs +++ b/inquire/src/prompts/dateselect/action.rs @@ -46,10 +46,18 @@ impl InnerAction for DateSelectPromptAction { } let action = match key { - Key::Left(KeyModifiers::NONE) => Self::GoToPrevDay, - Key::Right(KeyModifiers::NONE) => Self::GoToNextDay, - Key::Up(KeyModifiers::NONE) => Self::GoToPrevWeek, - Key::Down(KeyModifiers::NONE) | Key::Tab => Self::GoToNextWeek, + Key::Left(KeyModifiers::NONE) | Key::Char('b', KeyModifiers::CONTROL) => { + Self::GoToPrevDay + } + Key::Right(KeyModifiers::NONE) | Key::Char('f', KeyModifiers::CONTROL) => { + Self::GoToNextDay + } + Key::Up(KeyModifiers::NONE) | Key::Char('p', KeyModifiers::CONTROL) => { + Self::GoToPrevWeek + } + Key::Down(KeyModifiers::NONE) | Key::Char('n', KeyModifiers::CONTROL) | Key::Tab => { + Self::GoToNextWeek + } Key::Left(KeyModifiers::CONTROL) => Self::GoToPrevMonth, Key::Right(KeyModifiers::CONTROL) => Self::GoToNextMonth, Key::Up(KeyModifiers::CONTROL) => Self::GoToPrevYear,