From 623df9064e76a1090bdae39617896bb767b34543 Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Sun, 9 May 2021 14:43:55 -0400 Subject: [PATCH] Add Emacs style ctrl-g, ctrl-n, and ctrl-p (#77) --- src/command/search.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/command/search.rs b/src/command/search.rs index b45e366..e076382 100644 --- a/src/command/search.rs +++ b/src/command/search.rs @@ -159,7 +159,9 @@ async fn key_handler( app: &mut State, ) -> Option { 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 {