diff options
Diffstat (limited to '')
| -rw-r--r-- | core/src/keyboard/modifiers.rs | 24 | 
1 files changed, 24 insertions, 0 deletions
| diff --git a/core/src/keyboard/modifiers.rs b/core/src/keyboard/modifiers.rs index e531510f..edbf6d38 100644 --- a/core/src/keyboard/modifiers.rs +++ b/core/src/keyboard/modifiers.rs @@ -84,4 +84,28 @@ impl Modifiers {          is_pressed      } + +    /// Returns true if the "jump key" is pressed in the [`Modifiers`]. +    /// +    /// The "jump key" is the modifier key used to widen text motions. It is the `Alt` +    /// key in macOS and the `Ctrl` key in other platforms. +    pub fn jump(self) -> bool { +        if cfg!(target_os = "macos") { +            self.alt() +        } else { +            self.control() +        } +    } + +    /// Returns true if the "command key" is pressed on a macOS device. +    /// +    /// This is relevant for macOS-specific actions (e.g. `⌘ + ArrowLeft` moves the cursor +    /// to the beginning of the line). +    pub fn macos_command(self) -> bool { +        if cfg!(target_os = "macos") { +            self.logo() +        } else { +            false +        } +    }  } | 
