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>
impl<'alloc> Gesture<'alloc>
Sourcepub fn new_with_alloc<'ctx: 'alloc>(
alloc: &'alloc Allocator<'ctx>,
) -> Result<Self>
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.
Sourcepub fn reset(&mut self, terminal: &Terminal<'_, '_>)
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.
Sourcepub fn click_count(&self, terminal: &Terminal<'_, '_>) -> Result<u8>
pub fn click_count(&self, terminal: &Terminal<'_, '_>) -> Result<u8>
Get the current click count. 0 means inactive.
Sourcepub fn dragged(&self, terminal: &Terminal<'_, '_>) -> Result<bool>
pub fn dragged(&self, terminal: &Terminal<'_, '_>) -> Result<bool>
Whether the current/last left-click gesture has dragged.
Sourcepub fn autoscroll(&self, terminal: &Terminal<'_, '_>) -> Result<Autoscroll>
pub fn autoscroll(&self, terminal: &Terminal<'_, '_>) -> Result<Autoscroll>
Get the current autoscroll request.