pub struct RowWeights { /* private fields */ }Expand description
Per-source-line vertical cost overrides, in line-heights.
Absent line ⇒ the line costs its display-row count, unchanged.
Implementations§
Source§impl RowWeights
impl RowWeights
Sourcepub fn uniform() -> Self
pub fn uniform() -> Self
The uniform map: every line costs its display-row count. What the TUI publishes, always, and what GPUI publishes for a buffer with no scaled or media rows.
Sourcepub fn is_uniform(&self) -> bool
pub fn is_uniform(&self) -> bool
True when nothing overrides the default. Callers use it to keep the common path free of float work entirely.
Sourcepub fn set(&mut self, line: u32, line_heights: f32)
pub fn set(&mut self, line: u32, line_heights: f32)
Declare that line’s display rows together occupy line_heights.
Non-finite and negative values are ignored rather than stored: a bad weight would poison a scroll budget and wedge the viewport, and a silently-uniform line is a far better failure than a stuck buffer.
Sourcepub fn cost(&self, line: u32, default_rows: u32) -> f32
pub fn cost(&self, line: u32, default_rows: u32) -> f32
The vertical cost of line, given the display-row count the caller
already computed (wrap segments + virtual rows).
Returns exactly default_rows as f32 when unoverridden, which is what
makes the uniform case bit-identical to the integer arithmetic this
replaced.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
True when no line carries an override — the alias of
is_uniform that clippy expects beside len.
Trait Implementations§
Source§impl Clone for RowWeights
impl Clone for RowWeights
Source§fn clone(&self) -> RowWeights
fn clone(&self) -> RowWeights
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more