Add some emacs movement keys (#857)

This commit is contained in:
Jan Larres 2023-04-10 03:40:40 +12:00 committed by GitHub
parent 04044c4146
commit bca1e64dd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,6 +86,7 @@ impl State {
} }
#[allow(clippy::too_many_lines)] #[allow(clippy::too_many_lines)]
#[allow(clippy::cognitive_complexity)]
fn handle_key_input( fn handle_key_input(
&mut self, &mut self,
settings: &Settings, settings: &Settings,
@ -119,18 +120,30 @@ impl State {
.search .search
.input .input
.prev_word(&settings.word_chars, settings.word_jump_mode), .prev_word(&settings.word_chars, settings.word_jump_mode),
KeyCode::Char('b') if alt => self
.search
.input
.prev_word(&settings.word_chars, settings.word_jump_mode),
KeyCode::Left => { KeyCode::Left => {
self.search.input.left(); self.search.input.left();
} }
KeyCode::Char('h') if ctrl => { KeyCode::Char('h') if ctrl => {
self.search.input.left(); self.search.input.left();
} }
KeyCode::Char('b') if ctrl => {
self.search.input.left();
}
KeyCode::Right if ctrl => self KeyCode::Right if ctrl => self
.search .search
.input .input
.next_word(&settings.word_chars, settings.word_jump_mode), .next_word(&settings.word_chars, settings.word_jump_mode),
KeyCode::Char('f') if alt => self
.search
.input
.next_word(&settings.word_chars, settings.word_jump_mode),
KeyCode::Right => self.search.input.right(), KeyCode::Right => self.search.input.right(),
KeyCode::Char('l') if ctrl => self.search.input.right(), KeyCode::Char('l') if ctrl => self.search.input.right(),
KeyCode::Char('f') if ctrl => self.search.input.right(),
KeyCode::Char('a') if ctrl => self.search.input.start(), KeyCode::Char('a') if ctrl => self.search.input.start(),
KeyCode::Home => self.search.input.start(), KeyCode::Home => self.search.input.start(),
KeyCode::Char('e') if ctrl => self.search.input.end(), KeyCode::Char('e') if ctrl => self.search.input.end(),