pub struct ChatView { /* private fields */ }Expand description
Chat view component for displaying conversation messages
Implementations§
Source§impl ChatView
impl ChatView
pub fn new() -> Self
Sourcepub fn add_message(&mut self, message: Message)
pub fn add_message(&mut self, message: Message)
Add a message to the chat
Sourcepub fn append_to_last_assistant(&mut self, content: &str)
pub fn append_to_last_assistant(&mut self, content: &str)
Append content to the last assistant message, or create a new one if none exists
Sourcepub fn message_count(&self) -> usize
pub fn message_count(&self) -> usize
Get the number of messages
Sourcepub fn scroll_down(&mut self)
pub fn scroll_down(&mut self)
Scroll down by multiple lines
Sourcepub fn scroll_page_up(&mut self, viewport_height: u16)
pub fn scroll_page_up(&mut self, viewport_height: u16)
Scroll up by one page (viewport height)
Sourcepub fn scroll_page_down(&mut self, viewport_height: u16)
pub fn scroll_page_down(&mut self, viewport_height: u16)
Scroll down by one page
Sourcepub fn scroll_to_bottom(&mut self)
pub fn scroll_to_bottom(&mut self)
Scroll to the bottom (show newest messages)
Sourcepub fn scroll_to_top(&mut self)
pub fn scroll_to_top(&mut self)
Scroll to the top (show oldest messages)
Sourcepub fn start_selection(&mut self, message_idx: usize, byte_offset: usize)
pub fn start_selection(&mut self, message_idx: usize, byte_offset: usize)
Start text selection at position
Sourcepub fn extend_selection(&mut self, message_idx: usize, byte_offset: usize)
pub fn extend_selection(&mut self, message_idx: usize, byte_offset: usize)
Extend selection to position
Sourcepub fn clear_selection(&mut self)
pub fn clear_selection(&mut self)
Clear text selection
Sourcepub fn has_selection(&self) -> bool
pub fn has_selection(&self) -> bool
Check if there is an active selection
Sourcepub fn screen_to_text_pos(&self, col: u16, row: u16) -> Option<(usize, usize)>
pub fn screen_to_text_pos(&self, col: u16, row: u16) -> Option<(usize, usize)>
Map screen coordinates to text position for mouse selection Returns (message_idx, char_offset) if a valid position is found
Sourcepub fn render_position_count(&self) -> usize
pub fn render_position_count(&self) -> usize
Get the number of render positions tracked (for debugging)
Sourcepub fn is_selected(&self, message_idx: usize, char_offset: usize) -> bool
pub fn is_selected(&self, message_idx: usize, char_offset: usize) -> bool
Check if a byte position is within the current selection
Sourcepub fn get_selected_text(&self) -> Option<String>
pub fn get_selected_text(&self) -> Option<String>
Get selected text (character-precise)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ChatView
impl !RefUnwindSafe for ChatView
impl Send for ChatView
impl !Sync for ChatView
impl Unpin for ChatView
impl UnsafeUnpin for ChatView
impl UnwindSafe for ChatView
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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