Skip to content

Commit

Permalink
Add TextView::cursup
Browse files Browse the repository at this point in the history
  • Loading branch information
gyscos committed Jun 22, 2024
1 parent 282420f commit 29a5186
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cursive-core/src/views/text_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,22 @@ impl TextView {
Self::new_with_content(TextContent::new(content))
}

/// Convenient function to create a TextView by parsing the given content as cursup.
///
/// Shortcut for `TextView::new(cursup::parse(content))`.
///
/// # Examples
///
/// ```
/// # use cursive_core::views::TextView;
/// let view = TextView::cursup("/red+bold{warning}");
/// ```
pub fn cursup<S>(content: S) -> Self
where S: Into<String>,
{
Self::new(crate::utils::markup::cursup::parse(content))
}

/// Creates a new TextView using the given `TextContent`.
///
/// If you kept a clone of the given content, you'll be able to update it
Expand Down

0 comments on commit 29a5186

Please sign in to comment.