command mode exit coded from hardcoded system

This commit is contained in:
filipriec
2025-02-28 14:44:47 +01:00
parent 3aff4654ec
commit 0af38b6bd5
3 changed files with 27 additions and 2 deletions

View File

@@ -176,6 +176,22 @@ impl Config {
}
}
pub fn is_enter_command_mode(&self, key: KeyCode, modifiers: KeyModifiers) -> bool {
if let Some(bindings) = self.keybindings.get("enter_command_mode") {
bindings.iter().any(|b| Self::matches_keybinding(b, key, modifiers))
} else {
false
}
}
pub fn is_exit_command_mode(&self, key: KeyCode, modifiers: KeyModifiers) -> bool {
if let Some(bindings) = self.keybindings.get("exit_command_mode") {
bindings.iter().any(|b| Self::matches_keybinding(b, key, modifiers))
} else {
false
}
}
pub fn has_key_for_action(&self, action: &str, key_char: char) -> bool {
if let Some(bindings) = self.keybindings.get(action) {
for binding in bindings {