diff options
| author | Aram Drevekenin <aram@poor.dev> | 2024-10-23 17:34:41 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-23 17:34:41 +0200 |
| commit | b71be135c2b69dce244440491b693747764a4151 (patch) | |
| tree | 8513ea05d7ab79bde388b32f2487d752fcf95b56 /default-plugins | |
| parent | docs(changelog): ui touch-ups (diff) | |
| download | sl0ppij-b71be135c2b69dce244440491b693747764a4151.tar.gz sl0ppij-b71be135c2b69dce244440491b693747764a4151.tar.xz sl0ppij-b71be135c2b69dce244440491b693747764a4151.zip | |
fix(plugins): rebind insert (#3692)
* fix(tab): recover from closing a pane outside the viewport
* remap insert in plugin manager
* fix(plugins): remap insert key
* style(fmt): rustfmt
Diffstat (limited to 'default-plugins')
| -rw-r--r-- | default-plugins/configuration/src/presets_screen.rs | 18 | ||||
| -rw-r--r-- | default-plugins/configuration/src/rebind_leaders_screen.rs | 31 | ||||
| -rw-r--r-- | default-plugins/plugin-manager/src/main.rs | 28 |
3 files changed, 43 insertions, 34 deletions
diff --git a/default-plugins/configuration/src/presets_screen.rs b/default-plugins/configuration/src/presets_screen.rs index 5cdc4c02..af76c36a 100644 --- a/default-plugins/configuration/src/presets_screen.rs +++ b/default-plugins/configuration/src/presets_screen.rs @@ -85,7 +85,7 @@ impl PresetsScreen { self.reset_selected_index(); } should_render = true; - } else if key.bare_key == BareKey::Insert && key.has_no_modifiers() { + } else if key.bare_key == BareKey::Char('s') && key.has_modifiers(&[KeyModifier::Ctrl]) { if let Some(selected_index) = self.take_selected_index() { let write_to_disk = true; self.reconfigure(selected_index, write_to_disk); @@ -788,16 +788,16 @@ impl PresetsScreen { } } fn render_help_text_main(&self, rows: usize, cols: usize) { - let full_help_text = "Help: <↓↑> - navigate, <ENTER> - apply, <INS> - apply & save, <l> - leaders, <ESC> - close"; - let short_help_text = "Help: <↓↑> / <ENTER> / <INS> / <l> / <ESC>"; + let full_help_text = "Help: <↓↑> - navigate, <ENTER> - apply, <Ctrl s> - apply & save, <l> - leaders, <ESC> - close"; + let short_help_text = "Help: <↓↑> / <ENTER> / <Ctrl s> / <l> / <ESC>"; if cols >= full_help_text.chars().count() { print_text_with_coordinates( Text::new(full_help_text) .color_range(2, 6..10) .color_range(2, 23..30) - .color_range(2, 40..45) - .color_range(2, 62..65) - .color_range(2, 77..82), + .color_range(2, 40..48) + .color_range(2, 65..68) + .color_range(2, 80..85), 0, rows, None, @@ -808,9 +808,9 @@ impl PresetsScreen { Text::new(short_help_text) .color_range(2, 6..10) .color_range(2, 13..20) - .color_range(2, 23..28) - .color_range(2, 31..34) - .color_range(2, 37..42), + .color_range(2, 23..31) + .color_range(2, 34..37) + .color_range(2, 40..45), 0, rows, None, diff --git a/default-plugins/configuration/src/rebind_leaders_screen.rs b/default-plugins/configuration/src/rebind_leaders_screen.rs index cc385983..e745cf98 100644 --- a/default-plugins/configuration/src/rebind_leaders_screen.rs +++ b/default-plugins/configuration/src/rebind_leaders_screen.rs @@ -558,10 +558,11 @@ impl RebindLeadersScreen { if self.is_rebinding_for_presets { return self.render_help_text_for_presets_rebinding(rows, cols); } - let help_text_long = "Help: <←↓↑→> - navigate, <SPACE> - select, <ENTER> - apply, <INSERT> - save, <Ctrl c> - reset, <ESC> - close"; - let help_text_medium = "Help: <←↓↑→/SPACE> - navigate/select, <ENTER/INS> - apply/save, <Ctrl c> - reset, <ESC> - close"; - let help_text_short = "Help: <←↓↑→>/<SPACE>/<ENTER> select/<INS> save/<Ctrl c> reset/<ESC>"; - let help_text_minimum = "<←↓↑→>/<SPACE>/<ENTER>/<INS>/<Ctrl c>/<ESC>"; + let help_text_long = "Help: <←↓↑→> - navigate, <SPACE> - select, <ENTER> - apply, <Ctrl s> - save, <Ctrl c> - reset, <ESC> - close"; + let help_text_medium = "Help: <←↓↑→/SPACE> - navigate/select, <ENTER/Ctrl s> - apply/save, <Ctrl c> - reset, <ESC> - close"; + let help_text_short = + "Help: <←↓↑→>/<SPACE>/<ENTER> select/<Ctrl s> save/<Ctrl c> reset/<ESC>"; + let help_text_minimum = "<←↓↑→>/<SPACE>/<ENTER>/<Ctrl s>/<Ctrl c>/<ESC>"; if cols >= help_text_long.chars().count() { print_text_with_coordinates( Text::new(help_text_long) @@ -580,9 +581,9 @@ impl RebindLeadersScreen { print_text_with_coordinates( Text::new(help_text_medium) .color_range(2, 6..=17) - .color_range(2, 38..=48) - .color_range(2, 64..=72) - .color_range(2, 82..=86), + .color_range(2, 38..=51) + .color_range(2, 67..=75) + .color_range(2, 85..=89), 0, rows, None, @@ -594,9 +595,9 @@ impl RebindLeadersScreen { .color_range(2, 6..=11) .color_range(2, 13..=19) .color_range(2, 21..=27) - .color_range(2, 36..=40) - .color_range(2, 47..=54) - .color_range(2, 62..=66), + .color_range(2, 36..=43) + .color_range(2, 50..=57) + .color_range(2, 65..=69), 0, rows, None, @@ -608,9 +609,9 @@ impl RebindLeadersScreen { .color_range(2, ..=5) .color_range(2, 7..=13) .color_range(2, 15..=21) - .color_range(2, 23..=27) - .color_range(2, 29..=36) - .color_range(2, 38..=42), + .color_range(2, 23..=30) + .color_range(2, 32..=39) + .color_range(2, 41..=45), 0, rows, None, @@ -1194,8 +1195,8 @@ impl RebindLeadersScreen { self.is_rebinding_for_presets = is_rebinding_for_presets; } fn handle_unlock_first_key(&mut self, key: KeyWithModifier) -> bool { - if key.bare_key == BareKey::Insert - && key.has_no_modifiers() + if key.bare_key == BareKey::Char('s') + && key.has_modifiers(&[KeyModifier::Ctrl]) && !self.is_rebinding_for_presets { let write_to_disk = true; diff --git a/default-plugins/plugin-manager/src/main.rs b/default-plugins/plugin-manager/src/main.rs index 7cd5e5c4..3695b59f 100644 --- a/default-plugins/plugin-manager/src/main.rs +++ b/default-plugins/plugin-manager/src/main.rs @@ -841,29 +841,33 @@ impl State { tab_line } pub fn render_help(&self, y: usize, cols: usize) { - let full_text = "Help: <←↓↑→> - Navigate/Expand, <ENTER> - focus, <TAB> - Reload, <Del> - Close, <INSERT> - New"; + let full_text = "Help: <←↓↑→> - Navigate/Expand, <ENTER> - focus, <TAB> - Reload, <Del> - Close, <Ctrl a> - New, <ESC> - Exit"; let middle_text = - "Help: <←↓↑→/ENTER> - Navigate, <TAB> - Reload, <Del> - Close, <INSERT> - New"; - let short_text = "<←↓↑→/ENTER/TAB/Del> - Navigate/Expand/Reload/Close, <INSERT> - New"; + "Help: <←↓↑→/ENTER> - Navigate, <TAB> - Reload, <Del> - Close, <Ctrl a> - New, <ESC> - Exit"; + let short_text = + "<←↓↑→/ENTER/TAB/Del> - Navigate/Expand/Reload/Close, <Ctrl a> - New, <ESC> - Exit"; if cols >= full_text.chars().count() { let text = Text::new(full_text) .color_range(3, 5..=11) .color_range(3, 32..=38) .color_range(3, 49..=53) .color_range(3, 65..=69) - .color_range(3, 80..=87); + .color_range(3, 80..=87) + .color_range(3, 96..=100); print_text_with_coordinates(text, 0, y, Some(cols), None); } else if cols >= middle_text.chars().count() { let text = Text::new(middle_text) .color_range(3, 6..=17) .color_range(3, 31..=35) .color_range(3, 47..=51) - .color_range(3, 62..=69); + .color_range(3, 62..=69) + .color_range(3, 78..=82); print_text_with_coordinates(text, 0, y, Some(cols), None); } else { let text = Text::new(short_text) .color_range(3, ..=21) - .color_range(3, 53..=60); + .color_range(3, 53..=60) + .color_range(3, 69..=73); print_text_with_coordinates(text, 0, y, Some(cols), None); } } @@ -989,7 +993,7 @@ impl State { BareKey::Tab if key.has_no_modifiers() => { self.reload_selected(); }, - BareKey::Insert if key.has_no_modifiers() => { + BareKey::Char('a') if key.has_modifiers(&[KeyModifier::Ctrl]) => { self.new_plugin_screen = Some(Default::default()); should_render = true; }, @@ -997,9 +1001,13 @@ impl State { self.close_selected(); }, BareKey::Esc if key.has_no_modifiers() => { - self.search_term.clear(); - self.update_search_term(); - should_render = true; + if !self.search_term.is_empty() { + self.search_term.clear(); + self.update_search_term(); + should_render = true; + } else { + close_self(); + } }, _ => {}, } |
