From 192978966c1e5c6a66dc7b701540f1d8a135c5fd Mon Sep 17 00:00:00 2001 From: sxyazi Date: Mon, 27 May 2024 19:20:25 +0800 Subject: [PATCH] .. --- yazi-config/src/keymap/key.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/yazi-config/src/keymap/key.rs b/yazi-config/src/keymap/key.rs index 631f66c0..a7fef406 100644 --- a/yazi-config/src/keymap/key.rs +++ b/yazi-config/src/keymap/key.rs @@ -76,8 +76,8 @@ impl FromStr for Key { } let mut it = s[1..s.len() - 1].split_inclusive('-').peekable(); - while let Some(x) = it.next() { - match x.to_lowercase().as_str() { + while let Some(next) = it.next() { + match next.to_ascii_lowercase().as_str() { "s-" => key.shift = true, "c-" => key.ctrl = true, "a-" => key.alt = true, @@ -112,11 +112,9 @@ impl FromStr for Key { "f12" => key.code = KeyCode::F(12), "esc" => key.code = KeyCode::Esc, - _ => match x { - c if it.peek().is_none() => { - key.code = KeyCode::Char(c.chars().next().unwrap()); - } - k => bail!("unknown key: {k}"), + _ => match next { + s if it.peek().is_none() => key.code = KeyCode::Char(s.chars().next().unwrap()), + s => bail!("unknown key: {s}"), }, } }