mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
a6d13836e7
commit
192978966c
1 changed files with 5 additions and 7 deletions
|
|
@ -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}"),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue