1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-21 03:39:16 +03:00

include key assignments in palette and menubar

Fixup CopyMode key assignments; they were all incorrectly
labelled as activating copy mode, which isn't correct.
We're just using Debug labelling for them at the moment,
need to get that fixed properly.

refs: https://github.com/wez/wezterm/issues/1485
This commit is contained in:
Wez Furlong 2022-12-23 20:18:26 -07:00
parent 85afd9b599
commit 1fad25e926
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387

View File

@ -305,6 +305,47 @@ impl CommandDef {
});
}
// And sweep to pick up stuff from their key assignments
let inputmap = InputMap::new(config);
for entry in inputmap.keys.default.values() {
if result
.iter()
.position(|cmd| cmd.action == entry.action)
.is_some()
{
continue;
}
if let Some(cmd) = derive_command_from_key_assignment(&entry.action) {
result.push(ExpandedCommand {
brief: cmd.brief.into(),
doc: cmd.doc.into(),
keys: vec![],
action: entry.action.clone(),
menubar: cmd.menubar,
});
}
}
for table in inputmap.keys.by_name.values() {
for entry in table.values() {
if result
.iter()
.position(|cmd| cmd.action == entry.action)
.is_some()
{
continue;
}
if let Some(cmd) = derive_command_from_key_assignment(&entry.action) {
result.push(ExpandedCommand {
brief: cmd.brief.into(),
doc: cmd.doc.into(),
keys: vec![],
action: entry.action.clone(),
menubar: cmd.menubar,
});
}
}
}
result
}
@ -1502,12 +1543,12 @@ pub fn derive_command_from_key_assignment(action: &KeyAssignment) -> Option<Comm
args: &[ArgType::ActivePane],
menubar: &["Shell", "Attach"],
},
CopyMode(_) => CommandDef {
brief: "Activate Copy Mode".into(),
doc: "Activate Copy Mode".into(),
CopyMode(copy_mode) => CommandDef {
brief: format!("{copy_mode:?}").into(),
doc: "".into(),
keys: vec![],
args: &[ArgType::ActivePane],
menubar: &["Edit"],
menubar: &["Edit", "Copy Mode"],
},
RotatePanes(direction) => CommandDef {
brief: format!("Rotate panes {direction:?}").into(),