Skip to main content

is_self_contained

Function is_self_contained 

Source
pub fn is_self_contained(line: &str) -> bool
Expand description

True when line leaves no colour or attribute switched on at its end.

Every line returned by the renderers satisfies this, which is what lets lines be printed, indented or boxed independently of each other.

use shellgame::ui::text::is_self_contained;

assert!(is_self_contained("\x1b[1mbold\x1b[0m and plain"));
assert!(!is_self_contained("\x1b[1mbold"));