Struct reedline::StyledText
source · [−]Expand description
A representation of a buffer with styling, used for doing syntax highlighting
Fields
buffer: Vec<(Style, String)>
The component, styled parts of the text
Implementations
sourceimpl StyledText
impl StyledText
sourcepub fn render_around_insertion_point(
&self,
insertion_point: usize,
multiline_prompt: &str,
use_ansi_coloring: bool
) -> (String, String)
pub fn render_around_insertion_point(
&self,
insertion_point: usize,
multiline_prompt: &str,
use_ansi_coloring: bool
) -> (String, String)
Render the styled string. We use the insertion point to render around so that we can properly write out the styled string to the screen and find the correct place to put the cursor. This assumes a logic that prints the first part of the string, saves the cursor position, prints the second half, and then restores the cursor position
Also inserts the multiline continuation prompt
sourcepub fn render_simple(&self) -> String
pub fn render_simple(&self) -> String
Apply the ANSI style formatting to the full string.
sourcepub fn raw_string(&self) -> String
pub fn raw_string(&self) -> String
Get the unformatted text as a single continuous string.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for StyledText
impl Send for StyledText
impl Sync for StyledText
impl Unpin for StyledText
impl UnwindSafe for StyledText
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more