Skip to main content

ScmPanel

Struct ScmPanel 

Source
pub struct ScmPanel {
Show 22 fields pub open: bool, pub message: String, pub focus: ScmFocus, pub selected: usize, pub staged: Vec<ScmEntry>, pub changes: Vec<ScmEntry>, pub branch: String, pub ahead: u32, pub behind: u32, pub graph: Vec<GraphRow>, pub graph_selected: usize, pub graph_limit: usize, pub root: Option<PathBuf>, pub error: Option<String>, pub last_result: Option<String>, pub opened_at: Option<Instant>, pub anim_pending: bool, pub anim_from: f32, pub anim_to: f32, pub closing: bool, pub just_closed: bool, pub graph_pending: bool,
}

Fields§

§open: bool§message: String§focus: ScmFocus§selected: usize

Selected index in the flattened changes list (staged first, then unstaged)

§staged: Vec<ScmEntry>§changes: Vec<ScmEntry>§branch: String§ahead: u32§behind: u32§graph: Vec<GraphRow>

Pretty commit graph rows (newest first)

§graph_selected: usize

Selected commit in the graph (when focus is Graph)

§graph_limit: usize

How many commits to request from git log (grows with load-more)

§root: Option<PathBuf>§error: Option<String>§last_result: Option<String>§opened_at: Option<Instant>

Animation clock — armed on open/close, started by the first render so synchronous git status / git log refresh can’t eat the window.

§anim_pending: bool§anim_from: f32

Openness at phase start / end (0 = off-screen, 1 = fully visible).

§anim_to: f32§closing: bool

True while a close animation is playing (open stays true until done).

§just_closed: bool

Set for one frame when the close animation settles (app clears mode).

§graph_pending: bool

Defer expensive graph layout until first paint (open feels instant).

Implementations§

Source§

impl ScmPanel

Source

pub fn new() -> Self

Source

pub fn visible(&self) -> bool

True while the panel should be painted (open or mid close-anim).

Source

pub fn is_animating(&self) -> bool

Source

pub fn close_immediate(&mut self)

Instant hide (no animation) — used when switching to another overlay.

Source

pub fn close(&mut self)

Start slide-out close. Keeps open until the animation finishes.

Source

pub fn open_and_refresh(&mut self, hint_path: Option<&Path>)

Open and refresh against repo containing hint_path (or cwd).

Source

pub fn refresh_status(&mut self, hint_path: Option<&Path>)

Status/branch/changes only — no git log / graph layout.

Source

pub fn ensure_graph(&mut self)

Load graph if deferred (call from UI once per open).

Source

pub fn anim_progress(&mut self) -> f32

Linear openness 0.0..=1.0 (0 = off-screen, 1 = fully shown). Easing is applied in the UI. First call after arming starts the clock.

Source

pub fn take_just_closed(&mut self) -> bool

Returns true once when a close animation has settled.

Source

pub fn total_files(&self) -> usize

Source

pub fn entry_at(&self, idx: usize) -> Option<&ScmEntry>

Source

pub fn clamp_selected(&mut self)

Source

pub fn move_sel(&mut self, delta: isize)

Source

pub fn refresh(&mut self, hint_path: Option<&Path>)

Source

pub fn load_more_graph(&mut self) -> Result<usize, String>

Fetch more history (double limit, capped). Call while graph is focused.

Source

pub fn move_graph_sel(&mut self, delta: isize)

Source

pub fn selected_graph_row(&self) -> Option<&GraphRow>

Source

pub fn stage_selected(&mut self) -> Result<(), String>

Stage the selected file (or all unstaged if none selected / with all).

Source

pub fn stage_all(&mut self) -> Result<(), String>

Source

pub fn unstage_all(&mut self) -> Result<(), String>

Source

pub fn discard_selected(&mut self) -> Result<(), String>

Source

pub fn commit(&mut self, amend: bool) -> Result<(), String>

Commit staged changes with current message. If nothing staged, stage all first (VS Code default often requires staged; we match VS Code “Commit” on staged only unless message + commit all shortcut).

Source

pub fn cycle_focus(&mut self, forward: bool)

Source§

impl ScmPanel

Source

pub fn refresh_entries_from_status(&mut self, porcelain: &str)

Trait Implementations§

Source§

impl Clone for ScmPanel

Source§

fn clone(&self) -> ScmPanel

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ScmPanel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ScmPanel

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.