mirror of
https://github.com/wez/wezterm.git
synced 2024-12-23 13:21:38 +03:00
launcher: prefer to use human description of key assignment
refs: https://github.com/wez/wezterm/issues/1485
This commit is contained in:
parent
98479d8530
commit
82da1b42f7
@ -271,7 +271,7 @@ fn english_ordinal(n: isize) -> String {
|
||||
/// of metadata that is useful in the command palette/menubar context.
|
||||
/// This function will be called for the result of compute_default_actions(),
|
||||
/// but can also be used to describe user-provided commands
|
||||
fn derive_command_from_key_assignment(action: &KeyAssignment) -> Option<CommandDef> {
|
||||
pub fn derive_command_from_key_assignment(action: &KeyAssignment) -> Option<CommandDef> {
|
||||
Some(match action {
|
||||
PasteFrom(ClipboardPasteSource::PrimarySelection) => CommandDef {
|
||||
brief: "Paste primary selection".into(),
|
||||
|
@ -5,6 +5,7 @@
|
||||
//! be rendered as a popup/context menu if the system supports it; at the
|
||||
//! time of writing our window layer doesn't provide an API for context
|
||||
//! menus.
|
||||
use crate::commands::derive_command_from_key_assignment;
|
||||
use crate::inputmap::InputMap;
|
||||
use crate::termwindow::TermWindowNotif;
|
||||
use config::configuration;
|
||||
@ -320,13 +321,19 @@ impl LauncherState {
|
||||
// Avoid duplicate entries
|
||||
continue;
|
||||
}
|
||||
key_entries.push(Entry {
|
||||
label: format!(
|
||||
|
||||
let label = match derive_command_from_key_assignment(&entry.action) {
|
||||
Some(cmd) => format!("{}. {}", cmd.brief, cmd.doc),
|
||||
None => format!(
|
||||
"{:?} ({} {})",
|
||||
entry.action,
|
||||
mods.to_string(),
|
||||
keycode.to_string().escape_debug()
|
||||
),
|
||||
};
|
||||
|
||||
key_entries.push(Entry {
|
||||
label,
|
||||
action: entry.action,
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user