Skip to content

Commit

Permalink
[fix] Don't exclude empty spans
Browse files Browse the repository at this point in the history
Empty spans might be empty new lines used in ascii art
  • Loading branch information
uttarayan21 committed Mar 16, 2023
1 parent 225669f commit 0d1e9bc
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,8 @@ fn spans(style: Style) -> impl Fn(&[u8]) -> IResult<&[u8], (Spans<'static>, Styl
let mut spans = Vec::new();
let mut last = style;
while let Ok((s, span)) = span(last)(text) {
// don't include empty spans, provided we have at least one
if spans.len() <= 0 || span.content != "" {
last = span.style;
spans.push(span);
}
last = span.style;
spans.push(span);
text = s;
if text.is_empty() {
break;
Expand Down

0 comments on commit 0d1e9bc

Please sign in to comment.