Skip to content

Commit

Permalink
Adds emacs/readline keys C-g (Cancel) and C-j (Enter). (#188)
Browse files Browse the repository at this point in the history
* Adds emacs/readline keys C-g (Cancel) and C-j (Enter).

* updates changelog

* Combines multiple Keys in match expression as per clippy
  • Loading branch information
EnigmaCurry authored Nov 1, 2023
1 parent 6e443a4 commit 7b069c7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- 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
- Keybindings Ctrl-j and Ctrl-g added for Enter and Cancel actions

### Fixes

Expand Down
4 changes: 2 additions & 2 deletions inquire/src/prompts/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ where
I: InnerAction<Config = C>,
{
match key {
Key::Enter => Some(Action::Submit),
Key::Escape => Some(Action::Cancel),
Key::Enter | Key::Char('j', KeyModifiers::CONTROL) => Some(Action::Submit),
Key::Escape | Key::Char('g', KeyModifiers::CONTROL) => Some(Action::Cancel),
Key::Char('c', KeyModifiers::CONTROL) => Some(Action::Interrupt),
key => I::from_key(key, config).map(Action::Inner),
}
Expand Down

0 comments on commit 7b069c7

Please sign in to comment.