pub struct App {Show 28 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 exit_on_pr_checkout: bool,
pub status_message: Option<String>,
pub status_kind: StatusKind,
pub too_small: bool,
pub busy: Option<BusyState>,
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).
exit_on_pr_checkout: boolWhen set, checking out a PR sets chosen and exits the loop (switching
into the new worktree) instead of returning to the list. Used by the
wt pr no-argument picker entry; the p-key picker leaves it false.
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).
busy: Option<BusyState>An in-flight background action (issue #46): Some while a shell-based
action runs on a background task, driving the spinner overlay and gating
input. None when idle.
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_busy(&mut self, label: impl Into<String>)
pub fn begin_busy(&mut self, label: impl Into<String>)
Marks a background action in flight with the given label (issue #46), resetting the spinner to its first frame.
Sourcepub fn tick_busy(&mut self)
pub fn tick_busy(&mut self)
Advances the busy spinner one frame (called on each animation tick); a no-op when no action is in flight.
Sourcepub fn is_busy(&self) -> bool
pub fn is_busy(&self) -> bool
Whether a background action is in flight (input is gated while set).
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_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