pub struct PasteBurst { /* private fields */ }Implementations§
Source§impl PasteBurst
impl PasteBurst
Sourcepub fn recommended_flush_delay() -> Duration
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.
Sourcepub fn on_plain_char(&mut self, ch: char, now: Instant) -> CharDecision
pub fn on_plain_char(&mut self, ch: char, now: Instant) -> CharDecision
Entry point: decide how to treat a plain char with current timing.
Sourcepub fn on_plain_char_no_hold(&mut self, now: Instant) -> Option<CharDecision>
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.
Sourcepub fn flush_if_due(&mut self, now: Instant) -> FlushResult
pub fn flush_if_due(&mut self, now: Instant) -> FlushResult
Flushes any buffered burst if the inter-key timeout has elapsed.
Returns:
FlushResult::Pastewhen a paste burst was active and buffered text is emitted as one pasted string.FlushResult::Typedwhen a single fast first ASCII char was being held (flicker suppression) and no burst followed before the timeout elapsed.FlushResult::Nonewhen the timeout has not elapsed, or there is nothing to flush.
Sourcepub fn append_newline_if_active(&mut self, now: Instant) -> bool
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.
Sourcepub fn newline_should_insert_instead_of_submit(&self, now: Instant) -> bool
pub fn newline_should_insert_instead_of_submit(&self, now: Instant) -> bool
Decide if Enter should insert a newline (burst context) vs submit.
Sourcepub fn direct_insert_newline_should_insert(&self, now: Instant) -> bool
pub fn direct_insert_newline_should_insert(&self, now: Instant) -> bool
Decide if Enter should insert a newline for callers that insert chars immediately.
Sourcepub fn extend_window(&mut self, now: Instant)
pub fn extend_window(&mut self, now: Instant)
Keep the burst window alive.
Sourcepub fn begin_with_retro_grabbed(&mut self, grabbed: String, now: Instant)
pub fn begin_with_retro_grabbed(&mut self, grabbed: String, now: Instant)
Begin buffering with retroactively grabbed text.
Sourcepub fn append_char_to_buffer(&mut self, ch: char, now: Instant)
pub fn append_char_to_buffer(&mut self, ch: char, now: Instant)
Append a char into the burst buffer.
Sourcepub fn try_append_char_if_active(&mut self, ch: char, now: Instant) -> bool
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.
Sourcepub fn decide_begin_buffer(
&mut self,
now: Instant,
before: &str,
retro_chars: usize,
) -> Option<RetroGrab>
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.
Sourcepub fn flush_before_modified_input(&mut self) -> Option<String>
pub fn flush_before_modified_input(&mut self) -> Option<String>
Before applying modified/non-char input: flush buffered burst immediately.
Sourcepub fn clear_window_after_non_char(&mut self)
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.
Sourcepub fn is_active(&self) -> bool
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).
pub fn clear_after_explicit_paste(&mut self)
Trait Implementations§
Source§impl Clone for PasteBurst
impl Clone for PasteBurst
Source§fn clone(&self) -> PasteBurst
fn clone(&self) -> PasteBurst
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more