Skip to main content

StatusView

Struct StatusView 

Source
pub struct StatusView(pub Arc<Mutex<StatusBufferState>>);
Expand description

The status buffer’s MagitView — supplies gr’s body for buffers magit-status-mode owns.

Tuple Fields§

§0: Arc<Mutex<StatusBufferState>>

Trait Implementations§

Source§

impl MagitView for StatusView

Source§

fn visit_at_cursor(&self, cursor: Position) -> Option<Effect>

MG.22: magit-status’s <CR> — the reason visit_at_cursor exists on the trait at all.

magit-hunk-mode owns the chord now, but here it must keep resolving rows that are not diff content: a staged file opens its index blob, an unstaged one the live file, a stash toggles its inline patch, a commit opens its buffer. Returning None for anything classify_line does not recognise is what lets the caller fall through to diff-path resolution — and what keeps it from resolving a row against a previous entry’s expanded diff.

Source§

fn commit_at_cursor(&self, cursor: Position) -> Option<String>

MG.20: the commit on the Recent-commits row under the cursor. File and stash rows correctly yield None, so V on a staged file does nothing rather than reverting an unrelated commit.

Source§

fn stash_at_cursor(&self, cursor: Position) -> Option<usize>

The stash on the Stashes row under the cursor.

magit-status renders these with the SAME " stash@{N} msg" row magit-stash-mode’s list uses (sections.rs and magit_stash_mode::list_row), so both views share one parser rather than growing a second idea of the format. File and commit rows fail the stash@{ prefix and correctly yield None, so p on a staged file pops nothing.

Source§

fn diff_target(&self, path: &Path, cursor: Position) -> Option<Effect>

MG.18c: the section an inline diff was expanded under says which tree it was diffed against — run_show passes --cached for a Staged entry and nothing for an Unstaged one, so the header the diff sits below is the same fact, already on screen.

Stashes and commits expand patches too, and those belong to neither the index nor the worktree; None refuses hunk staging there rather than applying a commit’s diff to the index. MG.50: <CR> inside an inline diff.

This was the one view with no answer — <CR> in a magit-status hunk fell to the trait default and did nothing at all, while the same key in magit-diff or a revision opened the file.

Which version to open is the SECTION’s question, not the buffer’s: a status buffer holds staged and unstaged diffs at once, and they describe different content. diff_source already answers it from the header above the cursor — the same seam s / u / x use to decide which tree a hunk applies to, so the version <CR> shows and the tree a hunk stages to can never disagree.

Source§

fn refresh_restoring(&self, site: HunkSite) -> Option<Effect>

MG.18d: queue the restore, then refresh. The refresh consumes it once it holds the rebuilt text — see [refresh_context].

Source§

fn stage(&self, cursor: Position) -> Option<Effect>

s — stage the file on the status entry line at cursor.

Source§

fn stage_rows(&self, rows: RangeInclusive<u32>) -> Option<Effect>

Every distinct file the selected rows cover, staged in ONE task with ONE refresh.

Distinct because a file entry and its expanded inline diff are separate rows of the same file — a selection over both must not stage it twice — and because the same path can appear in both the staged and unstaged sections.

Source§

fn workdir(&self) -> Option<PathBuf>

The workdir this view’s repository lives in — needed to run an operation against it from a handler that holds only the view.
Source§

fn diff_source(&self, cursor: Position) -> Option<DiffSource>

MG.18c: which diff the text at cursor came from. Read more
Source§

fn refresh(&self) -> Option<Effect>

gr — rebuild this view’s content in place.
Source§

fn unstage_rows(&self, rows: RangeInclusive<u32>) -> Option<Effect>

u in Visual mode. Peer of Self::stage_rows.
Source§

fn unstage(&self, cursor: Position) -> Option<Effect>

u — unstage the entry at cursor. Peer of Self::stage.
Source§

fn file_lines( &self, store: &BufferStoreHandle, buffer: BufferId, ) -> Option<Vec<u32>>

The rows ]f / [f treat as “a file”, when this view’s answer differs from magit-status’s. Read more
Source§

fn argument_flags(&self) -> &'static [RemoteFlag]

MG.23k: the git arguments this view can be re-run with — the rows D offers. Read more
Source§

fn refresh_with_args(&self, extra: Vec<String>) -> Option<Effect>

Re-run this view with extra appended to its git invocation. 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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more