pub struct StickyContext {
pub rows: Vec<StickyContextRow>,
pub version: MatrixVersion,
pub bg: Option<u32>,
pub line_numbers: bool,
pub line_number_fg: Option<u32>,
pub active_bg: Option<u32>,
pub has_separator: bool,
}Expand description
The pane’s pinned context strip, outermost scope first.
Empty is the overwhelmingly common case — no context plugin loaded, or
nothing enclosing the cursor has scrolled away — and it is represented as an
empty rows rather than an Option so both renderers can iterate
unconditionally.
Fields§
§rows: Vec<StickyContextRow>Outermost first: the row nearest the text is the nearest enclosing scope, so the strip reads as a continuation of the code.
version: MatrixVersionThe build’s version stamp — the same MatrixVersion the pane’s
DisplayMatrix carries, so a renderer can tell the two came from one
build.
bg: Option<u32>Resolved backdrop (0xRRGGBB) from the sticky.context.background
theme element, or None when the theme leaves it unset.
Resolved once here rather than per row in each renderer: the strip is host chrome — the host builds, reserves and paints it — so the host owns its styling, while the plugin owns only the scopes. Without a backdrop the strip is the same colour as the code beneath it and reads as ordinary text that will not scroll, which is what prompted this.
line_numbers: boolTC.8: whether the rows show their source line number in the gutter
(context.line-numbers).
Resolved here, alongside the backdrop, for the same reason: the strip
is host chrome, so the host owns its presentation and neither renderer
reads a plugin option. Both peers then reduce to one expression —
line_numbers.then_some(row.source_line) — which is hard to get
differently wrong in two places.
line_number_fg: Option<u32>TC.11: resolved sticky.context.line_number foreground, or None when
the theme leaves it unset (the renderer then uses its default gutter
colour, as it does for document rows).
active_bg: Option<u32>TC.11: resolved sticky.context.active backdrop for the INNERMOST row
— the scope the cursor is actually in.
Rows are outermost-first, so this applies to the last one. It is the line the reader is looking for; giving it the same backdrop as its ancestors makes a deep strip read as an undifferentiated block.
has_separator: boolTC.12: whether the LAST row is a separator rule rather than a scope.
The rule is built as a real row, not carried as a glyph for renderers
to append, so that it is counted by len() — which is what the scroll
model reserves from. A separator drawn outside the row list would be
one row the reservation did not know about, and the text under it would
sit one line too high.
Implementations§
Source§impl StickyContext
impl StickyContext
Trait Implementations§
Source§impl Clone for StickyContext
impl Clone for StickyContext
Source§fn clone(&self) -> StickyContext
fn clone(&self) -> StickyContext
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 StickyContext
impl Debug for StickyContext
Source§impl Default for StickyContext
impl Default for StickyContext
Source§fn default() -> StickyContext
fn default() -> StickyContext
Auto Trait Implementations§
impl Freeze for StickyContext
impl RefUnwindSafe for StickyContext
impl Send for StickyContext
impl Sync for StickyContext
impl Unpin for StickyContext
impl UnsafeUnpin for StickyContext
impl UnwindSafe for StickyContext
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§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