diff options
| author | Aram Drevekenin <aram@poor.dev> | 2024-05-27 16:15:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-27 16:15:09 +0200 |
| commit | 62c37a87cca5aaa8b0e580b973b93513ed616dba (patch) | |
| tree | 5836dba1572dd4e95cc6e312f82b1ad4f263957e /default-plugins/strider/src | |
| parent | docs(changelog): ooo plugin events fix (diff) | |
| download | sl0ppij-62c37a87cca5aaa8b0e580b973b93513ed616dba.tar.gz sl0ppij-62c37a87cca5aaa8b0e580b973b93513ed616dba.tar.xz sl0ppij-62c37a87cca5aaa8b0e580b973b93513ed616dba.zip | |
feat(keybindings): support multiple modifiers (eg. Ctrl+Alt) and the kitty keyboard protocol (#3383)
* parse kitty keys from STDIN
* work
* work
* replace internal Key representation with the new KeyWithModifier in all the places
* work
* work
* allow disabling with config
* adjust ordering
* handle enabling/disabling properly on the client
* support multiple modifiers without kitty too
* normalize uppercase keys
* get tests to pass
* various cleanups
* style(fmt): rustfmt
Diffstat (limited to 'default-plugins/strider/src')
| -rw-r--r-- | default-plugins/strider/src/main.rs | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/default-plugins/strider/src/main.rs b/default-plugins/strider/src/main.rs index ce9a5273..b1c2308b 100644 --- a/default-plugins/strider/src/main.rs +++ b/default-plugins/strider/src/main.rs @@ -63,42 +63,47 @@ impl ZellijPlugin for State { self.update_files(paths); should_render = true; }, - Event::Key(key) => match key { - Key::Char(character) if character != '\n' => { + Event::Key(key) => match key.bare_key { + BareKey::Char(character) if key.has_no_modifiers() => { self.update_search_term(character); should_render = true; }, - Key::Backspace => { + BareKey::Backspace if key.has_no_modifiers() => { self.handle_backspace(); should_render = true; }, - Key::Esc | Key::Ctrl('c') => { + BareKey::Esc if key.has_no_modifiers() => { self.clear_search_term_or_descend(); should_render = true; }, - Key::Up => { + BareKey::Char('c') if key.has_modifiers(&[KeyModifier::Ctrl]) => { + self.clear_search_term_or_descend(); + }, + BareKey::Up if key.has_no_modifiers() => { self.move_selection_up(); should_render = true; }, - Key::Down => { + BareKey::Down if key.has_no_modifiers() => { self.move_selection_down(); should_render = true; }, - Key::Char('\n') if self.handling_filepick_request_from.is_some() => { + BareKey::Enter + if key.has_no_modifiers() && self.handling_filepick_request_from.is_some() => + { self.send_filepick_response(); }, - Key::Char('\n') => { + BareKey::Enter if key.has_no_modifiers() => { self.open_selected_path(); }, - Key::Right | Key::BackTab => { + BareKey::Right | BareKey::Tab if key.has_no_modifiers() => { self.traverse_dir(); should_render = true; }, - Key::Left => { + BareKey::Left if key.has_no_modifiers() => { self.descend_to_previous_path(); should_render = true; }, - Key::Ctrl('e') => { + BareKey::Char('e') if key.has_modifiers(&[KeyModifier::Ctrl]) => { should_render = true; self.toggle_hidden_files(); refresh_directory(&self.file_list_view.path); |
