termwiz: fixup regression in sgr parsing for empty parameter case

I broke this with my recent csi parser changes.
This commit is contained in:
Wez Furlong committed 2021-07-25 08:20:36 -07:00
1 parent 7192fe7696
commit aca13c6977
2 files changed
+15

No files matched your search

+4
View File
@@ -2127,6 +2127,10 @@ impl<'a> CSIParser<'a> {
}
match &params[0] {
CsiParam::P(b';') => {
// Starting with an empty item is equivalent to a reset
self.advance_by(1, params, Ok(Sgr::Reset))
}
CsiParam::P(_) => Err(()),
CsiParam::Integer(i) => match FromPrimitive::from_i64(*i) {
None => Err(()),
+11
View File
@@ -867,6 +867,17 @@ mod test {
);
}
#[test]
fn sgr() {
assert_eq!(
parse_as("\x1b[;4m", "\x1b[0m\x1b[4m"),
vec![
Action::CSI(CSI::Sgr(Sgr::Reset)),
Action::CSI(CSI::Sgr(Sgr::Underline(Underline::Single))),
]
);
}
#[test]
fn decset() {
assert_eq!(