Skip to main content

SemanticEvent

Enum SemanticEvent 

Source
pub enum SemanticEvent {
    Click {
        pos: Position,
        button: MouseButton,
    },
    DoubleClick {
        pos: Position,
        button: MouseButton,
    },
    TripleClick {
        pos: Position,
        button: MouseButton,
    },
    LongPress {
        pos: Position,
        duration: Duration,
    },
    DragStart {
        pos: Position,
        button: MouseButton,
    },
    DragMove {
        start: Position,
        current: Position,
        delta: (i16, i16),
    },
    DragEnd {
        start: Position,
        end: Position,
    },
    DragCancel,
    Chord {
        sequence: Vec<ChordKey>,
    },
    Swipe {
        direction: SwipeDirection,
        distance: u16,
        velocity: f32,
    },
}
Expand description

High-level semantic events derived from raw terminal input.

These represent user intentions rather than raw key presses or mouse coordinates. A gesture recognizer converts raw events into these.

Variants§

§

Click

Single click (mouse down + up in same position within threshold).

Fields

§

DoubleClick

Two clicks within the double-click time threshold.

Fields

§

TripleClick

Three clicks within threshold (often used for line selection).

Fields

§

LongPress

Mouse held down beyond threshold without moving.

Fields

§duration: Duration
§

DragStart

Mouse moved beyond drag threshold while button held.

Fields

§

DragMove

Ongoing drag movement.

Fields

§start: Position
§current: Position
§delta: (i16, i16)

Movement since last DragMove (dx, dy).

§

DragEnd

Mouse released after drag.

Fields

§start: Position
§

DragCancel

Drag cancelled (Escape pressed, focus lost, etc.).

§

Chord

Key chord sequence completed (e.g., Ctrl+K, Ctrl+C).

Invariant: sequence is always non-empty.

Fields

§sequence: Vec<ChordKey>
§

Swipe

Swipe gesture (rapid mouse movement in a cardinal direction).

Fields

§direction: SwipeDirection
§distance: u16

Distance in cells.

§velocity: f32

Velocity in cells per second (always >= 0.0).

Implementations§

Source§

impl SemanticEvent

Source

pub fn is_drag(&self) -> bool

Returns true if this is a drag-related event.

Source

pub fn is_click(&self) -> bool

Returns true if this is a click-related event (single, double, or triple).

Source

pub fn position(&self) -> Option<Position>

Returns the position if this event has one.

Source

pub fn button(&self) -> Option<MouseButton>

Returns the mouse button if this event involves one.

Trait Implementations§

Source§

impl Clone for SemanticEvent

Source§

fn clone(&self) -> SemanticEvent

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SemanticEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for SemanticEvent

Source§

fn eq(&self, other: &SemanticEvent) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for SemanticEvent

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.