working perfectly well
This commit is contained in:
@@ -46,11 +46,6 @@ impl Config {
|
||||
continue;
|
||||
}
|
||||
for binding in bindings {
|
||||
// Skip multi-key bindings when checking for single key actions
|
||||
if binding.len() > 1 && !binding.contains('+') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if Self::matches_keybinding(binding, key, modifiers) {
|
||||
return Some(action);
|
||||
}
|
||||
@@ -102,7 +97,15 @@ impl Config {
|
||||
) -> bool {
|
||||
// For multi-character bindings without modifiers, we handle them in matches_key_sequence
|
||||
if binding.len() > 1 && !binding.contains('+') {
|
||||
return false;
|
||||
return match binding.to_lowercase().as_str() {
|
||||
"left" => key == KeyCode::Left,
|
||||
"right" => key == KeyCode::Right,
|
||||
"up" => key == KeyCode::Up,
|
||||
"down" => key == KeyCode::Down,
|
||||
"esc" => key == KeyCode::Esc,
|
||||
"enter" => key == KeyCode::Enter,
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
let parts: Vec<&str> = binding.split('+').collect();
|
||||
@@ -114,13 +117,19 @@ impl Config {
|
||||
"ctrl" => expected_modifiers |= KeyModifiers::CONTROL,
|
||||
"shift" => expected_modifiers |= KeyModifiers::SHIFT,
|
||||
"alt" => expected_modifiers |= KeyModifiers::ALT,
|
||||
"left" => expected_key = Some(KeyCode::Left),
|
||||
"right" => expected_key = Some(KeyCode::Right),
|
||||
"up" => expected_key = Some(KeyCode::Up),
|
||||
"down" => expected_key = Some(KeyCode::Down),
|
||||
"esc" => expected_key = Some(KeyCode::Esc),
|
||||
"enter" => expected_key = Some(KeyCode::Enter),
|
||||
":" => expected_key = Some(KeyCode::Char(':')),
|
||||
part if part.len() == 1 => {
|
||||
let c = part.chars().next().unwrap();
|
||||
expected_key = Some(KeyCode::Char(c));
|
||||
part => {
|
||||
if part.len() == 1 {
|
||||
let c = part.chars().next().unwrap();
|
||||
expected_key = Some(KeyCode::Char(c));
|
||||
}
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user