pub struct KeypressMap {
pub keymaps: HashMap<KeypressKey, Command>,
}Expand description
The default keymap handler does not have modal-mode specific keybindings.
Fields§
§keymaps: HashMap<KeypressKey, Command>Implementations§
Source§impl KeypressMap
impl KeypressMap
pub fn default_windows() -> KeypressMap
pub fn default_macos() -> KeypressMap
pub fn default_linux() -> KeypressMap
Sourcepub fn handle_keypress(
&self,
editor: RwSignal<Editor>,
keypress: &KeypressKey,
) -> CommandExecuted
pub fn handle_keypress( &self, editor: RwSignal<Editor>, keypress: &KeypressKey, ) -> CommandExecuted
Dispatch a key combination against this keymap.
Looks up the key combination in the keymap. If no exact match is found, retries the lookup with the Shift modifier removed. This allows movement commands like Home and End to support selection extension (Shift+Home, Shift+End) without needing separate keymap entries — the Shift modifier is passed through to the command, which uses it to decide between moving the cursor and extending the selection.
This applies to any binding in the map, including custom ones. A binding for Ctrl+Home will automatically handle Ctrl+Shift+Home as the same command with selection extension.
Returns CommandExecuted::Yes if a command was found and executed,
CommandExecuted::No otherwise.
See the custom_keymap
example for a complete usage demonstration.
Trait Implementations§
Source§impl Clone for KeypressMap
impl Clone for KeypressMap
Source§fn clone(&self) -> KeypressMap
fn clone(&self) -> KeypressMap
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for KeypressMap
impl Default for KeypressMap
Source§fn default() -> KeypressMap
fn default() -> KeypressMap
Auto Trait Implementations§
impl Freeze for KeypressMap
impl RefUnwindSafe for KeypressMap
impl Send for KeypressMap
impl Sync for KeypressMap
impl Unpin for KeypressMap
impl UnsafeUnpin for KeypressMap
impl UnwindSafe for KeypressMap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().