Add Emacs style ctrl-g, ctrl-n, and ctrl-p (#77)
This commit is contained in:
parent
4b9ff801a6
commit
623df9064e
1 changed files with 5 additions and 3 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue