pub struct DecorationSet { /* private fields */ }Expand description
The decorations attached to a buffer.
Implementations§
Source§impl DecorationSet
impl DecorationSet
pub fn new() -> Self
pub fn push(&mut self, decoration: Decoration)
pub fn iter(&self) -> impl Iterator<Item = &Decoration>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn clear_syntax(&mut self)
pub fn clear_syntax(&mut self)
Drop every decoration a producer is about to replace.
Per class, not all-derived-at-once: a re-parse must not wipe the find results, and a new search must not wipe the highlighting. Each producer clears its own.
pub fn clear_matches(&mut self)
pub fn clear_diagnostics(&mut self)
Sourcepub fn clear_derived(&mut self)
pub fn clear_derived(&mut self)
Drop every derived decoration, leaving pending agent hunks alone.
Sourcepub fn remove_proposal(&mut self, proposal: ProposalId)
pub fn remove_proposal(&mut self, proposal: ProposalId)
Drop every hunk belonging to a proposal — it was accepted, rejected, or withdrawn.
Sourcepub fn map(&mut self, changes: &ChangeSet)
pub fn map(&mut self, changes: &ChangeSet)
Carry every decoration through an applied change.
Positions map as usual, but disturbance is handled per class, and this is where ADR-0006 §4’s policy reaches the screen:
- Derived decorations (syntax, diagnostics) whose range was disturbed are dropped. Their producer recomputes them; a half-mapped highlight is worse than none, because it colours the wrong text.
- Hunks are kept and marked
HunkState::Conflicted. A pending proposal must never vanish silently — the human is mid-review, and “your edit collided with this change” is information they need.
Sourcepub fn for_line(
&self,
line_start: usize,
line_end: usize,
) -> Vec<LineDecoration>
pub fn for_line( &self, line_start: usize, line_end: usize, ) -> Vec<LineDecoration>
The decorations overlapping line_start..line_end, clipped to it and rebased to
offsets relative to line_start.
Sorted by start so the renderer can walk them in order. Zero-width anchors are
kept — they are exactly the “text goes here” markers of HunkSide::Added.
Trait Implementations§
Source§impl Clone for DecorationSet
impl Clone for DecorationSet
Source§fn clone(&self) -> DecorationSet
fn clone(&self) -> DecorationSet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more