Skip to main content

AppState

Struct AppState 

Source
pub struct AppState {
Show 19 fields pub should_quit: bool, pub commits: Vec<CommitInfo>, pub selection_index: usize, pub reverse: bool, pub full_fragmap: bool, pub squashable_scope: SquashableScope, pub reference_oid: String, pub fragmap: Option<FragMap>, pub fragmap_scroll_offset: usize, pub mode: AppMode, pub detail_scroll_offset: usize, pub max_detail_scroll: usize, pub detail_h_scroll_offset: usize, pub max_detail_h_scroll: usize, pub commit_list_visible_height: usize, pub detail_visible_height: usize, pub status_message: Option<String>, pub status_is_error: bool, pub separator_offset: i16,
}
Expand description

Application state for the TUI.

Manages the overall state of the interactive terminal interface, including quit flag and commit list state.

Fields§

§should_quit: bool§commits: Vec<CommitInfo>§selection_index: usize§reverse: bool§full_fragmap: bool

Show all hunk-group columns without deduplication (–full flag).

§squashable_scope: SquashableScope

Controls what the squashable connector symbol means in the fragmap.

§reference_oid: String

The reference OID (merge-base) used when the session started. Stored here so ‘u’ update can rescan from HEAD down to the same base.

§fragmap: Option<FragMap>

Optional fragmap visualization data. None if fragmap computation failed or was not performed.

§fragmap_scroll_offset: usize

Horizontal scroll offset for the fragmap grid.

§mode: AppMode

Current display mode.

§detail_scroll_offset: usize

Vertical scroll offset for the detail view.

§max_detail_scroll: usize

Maximum vertical scroll offset for the detail view (updated during render).

§detail_h_scroll_offset: usize

Horizontal scroll offset for the detail view.

§max_detail_h_scroll: usize

Maximum horizontal scroll offset for the detail view (updated during render).

§commit_list_visible_height: usize

Visible height of the commit list area (updated during render).

§detail_visible_height: usize

Visible height of the detail view area (updated during render).

§status_message: Option<String>

Transient status message shown in the footer (cleared on next keypress).

§status_is_error: bool

Whether the current status message represents an error (red) or success (green).

§separator_offset: i16

User-controlled offset for the vertical separator bar (positive = right, negative = left).

Implementations§

Source§

impl AppState

Source

pub fn new() -> Self

Create a new AppState with default values.

Source

pub fn with_commits(commits: Vec<CommitInfo>) -> Self

Create a new AppState with the given commits, selecting the last one (HEAD).

Source

pub fn move_up(&mut self)

Move selection up (decrement index) with lower bound check. Does nothing if already at top or commits list is empty.

Source

pub fn move_down(&mut self)

Move selection down (increment index) with upper bound check. Does nothing if already at bottom or commits list is empty.

Source

pub fn scroll_fragmap_left(&mut self)

Scroll fragmap grid left.

Source

pub fn scroll_fragmap_right(&mut self)

Scroll fragmap grid right.

Source

pub fn scroll_detail_up(&mut self)

Scroll detail view up (decrease offset).

Source

pub fn scroll_detail_down(&mut self)

Scroll detail view down (increase offset).

Source

pub fn scroll_detail_left(&mut self)

Scroll detail view left (decrease horizontal offset).

Source

pub fn scroll_detail_right(&mut self)

Scroll detail view right (increase horizontal offset).

Source

pub fn page_up(&mut self, visible_height: usize)

Scroll commit list up by one page (visible_height lines).

Source

pub fn page_down(&mut self, visible_height: usize)

Scroll commit list down by one page (visible_height lines).

Source

pub fn scroll_detail_page_up(&mut self, visible_height: usize)

Scroll detail view up by one page (visible_height lines).

Source

pub fn scroll_detail_page_down(&mut self, visible_height: usize)

Scroll detail view down by one page (visible_height lines).

Source

pub fn enter_split_confirm( &mut self, strategy: SplitStrategy, commit_oid: String, head_oid: String, count: usize, )

Enter the large-split confirmation dialog.

Source

pub fn cancel_split_confirm(&mut self)

Cancel the large-split confirmation and return to CommitList.

Source

pub fn enter_drop_confirm( &mut self, commit_oid: String, commit_summary: String, head_oid: String, )

Enter the drop confirmation dialog.

Source

pub fn cancel_drop_confirm(&mut self)

Cancel the drop confirmation and return to CommitList.

Source

pub fn enter_rebase_conflict(&mut self, state: ConflictState)

Enter the rebase-conflict resolution dialog.

Source

pub fn enter_split_select(&mut self)

Enter split strategy selection mode. Only allowed for real commits (not staged/unstaged synthetic rows).

Source

pub fn enter_squash_select(&mut self)

Enter squash target selection mode. Only allowed for real commits (not staged/unstaged synthetic rows).

Source

pub fn enter_fixup_select(&mut self)

Enter fixup target selection mode (same UI as squash, keeps target msg).

Source

pub fn cancel_squash_select(&mut self)

Cancel squash selection and return to CommitList.

Source

pub fn enter_move_select(&mut self)

Enter move commit selection mode. The insertion cursor starts one position before the source (i.e. one slot earlier in the commit list, which visually means “above” in chronological order).

Source

pub fn cancel_move_select(&mut self)

Cancel move selection and return to CommitList.

Source

pub fn set_success_message(&mut self, msg: impl Into<String>)

Set a success status message (shown with green background).

Source

pub fn set_error_message(&mut self, msg: impl Into<String>)

Set an error status message (shown with red background).

Source

pub fn clear_status_message(&mut self)

Clear the transient status message.

Source

pub fn split_select_up(&mut self)

Move split strategy selection up.

Source

pub fn split_select_down(&mut self)

Move split strategy selection down.

Source

pub fn selected_split_strategy(&self) -> SplitStrategy

Get the currently selected split strategy.

Source

pub fn toggle_detail_view(&mut self)

Toggle between CommitList and CommitDetail modes.

Source

pub fn show_help(&mut self)

Show help dialog, saving current mode to return to later.

Source

pub fn close_help(&mut self)

Close help dialog and return to previous mode.

Source

pub fn toggle_help(&mut self)

Toggle help dialog on/off.

Trait Implementations§

Source§

impl Default for AppState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.