pub struct KeyEvent {
pub code: KeyCode,
pub modifiers: KeyModifiers,
}Expand description
Represents a key event.
Fields§
§code: KeyCode§modifiers: KeyModifiersImplementations§
Source§impl KeyEvent
impl KeyEvent
pub fn new(code: KeyCode, modifiers: KeyModifiers) -> Self
Sourcepub fn canonicalize(&mut self)
pub fn canonicalize(&mut self)
Canonicalize the key event by removing the SHIFT modifier from character keys.
This is necessary because terminals send uppercase characters with the SHIFT modifier,
so e.g. a press of G arrives as S-G from crossterm. However, we just want G. This
matches the FromStr for KeyEvent implementation used when parsing config.
Trait Implementations§
Source§impl Ord for KeyEvent
impl Ord for KeyEvent
Source§impl PartialOrd for KeyEvent
impl PartialOrd for KeyEvent
impl Copy for KeyEvent
impl Eq for KeyEvent
impl StructuralPartialEq for KeyEvent
Auto Trait Implementations§
impl Freeze for KeyEvent
impl RefUnwindSafe for KeyEvent
impl Send for KeyEvent
impl Sync for KeyEvent
impl Unpin for KeyEvent
impl UnsafeUnpin for KeyEvent
impl UnwindSafe for KeyEvent
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
Mutably borrows from an owned value. Read more