pub struct HeightIndex { /* private fields */ }Expand description
Chunked prefix-sum index over row heights.
Implementations§
Source§impl HeightIndex
impl HeightIndex
pub fn new() -> HeightIndex
pub fn is_empty(&self) -> bool
Sourcepub fn total_height(&mut self) -> u64
pub fn total_height(&mut self) -> u64
Total height of every row, in pixels.
Sourcepub fn is_measured(&self, row: usize) -> bool
pub fn is_measured(&self, row: usize) -> bool
Whether row row’s height came from a real layout pass.
Sourcepub fn unmeasured_count(&self) -> usize
pub fn unmeasured_count(&self) -> usize
How many rows still carry an estimated height.
The view uses this to decide whether an idle-time measure backfill is worth scheduling.
Sourcepub fn push_front(&mut self, height: u32, measured: bool)
pub fn push_front(&mut self, height: u32, measured: bool)
Prepend a row — the chat-history backfill path.
Sourcepub fn insert(&mut self, row: usize, height: u32, measured: bool)
pub fn insert(&mut self, row: usize, height: u32, measured: bool)
Insert at an arbitrary row position.
Used by the Load-Older path, which inserts before a saved divider that is generally not at the front (server notices precede it, live messages follow it). O(chunk length) rather than O(n): only the containing chunk shifts, and the chunk prefixes past it are marked stale rather than recomputed.
Sourcepub fn drain_front(&mut self, n: usize)
pub fn drain_front(&mut self, n: usize)
Drop the first n rows — the scrollback trim.
Sourcepub fn set_height(&mut self, row: usize, height: u32, measured: bool)
pub fn set_height(&mut self, row: usize, height: u32, measured: bool)
Replace a row’s height, e.g. when a real layout pass supersedes an estimate or an image texture finally lands.
Sourcepub fn invalidate_all_measurements(&mut self)
pub fn invalidate_all_measurements(&mut self)
Mark every row unmeasured, keeping the current heights as estimates.
This is a width or font change. Note what it does not do: re-measure anything. The old heights stay as the estimate so the scrollbar remains plausible, and rows are re-laid-out lazily as they become visible. That is the whole reason resize is O(visible) here and O(scrollback) in xtext.