pub struct MouseSelectionState {
pub is_selecting: bool,
pub start: (u16, u16),
pub end: (u16, u16),
pub has_selection: bool,
/* private fields */
}Expand description
Tracks mouse-driven text selection state for the TUI transcript.
Fields§
§is_selecting: boolWhether the user is currently dragging to select text.
start: (u16, u16)Screen coordinates where the selection started (column, row).
end: (u16, u16)Screen coordinates where the selection currently ends (column, row).
has_selection: boolWhether a completed selection exists (ready for highlight rendering).
Implementations§
Source§impl MouseSelectionState
impl MouseSelectionState
pub fn new() -> Self
Sourcepub fn start_selection(&mut self, col: u16, row: u16)
pub fn start_selection(&mut self, col: u16, row: u16)
Begin a new selection at the given screen position.
Sourcepub fn update_selection(&mut self, col: u16, row: u16)
pub fn update_selection(&mut self, col: u16, row: u16)
Update the end position while dragging.
Sourcepub fn finish_selection(&mut self, col: u16, row: u16)
pub fn finish_selection(&mut self, col: u16, row: u16)
Finalize the selection on mouse-up.
Sourcepub fn extract_text(&self, buf: &Buffer, area: Rect) -> String
pub fn extract_text(&self, buf: &Buffer, area: Rect) -> String
Extract selected text from a ratatui Buffer.
Sourcepub fn apply_highlight(&self, buf: &mut Buffer, area: Rect)
pub fn apply_highlight(&self, buf: &mut Buffer, area: Rect)
Apply selection highlight (inverted colors) to the frame buffer.
Sourcepub fn needs_copy(&self) -> bool
pub fn needs_copy(&self) -> bool
Returns true if the selection needs to be copied (finalized and not yet copied).
Sourcepub fn mark_copied(&mut self)
pub fn mark_copied(&mut self)
Mark the selection as already copied.
Sourcepub fn copy_to_clipboard(text: &str)
pub fn copy_to_clipboard(text: &str)
Copy the selected text to the system clipboard using crossterm clipboard commands.
Trait Implementations§
Source§impl Debug for MouseSelectionState
impl Debug for MouseSelectionState
Source§impl Default for MouseSelectionState
impl Default for MouseSelectionState
Source§fn default() -> MouseSelectionState
fn default() -> MouseSelectionState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MouseSelectionState
impl RefUnwindSafe for MouseSelectionState
impl Send for MouseSelectionState
impl Sync for MouseSelectionState
impl Unpin for MouseSelectionState
impl UnsafeUnpin for MouseSelectionState
impl UnwindSafe for MouseSelectionState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more