pub struct InputPanelState {
pub textarea: TextArea<'static>,
pub edit_selection_messages: Vec<(String, String)>,
pub edit_selection_index: usize,
pub edit_selection_hovered_id: Option<String>,
pub file_cache: FileCache,
pub fuzzy_finder: FuzzyFinder,
}Expand description
Stateful data for the InputPanel widget.
Fields§
§textarea: TextArea<'static>§edit_selection_messages: Vec<(String, String)>§edit_selection_index: usize§edit_selection_hovered_id: Option<String>§file_cache: FileCacheFile cache for fuzzy finder
fuzzy_finder: FuzzyFinderFuzzy finder widget
Implementations§
Source§impl InputPanelState
impl InputPanelState
Sourcepub fn get_cursor_byte_offset(&self) -> usize
pub fn get_cursor_byte_offset(&self) -> usize
Get the byte offset of the cursor in the textarea content.
Sourcepub fn is_in_fuzzy_query(&self) -> bool
pub fn is_in_fuzzy_query(&self) -> bool
Checks if the fuzzy finder is active and the cursor is in a valid query position. This method does not allocate and is suitable for checks on every tick.
Sourcepub fn get_current_fuzzy_query(&self) -> Option<String>
pub fn get_current_fuzzy_query(&self) -> Option<String>
If the fuzzy finder is active and the cursor is in a valid query position, returns the query string. Otherwise, returns None.
Sourcepub fn handle_input(&mut self, input: Input)
pub fn handle_input(&mut self, input: Input)
Handle input in insert/bash modes
Sourcepub fn complete_fuzzy_finder(&mut self, selected_path: &str)
pub fn complete_fuzzy_finder(&mut self, selected_path: &str)
Complete fuzzy finder by replacing the query text with the selected path
Sourcepub fn complete_command_fuzzy(&mut self, selected_command: &str)
pub fn complete_command_fuzzy(&mut self, selected_command: &str)
Complete command fuzzy finder by replacing the query text with the selected command
Sourcepub fn insert_str(&mut self, s: &str)
pub fn insert_str(&mut self, s: &str)
Insert a string (e.g., for paste operations)
Sourcepub fn set_content_from_lines(&mut self, lines: Vec<&str>)
pub fn set_content_from_lines(&mut self, lines: Vec<&str>)
Set content from lines (used when editing a message)
Sourcepub fn required_height(
&self,
current_approval: Option<&ToolCall>,
width: u16,
max_height: u16,
) -> u16
pub fn required_height( &self, current_approval: Option<&ToolCall>, width: u16, max_height: u16, ) -> u16
Calculate required height for the input panel
Sourcepub fn required_height_for_approval(
tool_call: &ToolCall,
width: u16,
max_height: u16,
) -> u16
pub fn required_height_for_approval( tool_call: &ToolCall, width: u16, max_height: u16, ) -> u16
Calculate required height for approval mode
Sourcepub fn edit_selection_prev(&mut self) -> Option<&(String, String)>
pub fn edit_selection_prev(&mut self) -> Option<&(String, String)>
Navigate up in edit selection mode
Sourcepub fn edit_selection_next(&mut self) -> Option<&(String, String)>
pub fn edit_selection_next(&mut self) -> Option<&(String, String)>
Navigate down in edit selection mode
Sourcepub fn get_selected_message(&self) -> Option<&(String, String)>
pub fn get_selected_message(&self) -> Option<&(String, String)>
Get currently selected message in edit selection mode
Sourcepub fn populate_edit_selection<'a>(
&mut self,
chat_items: impl Iterator<Item = &'a ChatItemData>,
)
pub fn populate_edit_selection<'a>( &mut self, chat_items: impl Iterator<Item = &'a ChatItemData>, )
Populate edit selection messages from chat store
Sourcepub fn get_hovered_id(&self) -> Option<&str>
pub fn get_hovered_id(&self) -> Option<&str>
Get the current hovered message ID
Sourcepub fn clear_edit_selection(&mut self)
pub fn clear_edit_selection(&mut self)
Clear edit selection state
Sourcepub fn activate_fuzzy(&mut self)
pub fn activate_fuzzy(&mut self)
Activate fuzzy finder for files
Sourcepub fn activate_command_fuzzy(&mut self)
pub fn activate_command_fuzzy(&mut self)
Activate fuzzy finder for commands
Sourcepub fn deactivate_fuzzy(&mut self)
pub fn deactivate_fuzzy(&mut self)
Deactivate fuzzy finder
Sourcepub fn fuzzy_active(&self) -> bool
pub fn fuzzy_active(&self) -> bool
Check if fuzzy finder is active
Sourcepub async fn handle_fuzzy_key(
&mut self,
key: KeyEvent,
) -> Option<FuzzyFinderResult>
pub async fn handle_fuzzy_key( &mut self, key: KeyEvent, ) -> Option<FuzzyFinderResult>
Handle key event for fuzzy finder
Sourcepub fn file_cache(&self) -> &FileCache
pub fn file_cache(&self) -> &FileCache
Get file cache reference
Sourcepub fn file_cache_mut(&mut self) -> &mut FileCache
pub fn file_cache_mut(&mut self) -> &mut FileCache
Get mutable file cache reference
Trait Implementations§
Source§impl Debug for InputPanelState
impl Debug for InputPanelState
Auto Trait Implementations§
impl !Freeze for InputPanelState
impl !RefUnwindSafe for InputPanelState
impl Send for InputPanelState
impl Sync for InputPanelState
impl Unpin for InputPanelState
impl !UnwindSafe for InputPanelState
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> 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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request