pub struct Line {
pub content: String,
pub display_widths: Vec<u8>,
pub styles: Vec<StyledSpan>,
}Expand description
A single line of terminal output.
Fields§
§content: StringPlain text content (ANSI stripped).
display_widths: Vec<u8>Display width of each character (0, 1, or 2 for wide chars).
styles: Vec<StyledSpan>Style spans for colored rendering.
Implementations§
Source§impl Line
impl Line
Sourcepub fn display_width(&self) -> usize
pub fn display_width(&self) -> usize
Total display width of this line.
Sourcepub fn char_count(&self) -> usize
pub fn char_count(&self) -> usize
Number of characters in this line.
Sourcepub fn char_index_for_display_col(&self, target_col: usize) -> usize
pub fn char_index_for_display_col(&self, target_col: usize) -> usize
Convert a display column to the corresponding character index.
Sourcepub fn display_col_for_char_index(&self, char_idx: usize) -> usize
pub fn display_col_for_char_index(&self, char_idx: usize) -> usize
Convert a character index to its starting display column.
Sourcepub fn extract_by_display_cols(
&self,
col_start: usize,
col_end: usize,
) -> String
pub fn extract_by_display_cols( &self, col_start: usize, col_end: usize, ) -> String
Extract a substring by display column range [col_start, col_end). Returns the extracted string. Short lines return what’s available.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Line
impl RefUnwindSafe for Line
impl Send for Line
impl Sync for Line
impl Unpin for Line
impl UnsafeUnpin for Line
impl UnwindSafe for Line
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
Mutably borrows from an owned value. Read more