aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs24
-rw-r--r--src/params.rs1
2 files changed, 24 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index c9886bf..4860fcc 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -307,7 +307,7 @@ impl Parser {
);
},
Action::EscDispatch => {
- performer.esc_dispatch(self.intermediates(), self.ignoring, byte)
+ performer.esc_dispatch(self.intermediates(), self.ignoring, byte);
},
Action::Collect => {
if self.intermediate_idx == MAX_INTERMEDIATES {
@@ -899,6 +899,28 @@ mod tests {
_ => panic!("expected esc sequence"),
}
}
+
+ #[test]
+ fn params_buffer_filled_with_subparam() {
+ static INPUT: &[u8] = b"\x1b[::::::::::::::::::::::::::::::::x\x1b";
+ let mut dispatcher = Dispatcher::default();
+ let mut parser = Parser::new();
+
+ for byte in INPUT {
+ parser.advance(&mut dispatcher, *byte);
+ }
+
+ assert_eq!(dispatcher.dispatched.len(), 1);
+ match &dispatcher.dispatched[0] {
+ Sequence::Csi(params, intermediates, ignore, c) => {
+ assert_eq!(intermediates, &[]);
+ assert_eq!(params, &[[0; 32]]);
+ assert_eq!(c, &'x');
+ assert!(ignore);
+ },
+ _ => panic!("expected csi sequence"),
+ }
+ }
}
#[cfg(all(feature = "nightly", test))]
diff --git a/src/params.rs b/src/params.rs
index ca6ba48..608c040 100644
--- a/src/params.rs
+++ b/src/params.rs
@@ -68,6 +68,7 @@ impl Params {
/// Add an additional subparameter to the current parameter.
#[inline]
pub(crate) fn extend(&mut self, item: u16) {
+ self.subparams[self.len - self.current_subparams as usize] = self.current_subparams + 1;
self.params[self.len] = item;
self.current_subparams += 1;
self.len += 1;