From fef2f12c9aa572ba6185a90de35489f1c20a633a Mon Sep 17 00:00:00 2001 From: filipriec Date: Sun, 23 Mar 2025 00:28:51 +0100 Subject: [PATCH] :disabled in the edit mode, cant type it tho, needs fix --- client/config.toml | 3 +-- client/src/modes/handlers/event.rs | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/client/config.toml b/client/config.toml index e8fe1f6..f49d354 100644 --- a/client/config.toml +++ b/client/config.toml @@ -1,7 +1,7 @@ # config.toml [keybindings] -# [keybindings.global] +enter_command_mode = [":", "ctrl+;"] [keybindings.intro] next_option = ["j", "Right"] @@ -40,7 +40,6 @@ move_line_start = ["0"] move_line_end = ["$"] move_first_line = ["gg"] move_last_line = ["x"] -enter_command_mode = [":", "ctrl+;"] [keybindings.edit] exit_edit_mode = ["esc","ctrl+e"] diff --git a/client/src/modes/handlers/event.rs b/client/src/modes/handlers/event.rs index 6fc020f..2e5bd89 100644 --- a/client/src/modes/handlers/event.rs +++ b/client/src/modes/handlers/event.rs @@ -81,6 +81,24 @@ impl EventHandler { ))); } + // Global command mode activation + let context_action = config.get_action_for_current_context( + self.is_edit_mode, + self.command_mode, + app_state.ui.show_intro, + app_state.ui.show_admin, + key_code, + modifiers + ); + + if let Some("enter_command_mode") = context_action { + if self.is_edit_mode { return Ok((false, String::new())); } + self.command_mode = true; + self.command_input.clear(); + self.command_message.clear(); + return Ok((false, String::new())); + } + if let Some(action) = config.get_action_for_key_in_mode( &config.keybindings.common, key_code,