command mode keybindings propery done

This commit is contained in:
filipriec
2025-02-28 16:54:05 +01:00
parent bd83fb47e1
commit 1bf5eda854
3 changed files with 52 additions and 40 deletions

View File

@@ -300,4 +300,22 @@ impl Config {
false
}
pub fn is_command_execute(&self, key: KeyCode, modifiers: KeyModifiers) -> bool {
if let Some(bindings) = self.keybindings.get("command_execute") {
bindings.iter().any(|b| Self::matches_keybinding(b, key, modifiers))
} else {
// Fall back to Enter key if no command_execute is defined
key == KeyCode::Enter && modifiers.is_empty()
}
}
pub fn is_command_backspace(&self, key: KeyCode, modifiers: KeyModifiers) -> bool {
if let Some(bindings) = self.keybindings.get("command_backspace") {
bindings.iter().any(|b| Self::matches_keybinding(b, key, modifiers))
} else {
// Fall back to Backspace key if no command_backspace is defined
key == KeyCode::Backspace && modifiers.is_empty()
}
}
}