mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-25 23:21:15 -03:00
@@ -24,7 +24,7 @@ If only ``KEYS`` is given, any existing binding for those keys in the given ``MO
|
||||
If no ``KEYS`` argument is provided, all bindings (in the given ``MODE``) are printed.
|
||||
|
||||
``KEYS`` is a comma-separated list of key names.
|
||||
Modifier keys can be specified by prefixing a key name with a combination of ``ctrl-``, ``alt-`` and ``shift-``.
|
||||
Modifier keys can be specified by prefixing a key name with a combination of ``ctrl-``, ``alt-``, ``shift-`` and ``super-`` (i.e. the "windows" or "command" key).
|
||||
For example, pressing :kbd:`w` while holding the Alt modifier is written as ``alt-w``.
|
||||
Key names are case-sensitive; for example ``alt-W`` is the same as ``alt-shift-w``.
|
||||
``ctrl-x,ctrl-e`` would mean pressing :kbd:`ctrl-x` followed by :kbd:`ctrl-e`.
|
||||
|
||||
@@ -578,6 +578,7 @@ pub(crate) fn terminal_protocols_disable_ifn() {
|
||||
|
||||
fn parse_mask(mask: u32) -> Modifiers {
|
||||
Modifiers {
|
||||
sup: (mask & 8) != 0,
|
||||
ctrl: (mask & 4) != 0,
|
||||
alt: (mask & 2) != 0,
|
||||
shift: (mask & 1) != 0,
|
||||
|
||||
@@ -59,6 +59,7 @@ pub struct Modifiers {
|
||||
pub ctrl: bool,
|
||||
pub alt: bool,
|
||||
pub shift: bool,
|
||||
pub sup: bool,
|
||||
}
|
||||
|
||||
impl Modifiers {
|
||||
@@ -67,6 +68,7 @@ const fn new() -> Self {
|
||||
ctrl: false,
|
||||
alt: false,
|
||||
shift: false,
|
||||
sup: false,
|
||||
}
|
||||
}
|
||||
pub(crate) const ALT: Self = {
|
||||
@@ -284,6 +286,7 @@ pub(crate) fn parse_keys(value: &wstr) -> Result<Vec<Key>, WString> {
|
||||
_ if modifier == "ctrl" => modifiers.ctrl = true,
|
||||
_ if modifier == "alt" => modifiers.alt = true,
|
||||
_ if modifier == "shift" => modifiers.shift = true,
|
||||
_ if modifier == "super" => modifiers.sup = true,
|
||||
_ => {
|
||||
return Err(wgettext_fmt!(
|
||||
"unknown modifier '%s' in '%s'",
|
||||
@@ -420,6 +423,9 @@ fn from(key: Key) -> Self {
|
||||
if key.modifiers.ctrl {
|
||||
res.insert_utfstr(0, L!("ctrl-"));
|
||||
}
|
||||
if key.modifiers.sup {
|
||||
res.insert_utfstr(0, L!("super-"));
|
||||
}
|
||||
|
||||
res
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user