summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWill Fancher <elvishjerricco@gmail.com>2021-05-09 14:43:55 -0400
committerGitHub <noreply@github.com>2021-05-09 18:43:55 +0000
commit623df9064e76a1090bdae39617896bb767b34543 (patch)
treef836c84e6d5a47ebb93bfa9ff2088c36704a6ef7
parent4b9ff801a6dad70b25a577ab717c70db41a3dbc3 (diff)
Add Emacs style ctrl-g, ctrl-n, and ctrl-p (#77)
-rw-r--r--src/command/search.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/command/search.rs b/src/command/search.rs
index b45e366a..e0763822 100644
--- a/src/command/search.rs
+++ b/src/command/search.rs
@@ -159,7 +159,9 @@ async fn key_handler(
app: &mut State,
) -> Option<String> {
match input {
- Key::Esc | Key::Ctrl('c') | Key::Ctrl('d') => return Some(String::from("")),
+ Key::Esc | Key::Ctrl('c') | Key::Ctrl('d') | Key::Ctrl('g') => {
+ return Some(String::from(""))
+ }
Key::Char('\n') => {
let i = app.results_state.selected().unwrap_or(0);
@@ -177,7 +179,7 @@ async fn key_handler(
app.input.pop();
query_results(app, search_mode, db).await.unwrap();
}
- Key::Down => {
+ Key::Down | Key::Ctrl('n') => {
let i = match app.results_state.selected() {
Some(i) => {
if i == 0 {
@@ -190,7 +192,7 @@ async fn key_handler(
};
app.results_state.select(Some(i));
}
- Key::Up => {
+ Key::Up | Key::Ctrl('p') => {
let i = match app.results_state.selected() {
Some(i) => {
if i >= app.results.len() - 1 {