Skip to main content

Gesture

Struct Gesture 

Source
pub struct Gesture<'alloc> { /* private fields */ }
Expand description

Opaque handle to state for interpreting terminal selection gestures.

The gesture owns only the state required to interpret pointer events. Calls that use a gesture are not concurrency-safe and must be serialized with terminal mutations.

§Memory management

When dropped, this type will temporarily leak a small amount of memory belonging to the internal TrackedGridRefs. They will instead be reclaimed when the terminal they belong to is dropped. This memory can be preemptively reclaimed by calling the Gesture::reset method if needed.

Implementations§

Source§

impl<'alloc> Gesture<'alloc>

Source

pub fn new() -> Result<Self>

Create a new selection gesture instance.

Source

pub fn new_with_alloc<'ctx: 'alloc>( alloc: &'alloc Allocator<'ctx>, ) -> Result<Self>

Create a new selection gesture instance with a custom allocator.

See the crate-level documentation regarding custom memory management and lifetimes.

Source

pub fn reset(&mut self, terminal: &Terminal<'_, '_>)

Reset any active selection gesture state.

This cancels the active click sequence and releases any tracked terminal references owned by the gesture without dropping the gesture object.

Source

pub fn click_count(&self, terminal: &Terminal<'_, '_>) -> Result<u8>

Get the current click count. 0 means inactive.

Source

pub fn dragged(&self, terminal: &Terminal<'_, '_>) -> Result<bool>

Whether the current/last left-click gesture has dragged.

Source

pub fn autoscroll(&self, terminal: &Terminal<'_, '_>) -> Result<Autoscroll>

Get the current autoscroll request.

Source

pub fn behavior(&self, terminal: &Terminal<'_, '_>) -> Result<Behavior>

Get the current gesture behavior.

Source

pub fn anchor<'t>( &self, terminal: &'t Terminal<'_, '_>, ) -> Result<Option<GridRef<'t>>>

Get the current left-click anchor.

Returns None if there is no valid active anchor.

Trait Implementations§

Source§

impl<'alloc> Debug for Gesture<'alloc>

Source§

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

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

impl Drop for Gesture<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'alloc> !Send for Gesture<'alloc>

§

impl<'alloc> !Sync for Gesture<'alloc>

§

impl<'alloc> Freeze for Gesture<'alloc>

§

impl<'alloc> RefUnwindSafe for Gesture<'alloc>

§

impl<'alloc> Unpin for Gesture<'alloc>

§

impl<'alloc> UnsafeUnpin for Gesture<'alloc>

§

impl<'alloc> UnwindSafe for Gesture<'alloc>

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> 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, 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.