Change parse_escape to return an AnsiSequence
This commit is contained in:
@@ -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)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@@ -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 {
|
||||||
|
Reference in New Issue
Block a user