diff --git a/cursive-core/src/utils/markup/cursup.rs b/cursive-core/src/utils/markup/cursup.rs index ae526ab2..7b0cfead 100644 --- a/cursive-core/src/utils/markup/cursup.rs +++ b/cursive-core/src/utils/markup/cursup.rs @@ -66,7 +66,10 @@ pub fn parse_spans(input: &str) -> Vec { } (State::Plain, _) => (), - (State::Slash(_), b'a'..=b'z' | b'A'..=b'Z' | b'0'..=b'9' | b'#' | b'+' | b'.') => (), + ( + State::Slash(_), + b'a'..=b'z' | b'A'..=b'Z' | b'0'..=b'9' | b'#' | b'+' | b'.' | b'_', + ) => (), (State::Slash(slash), b'{') => { // Add a candidate. candidates.push(Candidate { @@ -158,7 +161,7 @@ where #[cfg(test)] mod tests { - use crate::theme::{BaseColor, Color, Effect, Style}; + use crate::theme::{BaseColor, Color, ColorType, Effect, Style}; use crate::utils::markup::cursup::parse; use crate::utils::markup::StyledString; use crate::utils::span::Span; @@ -238,6 +241,20 @@ mod tests { ); } + #[test] + fn inherit_parent() { + let parsed = parse("/inherit_parent{foo}"); + let spans: Vec<_> = parsed.spans().collect(); + assert_eq!( + &spans, + &[Span { + content: "foo", + width: 3, + attr: &Style::from_color_style(ColorType::InheritParent.into()), + }] + ); + } + #[test] fn hex_color() { let parsed = parse("/#ff0000{red}");