mirror of
https://github.com/wez/wezterm.git
synced 2024-12-23 13:21:38 +03:00
launcher: tidy up key/mod display impl to make it look nicer
Make things a little more compact and display friendly refs: #1485
This commit is contained in:
parent
05ec80d945
commit
9919745d4e
@ -328,7 +328,12 @@ pub fn launcher(
|
||||
continue;
|
||||
}
|
||||
key_entries.push(Entry {
|
||||
label: format!("{:?} ({:?} {:?})", assignment, keycode, mods),
|
||||
label: format!(
|
||||
"{:?} ({} {})",
|
||||
assignment,
|
||||
mods.to_string(),
|
||||
keycode.to_string()
|
||||
),
|
||||
kind: EntryKind::KeyAssignment(assignment),
|
||||
});
|
||||
}
|
||||
|
@ -301,7 +301,8 @@ impl ToString for KeyCode {
|
||||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
Self::RawCode(n) => format!("raw:{}", n),
|
||||
Self::Char(c) => c.to_string(),
|
||||
Self::Char(c) => format!("mapped:{}", c),
|
||||
Self::Physical(phys) => format!("{}", phys.to_string()),
|
||||
Self::Composed(s) => s.to_string(),
|
||||
Self::Numpad(n) => format!("Numpad{}", n),
|
||||
Self::Function(n) => format!("F{}", n),
|
||||
@ -767,6 +768,16 @@ impl TryFrom<&str> for PhysKeyCode {
|
||||
}
|
||||
}
|
||||
|
||||
impl ToString for PhysKeyCode {
|
||||
fn to_string(&self) -> String {
|
||||
if let Some(s) = INV_PHYSKEYCODE_MAP.get(self) {
|
||||
s.to_string()
|
||||
} else {
|
||||
format!("{:?}", self)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bitflags! {
|
||||
#[derive(Default)]
|
||||
pub struct MouseButtons: u8 {
|
||||
|
Loading…
Reference in New Issue
Block a user