pub struct SelectionState {
pub active: bool,
pub range: Option<SelectionRange>,
pub conversation_area: Rect,
pub actual_scroll: usize,
pub total_content_lines: usize,
pub auto_scroll_direction: Option<i8>,
}Expand description
State for tracking an active text selection.
Fields§
§active: boolWhether a selection is currently active (mouse button held).
range: Option<SelectionRange>The current selection range (if any text is selected).
conversation_area: RectThe conversation content area rect (set after each render).
actual_scroll: usizeThe actual scroll position (lines from top) used in the last render.
total_content_lines: usizeTotal content lines in the last render.
auto_scroll_direction: Option<i8>Auto-scroll direction: -1 = up (toward top), 1 = down (toward bottom), None = no auto-scroll.
Implementations§
Source§impl SelectionState
impl SelectionState
Sourcepub fn screen_to_text_position(
&self,
col: u16,
row: u16,
) -> Option<TextPosition>
pub fn screen_to_text_position( &self, col: u16, row: u16, ) -> Option<TextPosition>
Map a screen position (col, row) to a content-space TextPosition.
col,row: absolute terminal coordinates- Returns
Noneif the position is outside the conversation area.
Sourcepub fn is_in_conversation_area(&self, col: u16, row: u16) -> bool
pub fn is_in_conversation_area(&self, col: u16, row: u16) -> bool
Check if a screen position is within the conversation area.
Trait Implementations§
Source§impl Debug for SelectionState
impl Debug for SelectionState
Source§impl Default for SelectionState
impl Default for SelectionState
Source§fn default() -> SelectionState
fn default() -> SelectionState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SelectionState
impl RefUnwindSafe for SelectionState
impl Send for SelectionState
impl Sync for SelectionState
impl Unpin for SelectionState
impl UnsafeUnpin for SelectionState
impl UnwindSafe for SelectionState
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