mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
5fd24e8218
commit
93a37c9ae6
1 changed files with 4 additions and 4 deletions
|
|
@ -118,8 +118,9 @@ impl FromStr for Key {
|
||||||
|
|
||||||
_ => match next {
|
_ => match next {
|
||||||
s if it.peek().is_none() => {
|
s if it.peek().is_none() => {
|
||||||
key.code = KeyCode::Char(s.chars().next().unwrap());
|
let c = s.chars().next().unwrap();
|
||||||
key.shift = matches!(key.code, KeyCode::Char(c) if c.is_ascii_uppercase());
|
key.shift |= c.is_ascii_uppercase();
|
||||||
|
key.code = KeyCode::Char(if key.shift { c.to_ascii_uppercase() } else { c });
|
||||||
}
|
}
|
||||||
s => bail!("unknown key: {s}"),
|
s => bail!("unknown key: {s}"),
|
||||||
},
|
},
|
||||||
|
|
@ -136,7 +137,6 @@ impl FromStr for Key {
|
||||||
impl Display for Key {
|
impl Display for Key {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
if let Some(c) = self.plain() {
|
if let Some(c) = self.plain() {
|
||||||
let c = if self.shift { c.to_ascii_uppercase() } else { c };
|
|
||||||
return if c == ' ' { write!(f, "<Space>") } else { f.write_char(c) };
|
return if c == ' ' { write!(f, "<Space>") } else { f.write_char(c) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -192,7 +192,7 @@ impl Display for Key {
|
||||||
|
|
||||||
KeyCode::Char(' ') => "Space",
|
KeyCode::Char(' ') => "Space",
|
||||||
KeyCode::Char(c) => {
|
KeyCode::Char(c) => {
|
||||||
f.write_char(if self.shift { c.to_ascii_uppercase() } else { c })?;
|
f.write_char(c)?;
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
_ => "Unknown",
|
_ => "Unknown",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue