pub struct SectionIndex {
pub sections: Vec<Section>,
pub branch: String,
pub ahead: usize,
pub behind: usize,
pub bisect: Option<BisectState>,
pub in_flight: Option<InFlightOp>,
pub upstream: Option<String>,
}Fields§
§sections: Vec<Section>§branch: String§ahead: usize§behind: usize§bisect: Option<BisectState>MG.21f: the bisect in progress, if any.
Repo state rather than a section — this struct already carries
branch / ahead / behind for the same reason, and the
headerline is where lattice answers “what state is this repo
in” (it already carries REBASE IN PROGRESS). A SectionKind
would have been the wrong home: every SectionEntry variant
carries diff-bearing-file invariants — a path, a stage
operation, an expandable patch — and a bisect has none of them.
in_flight: Option<InFlightOp>MG: the multi-commit operation the repo is stopped inside —
merge, rebase, cherry-pick, revert, am — or None when idle.
Repo state like bisect, and here for the same reason: the
status buffer is where a user lands to resolve conflicts, and
without this it showed unmerged files with nothing saying WHAT
they are unmerged from or how to get out.
upstream: Option<String>The upstream ref this branch tracks (origin/main), when it has
one, for the Unmerged into <upstream> header.
Repo state like branch / ahead / behind, and here for the
same reason: it is a fact about the repository that a section
header renders, not a property of any entry.
Implementations§
Source§impl SectionIndex
impl SectionIndex
pub fn format_buffer(&self) -> String
pub fn format_buffer_styled(&self) -> (String, Vec<Vec<StyledSpan>>)
Sourcepub fn format_buffer_styled_with(
&self,
inline: impl Fn(&SectionEntry, SectionKind) -> Option<(String, String)>,
lang_registry: Option<&Arc<LangRegistry>>,
) -> (String, Vec<Vec<StyledSpan>>, Vec<(String, usize)>, Vec<Vec<RefineSpan>>)
pub fn format_buffer_styled_with( &self, inline: impl Fn(&SectionEntry, SectionKind) -> Option<(String, String)>, lang_registry: Option<&Arc<LangRegistry>>, ) -> (String, Vec<Vec<StyledSpan>>, Vec<(String, usize)>, Vec<Vec<RefineSpan>>)
MG.18d: format the buffer with each entry’s diff inlined
where inline supplies one.
A refresh replaces the whole buffer, so any expansion the user
had open dies with it — which at hunk granularity means losing
your place after every single s. Rebuilding with the
expansions is what lets the entry survive: one edit, one span
vector, no splice arithmetic against a buffer that is being
replaced underneath it, and no collapse-then-expand flicker.
inline(entry, kind) returns (key, diff_text) for an entry
that should come back expanded. The returned
Vec<(key, line_count)> is the rebuilt expansion bookkeeping —
counts are recomputed rather than carried, because staging a
hunk makes the diff shorter.
DS-fix (2026-08-12): lang_registry is what makes a refreshed
expansion look like a freshly-opened one. None degrades to the
flat classifier, the same designed degradation
hunk_syntax::diff_spans documents — a harness without the
grammar service renders the diff the way it always did.
Trait Implementations§
Source§impl Clone for SectionIndex
impl Clone for SectionIndex
Source§fn clone(&self) -> SectionIndex
fn clone(&self) -> SectionIndex
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SectionIndex
impl Debug for SectionIndex
Source§impl Default for SectionIndex
impl Default for SectionIndex
Source§fn default() -> SectionIndex
fn default() -> SectionIndex
Auto Trait Implementations§
impl Freeze for SectionIndex
impl RefUnwindSafe for SectionIndex
impl Send for SectionIndex
impl Sync for SectionIndex
impl Unpin for SectionIndex
impl UnsafeUnpin for SectionIndex
impl UnwindSafe for SectionIndex
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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