pub struct App {Show 29 fields
pub worktrees: Vec<Worktree>,
pub visible: Vec<usize>,
pub selected: usize,
pub mode: Mode,
pub filter: String,
pub focus: Pane,
pub show_sidebar: bool,
pub sidebar_width: u16,
pub sort: SortSpec,
pub detail_scroll: u16,
pub size: (u16, u16),
pub keymap: Keymap,
pub columns: Vec<Column>,
pub show_untracked: bool,
pub remove_untracked_blocks: bool,
pub nerd_fonts: bool,
pub mouse: bool,
pub color: bool,
pub palette: Palette,
pub quit: bool,
pub chosen: Option<PathBuf>,
pub status_message: Option<String>,
pub status_kind: StatusKind,
pub too_small: bool,
pub jobs: Vec<ActiveJob>,
pub spinner_frame: usize,
pub pending_jobs: Vec<Effect>,
pub branches: Vec<String>,
pub default_base: Option<String>,
/* private fields */
}Expand description
The TUI application state.
Fields§
§worktrees: Vec<Worktree>All worktrees (sorted).
visible: Vec<usize>Indices into worktrees currently visible (after filtering).
selected: usizeSelected index into visible.
mode: ModeThe current mode.
filter: StringThe active filter string.
focus: PaneWhich pane has focus.
Whether the list (sidebar) pane is shown.
The list pane width.
sort: SortSpecThe current sort.
detail_scroll: u16Scroll offset of the detail pane.
size: (u16, u16)Terminal size (cols, rows).
keymap: KeymapThe key bindings.
columns: Vec<Column>Columns to render in the list.
show_untracked: boolWhether untracked files show ?.
remove_untracked_blocks: boolWhether untracked-only files count as “dirty” for the remove guard
(the confirm dialog mirrors remove.untracked_blocks, not show_untracked).
nerd_fonts: boolWhether Nerd Font glyphs are enabled.
mouse: boolWhether mouse support is enabled.
color: boolWhether color output is enabled (spec §11 precedence, resolved once).
palette: PaletteThe resolved color palette (preset + [ui.theme] overrides).
quit: boolSet when the user quits without switching.
chosen: Option<PathBuf>Set to the chosen path when the user switches (Enter).
status_message: Option<String>A transient status/error line shown in the status bar.
status_kind: StatusKindThe severity of status_message, used to color it.
too_small: boolSet when the terminal became too small to continue (spec §10).
jobs: Vec<ActiveJob>The in-flight background actions (issue #46 overhaul): each runs on its own task and shows a per-row spinner; input is never gated. Empty when idle.
spinner_frame: usizeThe shared spinner animation frame, advanced on each tick while any job is in flight; every per-row job spinner reads it so they animate in sync.
pending_jobs: Vec<Effect>Follow-up background actions queued by a just-applied job outcome (e.g. a
created worktree with uninitialized submodules under the always policy),
drained by the event loop after apply_outcome and spawned as their own
jobs. Kept off the render path.
branches: Vec<String>Local + remote-tracking branch names offered in the create-prompt options dropdown and used to tab-complete the base ref (best-effort; empty when enumeration fails).
default_base: Option<String>The remote-tracking default branch (e.g. origin/main) a new worktree
forks from by default, pre-filled into the create-prompt base field
(issue #70). None when there is no confident remote default (no
origin/HEAD), in which case the base starts empty.
Implementations§
Source§impl App
impl App
Sourcepub fn new(worktrees: Vec<Worktree>, config: AppConfig, size: (u16, u16)) -> App
pub fn new(worktrees: Vec<Worktree>, config: AppConfig, size: (u16, u16)) -> App
Builds an app over the given worktrees, selecting the current one. All rows start marked loaded; the runtime marks them loading before async enrichment.
Sourcepub fn set_status(&mut self, message: impl Into<String>, kind: StatusKind)
pub fn set_status(&mut self, message: impl Into<String>, kind: StatusKind)
Sets the transient status-bar message and its severity (for coloring).
Sourcepub fn begin_job(&mut self, key: JobKey, label: impl Into<String>)
pub fn begin_job(&mut self, key: JobKey, label: impl Into<String>)
Registers a background job on key with a display label (issue #46
overhaul). If a job already targets key it is replaced (the caller
guards against conflicts first via App::has_job).
Sourcepub fn finish_job(&mut self, key: &JobKey)
pub fn finish_job(&mut self, key: &JobKey)
Removes the job targeting key once it completes; a no-op if absent.
Sourcepub fn has_job(&self, key: &JobKey) -> bool
pub fn has_job(&self, key: &JobKey) -> bool
Whether a background job already targets key (used to refuse a second,
conflicting action on the same row).
Sourcepub fn job_for(&self, worktree: &Worktree) -> Option<&ActiveJob>
pub fn job_for(&self, worktree: &Worktree) -> Option<&ActiveJob>
The active job attached to worktree’s row, if any, so the list can render
its per-row spinner and label. Matches a Path job by path and a Branch
job by the branch-row’s name; New jobs attach to no row.
Sourcepub fn tick_spinner(&mut self)
pub fn tick_spinner(&mut self)
Advances the shared spinner one frame (called on each animation tick); a no-op when no job is in flight.
Sourcepub fn any_jobs(&self) -> bool
pub fn any_jobs(&self) -> bool
Whether any background job is in flight (keeps the animation ticker awake).
Sourcepub fn job_summary(&self) -> Option<String>
pub fn job_summary(&self) -> Option<String>
A compact status-bar summary of the in-flight jobs — the count and the
first job’s label — so background work stays visible even when its row is
scrolled off. None when idle.
Sourcepub fn may_apply_mode(&self, home: JobHome) -> bool
pub fn may_apply_mode(&self, home: JobHome) -> bool
Whether a finished job in home context may drive a mode change without
clobbering an unrelated modal the user opened while it ran (issue #46
overhaul): true when the user is idle or still in the job’s own modal.
Sourcepub fn queue_job(&mut self, effect: Effect)
pub fn queue_job(&mut self, effect: Effect)
Queues a follow-up background action for the loop to spawn after the current outcome is applied (e.g. submodule init after a create).
Sourcepub fn take_pending_jobs(&mut self) -> Vec<Effect>
pub fn take_pending_jobs(&mut self) -> Vec<Effect>
Drains the queued follow-up actions (issue #46 overhaul).
Sourcepub fn selected_worktree(&self) -> Option<&Worktree>
pub fn selected_worktree(&self) -> Option<&Worktree>
The currently selected worktree, if any.
Sourcepub fn is_loaded(&self, worktree: &Worktree) -> bool
pub fn is_loaded(&self, worktree: &Worktree) -> bool
Whether a worktree’s async fields have loaded (else it shows a spinner).
Sourcepub fn mark_loading(&mut self)
pub fn mark_loading(&mut self)
Marks all rows as loading (clears the loaded set), for the initial render.
Sourcepub fn mark_loaded(&mut self, path: PathBuf)
pub fn mark_loaded(&mut self, path: PathBuf)
Marks a worktree’s path as loaded.
Sourcepub fn detail_visible(&self) -> bool
pub fn detail_visible(&self) -> bool
Whether the detail pane is visible at the current size.
Sourcepub fn set_worktrees(&mut self, worktrees: Vec<Worktree>)
pub fn set_worktrees(&mut self, worktrees: Vec<Worktree>)
Replaces the worktrees (e.g. after a refresh), preserving the selection by path and re-applying the sort and filter.
Sourcepub fn move_selection(&mut self, delta: isize)
pub fn move_selection(&mut self, delta: isize)
Moves the selection by delta, clamped to the visible range. Changing
the selection resets the detail-pane scroll.
Sourcepub fn select_edge(&mut self, last: bool)
pub fn select_edge(&mut self, last: bool)
Selects the first / last visible row.
Sourcepub fn select_row(&mut self, row: usize)
pub fn select_row(&mut self, row: usize)
Selects the visible row at display position row, if any.
Sourcepub fn scroll_detail(&mut self, delta: isize)
pub fn scroll_detail(&mut self, delta: isize)
Scrolls the detail pane by delta lines (spec §10), clamped to roughly
the selected worktree’s detail content so it cannot scroll into the void.
Sourcepub fn cycle_sort(&mut self)
pub fn cycle_sort(&mut self)
Cycles the sort field (spec §10 sort-cycle).
Sourcepub fn reverse_sort(&mut self)
pub fn reverse_sort(&mut self)
Toggles the sort direction (spec §10 sort-reverse).
Sourcepub fn filter_push(&mut self, c: char)
pub fn filter_push(&mut self, c: char)
Appends a character to the filter and recomputes the visible set.
Sourcepub fn filter_pop(&mut self)
pub fn filter_pop(&mut self)
Removes the last filter character.
Sourcepub fn clear_filter(&mut self)
pub fn clear_filter(&mut self)
Clears the filter.
Sourcepub fn select_path(&mut self, path: &Path)
pub fn select_path(&mut self, path: &Path)
Selects the visible row whose worktree path matches path.
Sourcepub fn select_branch(&mut self, branch: &str) -> bool
pub fn select_branch(&mut self, branch: &str) -> bool
Selects the visible row for the real worktree on branch, if present.
Returns whether a matching visible row was found — false when the row is
filtered out or absent, leaving the selection unchanged. Used to focus a
freshly created worktree (issue #52).
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