pub struct App {Show 57 fields
pub messages: Vec<ChatMessage>,
pub viewport: ChatViewport,
pub input: InputState,
pub status: AppStatus,
pub should_quit: bool,
pub session_id: Option<SessionId>,
pub conn: Option<Rc<ClientSideConnection>>,
pub adapter_child: Option<Child>,
pub model_name: String,
pub cwd: String,
pub cwd_raw: String,
pub files_accessed: usize,
pub mode: Option<ModeState>,
pub login_hint: Option<LoginHint>,
pub pending_compact_clear: bool,
pub help_view: HelpView,
pub pending_permission_ids: Vec<String>,
pub cancelled_turn_pending_hint: bool,
pub event_tx: UnboundedSender<ClientEvent>,
pub event_rx: UnboundedReceiver<ClientEvent>,
pub spinner_frame: usize,
pub tools_collapsed: bool,
pub active_task_ids: HashSet<String>,
pub terminals: TerminalMap,
pub force_redraw: bool,
pub tool_call_index: HashMap<String, (usize, usize)>,
pub todos: Vec<TodoItem>,
pub show_header: bool,
pub show_todo_panel: bool,
pub todo_scroll: usize,
pub todo_selected: usize,
pub focus: FocusManager,
pub available_commands: Vec<AvailableCommand>,
pub cached_frame_area: Rect,
pub selection: Option<SelectionState>,
pub scrollbar_drag: Option<ScrollbarDragState>,
pub rendered_chat_lines: Vec<String>,
pub rendered_chat_area: Rect,
pub rendered_input_lines: Vec<String>,
pub rendered_input_area: Rect,
pub mention: Option<MentionState>,
pub slash: Option<SlashState>,
pub pending_submit: bool,
pub drain_key_count: usize,
pub paste_burst: PasteBurstDetector,
pub pending_paste_text: String,
pub file_cache: Option<Vec<FileCandidate>>,
pub cached_todo_compact: Option<Line<'static>>,
pub git_branch: Option<String>,
pub cached_header_line: Option<Line<'static>>,
pub cached_footer_line: Option<Line<'static>>,
pub update_check_hint: Option<String>,
pub terminal_tool_calls: Vec<(String, usize, usize)>,
pub needs_redraw: bool,
pub perf: Option<PerfLogger>,
pub fps_ema: Option<f32>,
pub last_frame_at: Option<Instant>,
}Fields§
§messages: Vec<ChatMessage>§viewport: ChatViewportSingle owner of all chat layout state: scroll, per-message heights, prefix sums.
input: InputState§status: AppStatus§should_quit: bool§session_id: Option<SessionId>§conn: Option<Rc<ClientSideConnection>>ACP connection handle. None while connecting (before adapter is ready).
adapter_child: Option<Child>Adapter child process handle. Held solely to keep the process alive –
dropping Child kills the subprocess. Never read after being stored.
model_name: String§cwd: String§cwd_raw: String§files_accessed: usize§mode: Option<ModeState>§login_hint: Option<LoginHint>Login hint shown when authentication is required. Rendered above the input field.
pending_compact_clear: boolWhen true, the current/next turn completion should clear local conversation history.
Set by /compact once the command is accepted for ACP forwarding.
help_view: HelpViewActive help overlay view when ? help is open.
pending_permission_ids: Vec<String>Tool call IDs with pending permission prompts, ordered by arrival. The first entry is the “focused” permission that receives keyboard input. Up / Down arrow keys cycle focus through the list.
cancelled_turn_pending_hint: boolSet when a cancel notification succeeds; consumed on TurnComplete
to render a red interruption hint in chat.
event_tx: UnboundedSender<ClientEvent>§event_rx: UnboundedReceiver<ClientEvent>§spinner_frame: usize§tools_collapsed: boolSession-level default for tool call collapsed state. Toggled by Ctrl+O - new tool calls inherit this value.
active_task_ids: HashSet<String>IDs of Task tool calls currently InProgress – their children get hidden.
Use insert_active_task(), remove_active_task().
terminals: TerminalMapShared terminal process map - used to snapshot output on completion.
force_redraw: boolForce a full terminal clear on next render frame.
tool_call_index: HashMap<String, (usize, usize)>O(1) lookup: tool_call_id -> (message_index, block_index).
Use lookup_tool_call(), index_tool_call().
todos: Vec<TodoItem>Current todo list from Claude’s TodoWrite tool calls.
show_header: boolWhether the header bar is visible. Toggled by Ctrl+H.
show_todo_panel: boolWhether the todo panel is expanded (true) or shows compact status line (false). Toggled by Ctrl+T.
todo_scroll: usizeScroll offset for the expanded todo panel (capped at 5 visible lines).
todo_selected: usizeSelected todo index used for keyboard navigation in the open todo panel.
focus: FocusManagerFocus manager for directional/navigation key ownership.
available_commands: Vec<AvailableCommand>Commands advertised by the agent via AvailableCommandsUpdate.
cached_frame_area: RectLast known frame area (for mouse selection mapping).
selection: Option<SelectionState>Current selection state for mouse-based selection.
scrollbar_drag: Option<ScrollbarDragState>Active scrollbar drag state while left mouse button is held on the rail.
rendered_chat_lines: Vec<String>Cached rendered chat lines for selection/copy.
rendered_chat_area: RectArea where chat content was rendered (for selection mapping).
rendered_input_lines: Vec<String>Cached rendered input lines for selection/copy.
rendered_input_area: RectArea where input content was rendered (for selection mapping).
mention: Option<MentionState>Active @ file mention autocomplete state.
slash: Option<SlashState>Active slash-command autocomplete state.
pending_submit: boolDeferred submit: set true when Enter is pressed. If another key event
arrives during the same drain cycle (paste), this is cleared and the Enter
becomes a newline. After the drain, the main loop checks: if still true,
strips the trailing newline and submits.
drain_key_count: usizeCount of key events processed in the current drain cycle. Used to detect paste: if >1 key events arrive in a single cycle, Enter is treated as a newline rather than submit.
paste_burst: PasteBurstDetectorTiming-based paste burst detector. Tracks rapid key events to distinguish
paste from typing when Event::Paste is not available (Windows).
pending_paste_text: StringBuffered Event::Paste payload for this drain cycle.
Some terminals split one clipboard paste into multiple chunks; we merge
them and apply placeholder threshold to the merged content once per cycle.
file_cache: Option<Vec<FileCandidate>>Cached file list from cwd (scanned on first @ trigger).
cached_todo_compact: Option<Line<'static>>Cached todo compact line (invalidated on set_todos()).
git_branch: Option<String>Current git branch (refreshed on focus gain + turn complete).
cached_header_line: Option<Line<'static>>Cached header line (invalidated when git branch changes).
Cached footer line (invalidated on mode change).
update_check_hint: Option<String>Optional startup update-check hint rendered at the footer’s right edge.
terminal_tool_calls: Vec<(String, usize, usize)>Indexed terminal tool calls: (terminal_id, msg_idx, block_idx).
Avoids O(n*m) scan of all messages/blocks every frame.
needs_redraw: boolDirty flag: skip terminal.draw() when nothing changed since last frame.
perf: Option<PerfLogger>Performance logger. Present only when built with --features perf.
Taken out (Option::take) during render, used, then put back to avoid
borrow conflicts with &mut App.
fps_ema: Option<f32>Smoothed frames-per-second (EMA of presented frame cadence).
last_frame_at: Option<Instant>Timestamp of the previous presented frame.
Implementations§
Source§impl App
impl App
Sourcepub fn mark_frame_presented(&mut self, now: Instant)
pub fn mark_frame_presented(&mut self, now: Instant)
Mark one presented frame at now, updating smoothed FPS.
pub fn frame_fps(&self) -> Option<f32>
Sourcepub fn ensure_welcome_message(&mut self)
pub fn ensure_welcome_message(&mut self)
Ensure the synthetic welcome message exists at index 0.
Sourcepub fn update_welcome_model_if_pristine(&mut self)
pub fn update_welcome_model_if_pristine(&mut self)
Update the welcome message’s model name, but only before chat starts.
Sourcepub fn insert_active_task(&mut self, id: String)
pub fn insert_active_task(&mut self, id: String)
Track a Task tool call as active (in-progress subagent).
Sourcepub fn remove_active_task(&mut self, id: &str)
pub fn remove_active_task(&mut self, id: &str)
Remove a Task tool call from the active set (completed/failed).
Sourcepub fn lookup_tool_call(&self, id: &str) -> Option<(usize, usize)>
pub fn lookup_tool_call(&self, id: &str) -> Option<(usize, usize)>
Look up the (message_index, block_index) for a tool call ID.
Sourcepub fn index_tool_call(&mut self, id: String, msg_idx: usize, block_idx: usize)
pub fn index_tool_call(&mut self, id: String, msg_idx: usize, block_idx: usize)
Register a tool call’s position in the message/block arrays.
Sourcepub fn mark_message_layout_dirty(&mut self, msg_idx: usize)
pub fn mark_message_layout_dirty(&mut self, msg_idx: usize)
Mark message layout caches dirty from msg_idx onward.
Non-tail changes invalidate prefix-sum fast path so a full rebuild happens once.
Sourcepub fn mark_all_message_layout_dirty(&mut self)
pub fn mark_all_message_layout_dirty(&mut self)
Mark all message layout caches dirty.
Sourcepub fn finalize_in_progress_tool_calls(
&mut self,
new_status: ToolCallStatus,
) -> usize
pub fn finalize_in_progress_tool_calls( &mut self, new_status: ToolCallStatus, ) -> usize
Force-finish any lingering in-progress tool calls. Returns the number of tool calls that were transitioned.
Sourcepub fn refresh_git_branch(&mut self)
pub fn refresh_git_branch(&mut self)
Detect the current git branch and invalidate the header cache if it changed.
Sourcepub fn focus_owner(&self) -> FocusOwner
pub fn focus_owner(&self) -> FocusOwner
Resolve the effective focus owner for Up/Down and other directional keys.
pub fn is_help_active(&self) -> bool
Sourcepub fn claim_focus_target(&mut self, target: FocusTarget)
pub fn claim_focus_target(&mut self, target: FocusTarget)
Claim key routing for a navigation target. The latest claimant wins.
Sourcepub fn release_focus_target(&mut self, target: FocusTarget)
pub fn release_focus_target(&mut self, target: FocusTarget)
Release key routing claim for a navigation target.
Sourcepub fn normalize_focus_stack(&mut self)
pub fn normalize_focus_stack(&mut self)
Drop claims that are no longer valid for current state.
Auto Trait Implementations§
impl !Freeze for App
impl !RefUnwindSafe for App
impl !Send for App
impl !Sync for App
impl Unpin for App
impl UnsafeUnpin for App
impl !UnwindSafe for App
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 more