Change parse_escape to return an AnsiSequence

This commit is contained in:
Dániel Buga
2020-10-05 12:19:37 +02:00
parent dafb7d7f08
commit abce537ffe
2 changed files with 4 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;
use crate::{AnsiSequence, Output}; use crate::AnsiSequence;
use core::convert::TryInto; use core::convert::TryInto;
use heapless::Vec; use heapless::Vec;
@@ -324,10 +324,10 @@ named!(
); );
named!( named!(
pub parse_escape<&str, Output>, pub parse_escape<&str, AnsiSequence>,
do_parse!( do_parse!(
tag!("\u{1b}") >> tag!("\u{1b}") >>
seq: combined >> seq: combined >>
(Output::Escape(seq)) (seq)
) )
); );

View File

@@ -41,7 +41,7 @@ impl<'a> Iterator for AnsiParseIterator<'a> {
if let Ok(ret) = res { if let Ok(ret) = res {
self.dat = &ret.0; self.dat = &ret.0;
Some(ret.1) Some(Output::Escape(ret.1))
}else{ }else{
let pos = self.dat[(loc+1)..].find('\u{1b}'); let pos = self.dat[(loc+1)..].find('\u{1b}');
if let Some(loc) = pos { if let Some(loc) = pos {