pub struct ConcealedLine {
pub display_text: String,
pub spans: Vec<StyleSpan>,
/* private fields */
}Expand description
A rendered visual line where concealed syntax tokens have been collapsed, maintaining exact bidirectional mapping to source buffer byte offsets.
Fields§
§display_text: StringThe transformed text to be shaped and rendered on screen.
spans: Vec<StyleSpan>Syntax highlight spans adjusted to display text coordinates.
Implementations§
Source§impl ConcealedLine
impl ConcealedLine
Sourcepub fn build(line_text: &str, spans: &[StyleSpan]) -> Self
pub fn build(line_text: &str, spans: &[StyleSpan]) -> Self
Constructs a concealed line from raw line text and syntax spans.
Sourcepub fn expanded(&self, pads: &[DisplayPad]) -> Self
pub fn expanded(&self, pads: &[DisplayPad]) -> Self
Returns a copy of this line with display-only padding spliced in.
pads are applied in ascending display_at order against the
original collapsed coordinates. Span boundaries at or after an
insertion point shift right, so inserted padding belongs to the span
ending there. Each padding byte maps back to the source offset of the
display byte it was inserted before.
Sourcepub fn display_to_source(&self, display_col: usize) -> usize
pub fn display_to_source(&self, display_col: usize) -> usize
Converts a display byte offset to a source buffer line byte offset.
Sourcepub fn source_to_display(&self, source_col: usize) -> usize
pub fn source_to_display(&self, source_col: usize) -> usize
Converts a source buffer line byte offset to the nearest display byte offset.
Trait Implementations§
Source§impl Clone for ConcealedLine
impl Clone for ConcealedLine
Source§fn clone(&self) -> ConcealedLine
fn clone(&self) -> ConcealedLine
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more