Skip to main content

PasteBurst

Struct PasteBurst 

Source
pub struct PasteBurst { /* private fields */ }

Implementations§

Source§

impl PasteBurst

Source

pub fn recommended_flush_delay() -> Duration

Recommended delay to wait between simulated keypresses (or before scheduling a UI tick) so that a pending fast keystroke is flushed out of the burst detector as normal typed input.

Primarily used by tests and by the TUI to reliably cross the paste-burst timing threshold.

Source

pub fn on_plain_char(&mut self, ch: char, now: Instant) -> CharDecision

Entry point: decide how to treat a plain char with current timing.

Source

pub fn on_plain_char_no_hold(&mut self, now: Instant) -> Option<CharDecision>

Like on_plain_char(), but never holds the first char.

Used for non-ASCII input paths (e.g., IMEs) where holding a character can feel like dropped input, while still allowing burst-based paste detection.

Note: This method will only ever return BufferAppend or BeginBuffer.

Source

pub fn flush_if_due(&mut self, now: Instant) -> FlushResult

Flushes any buffered burst if the inter-key timeout has elapsed.

Returns:

  • FlushResult::Paste when a paste burst was active and buffered text is emitted as one pasted string.
  • FlushResult::Typed when a single fast first ASCII char was being held (flicker suppression) and no burst followed before the timeout elapsed.
  • FlushResult::None when the timeout has not elapsed, or there is nothing to flush.
Source

pub fn append_newline_if_active(&mut self, now: Instant) -> bool

While bursting: accumulate a newline into the buffer instead of submitting the textarea.

Returns true if a newline was appended (we are in a burst context), false otherwise.

Source

pub fn newline_should_insert_instead_of_submit(&self, now: Instant) -> bool

Decide if Enter should insert a newline (burst context) vs submit.

Source

pub fn direct_insert_newline_should_insert(&self, now: Instant) -> bool

Decide if Enter should insert a newline for callers that insert chars immediately.

Source

pub fn extend_window(&mut self, now: Instant)

Keep the burst window alive.

Source

pub fn begin_with_retro_grabbed(&mut self, grabbed: String, now: Instant)

Begin buffering with retroactively grabbed text.

Source

pub fn append_char_to_buffer(&mut self, ch: char, now: Instant)

Append a char into the burst buffer.

Source

pub fn try_append_char_if_active(&mut self, ch: char, now: Instant) -> bool

Try to append a char into the burst buffer only if a burst is already active.

Returns true when the char was captured into the existing burst, false otherwise.

Source

pub fn decide_begin_buffer( &mut self, now: Instant, before: &str, retro_chars: usize, ) -> Option<RetroGrab>

Decide whether to begin buffering by retroactively capturing recent chars from the slice before the cursor.

Heuristic: if the retro-grabbed slice contains any whitespace or is sufficiently long (>= 16 characters), treat it as paste-like to avoid rendering the typed prefix momentarily before the paste is recognized. This favors responsiveness and prevents flicker for typical pastes (URLs, file paths, multiline text) while not triggering on short words.

Returns Some(RetroGrab) with the start byte and grabbed text when we decide to buffer retroactively; otherwise None.

Source

pub fn flush_before_modified_input(&mut self) -> Option<String>

Before applying modified/non-char input: flush buffered burst immediately.

Source

pub fn clear_window_after_non_char(&mut self)

Clear only the timing window and any pending first-char.

Does not emit or clear the buffered text itself; callers should have already flushed (if needed) via one of the flush methods above.

Source

pub fn is_active(&self) -> bool

Returns true if we are in any paste-burst related transient state (actively buffering, have a non-empty buffer, or have saved the first fast char while waiting for a potential burst).

Source

pub fn clear_after_explicit_paste(&mut self)

Trait Implementations§

Source§

impl Clone for PasteBurst

Source§

fn clone(&self) -> PasteBurst

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for PasteBurst

Source§

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

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

impl Default for PasteBurst

Source§

fn default() -> PasteBurst

Returns the “default value” for a type. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more