Fix CSI sequence detection (#69)

Properly detects CSI sequence termination.

Fixes #47, #68.
This commit is contained in:
Alexandre Bury 2016-11-06 01:22:12 -08:00 committed by ticki
parent f49a6e501b
commit 786001f095
1 changed files with 3 additions and 4 deletions

View File

@ -192,10 +192,9 @@ where I: Iterator<Item = Result<u8, Error>>
let mut buf = Vec::new(); let mut buf = Vec::new();
buf.push(c); buf.push(c);
let mut c = iter.next().unwrap().unwrap(); let mut c = iter.next().unwrap().unwrap();
while match c { // The final byte of a CSI sequence can be in the range 64-126
b'M' | b'~' => false, // So let's keep reading anything else.
_ => true, while c < 64 || c > 126 {
} {
buf.push(c); buf.push(c);
c = iter.next().unwrap().unwrap(); c = iter.next().unwrap().unwrap();
} }