mirror of
https://github.com/wez/wezterm.git
synced 2024-12-23 21:32:13 +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;
|
continue;
|
||||||
}
|
}
|
||||||
key_entries.push(Entry {
|
key_entries.push(Entry {
|
||||||
label: format!("{:?} ({:?} {:?})", assignment, keycode, mods),
|
label: format!(
|
||||||
|
"{:?} ({} {})",
|
||||||
|
assignment,
|
||||||
|
mods.to_string(),
|
||||||
|
keycode.to_string()
|
||||||
|
),
|
||||||
kind: EntryKind::KeyAssignment(assignment),
|
kind: EntryKind::KeyAssignment(assignment),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,8 @@ impl ToString for KeyCode {
|
|||||||
fn to_string(&self) -> String {
|
fn to_string(&self) -> String {
|
||||||
match self {
|
match self {
|
||||||
Self::RawCode(n) => format!("raw:{}", n),
|
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::Composed(s) => s.to_string(),
|
||||||
Self::Numpad(n) => format!("Numpad{}", n),
|
Self::Numpad(n) => format!("Numpad{}", n),
|
||||||
Self::Function(n) => format!("F{}", 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! {
|
bitflags! {
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct MouseButtons: u8 {
|
pub struct MouseButtons: u8 {
|
||||||
|
Loading…
Reference in New Issue
Block a user