diff --git a/cursive-core/src/utils/markup/cursup.rs b/cursive-core/src/utils/markup/cursup.rs index 7cd318d0..05f310da 100644 --- a/cursive-core/src/utils/markup/cursup.rs +++ b/cursive-core/src/utils/markup/cursup.rs @@ -35,32 +35,8 @@ struct Candidate { #[derive(Debug, PartialEq, Eq)] enum Event { - StartSkip, - Start(Style), + Start { style: Style, brace: usize }, End, - Resume, -} - -impl PartialOrd for Event { - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } -} - -impl Ord for Event { - fn cmp(&self, other: &Self) -> std::cmp::Ordering { - match (self, other) { - (Event::StartSkip, Event::Start(_) | Event::End | Event::Resume) - | (Event::Start(_), Event::End | Event::Resume) - | (Event::End, Event::Resume) => std::cmp::Ordering::Less, - - (Event::Start(_) | Event::End | Event::Resume, Event::StartSkip) - | (Event::End | Event::Resume, Event::Start(_)) - | (Event::Resume, Event::End) => std::cmp::Ordering::Greater, - - _ => std::cmp::Ordering::Equal, - } - } } /// Parse spans for the given text. @@ -81,10 +57,14 @@ pub fn parse_spans(input: &str) -> Vec { let action = &input[candidate.slash + 1..candidate.brace]; let style = action.parse::