Skip to content

Commit

Permalink
Possibly fix ratatui#10
Browse files Browse the repository at this point in the history
  • Loading branch information
uttarayan21 committed Dec 24, 2021
1 parent 2871347 commit 5127c8c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ansi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,16 @@ pub fn ansi_to_text<'t, B: IntoIterator<Item = u8>>(bytes: B) -> Result<Text<'t>
&& !line_buffer.is_empty()
&& style_stack.last() != Some(&style)
{
let style = match style_stack.pop() {
Some(style) => style,
None => return Err(Error::StackEmpty),
};
span_buffer.push(Span::styled(
#[cfg(feature = "simd")]
from_utf8(&line_buffer)?.to_owned(),
#[cfg(not(feature = "simd"))]
String::from_utf8(line_buffer.clone())?,
style_stack.pop().unwrap(),
style,
));
line_buffer.clear();
style_stack.push(style);
Expand Down

0 comments on commit 5127c8c

Please sign in to comment.