[][src]Enum terminal_input::Event

pub enum Event {
    KeyPress {
        modifiers: Modifiers,
        key: KeyInput,
        is_repeat: bool,
    },
    KeyRelease {
        modifiers: Modifiers,
        key: KeyInput,
    },
    Mouse {
        device_id: u16,
        modifiers: Modifiers,
        buttons: mmask_t,
        x: u32,
        y: u32,
    },
    PasteBegin,
    PasteEnd,
    Resize {
        width: u32,
        height: u32,
    },
}

A single event generated by a terminal. Simple text input, whether arriving via a pipe, a paste command, or typing, will be represented with KeyPress events. These events are inherently lossy and have different levels of support on different terminals. Depending on the use case, certain modifier keys may just never be recorded, key repeats will be indistinguishable from orignal presses, pastes may not be bracketed, and key releases may never be registered, among other failures.

Variants

KeyPress

A single typing action by the user, input from stdin. Except between PasteBegin and PasteEnd events, these typically will not be control characters, as those are heuristically decoded into modifier keys combined with printable characters.

Fields of KeyPress

modifiers: Modifierskey: KeyInputis_repeat: bool

Whether this keypress comes from holding down a key

KeyRelease

This is kept as a separate event from KeyPress as it usually does not want to be handled in the same way and is supported by very few terminals, making it easy to miss in testing.

Fields of KeyRelease

modifiers: Modifierskey: KeyInput
Mouse

A motion or click of a mouse button. Modifiers typically are only be available on button state changes, not mouse motion.

Fields of Mouse

device_id: u16modifiers: Modifiersbuttons: mmask_tx: u32y: u32
PasteBegin

An indication that the following events occur purely as result of the user pasting from some unknown location that should be conservatively considered malicious. Applications should filter out control commands that happen during a paste, only considering the input as raw, unescaped text.

PasteEnd

The marker indicating a return to normal user interaction.

Resize

The window has been resized and the application may want to rerender to fit the new sizee.

Fields of Resize

width: u32height: u32

Trait Implementations

impl Clone for Event[src]

impl Copy for Event[src]

impl Debug for Event[src]

Auto Trait Implementations

impl RefUnwindSafe for Event

impl Send for Event

impl Sync for Event

impl Unpin for Event

impl UnwindSafe for Event

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.