From 786001f09589ef2abec3958d11b0c264f57f6c7e Mon Sep 17 00:00:00 2001 From: Alexandre Bury Date: Sun, 6 Nov 2016 01:22:12 -0800 Subject: [PATCH] Fix CSI sequence detection (#69) Properly detects CSI sequence termination. Fixes #47, #68. --- src/event.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/event.rs b/src/event.rs index 7d0a970..ee4eedf 100644 --- a/src/event.rs +++ b/src/event.rs @@ -192,10 +192,9 @@ where I: Iterator> let mut buf = Vec::new(); buf.push(c); let mut c = iter.next().unwrap().unwrap(); - while match c { - b'M' | b'~' => false, - _ => true, - } { + // The final byte of a CSI sequence can be in the range 64-126 + // So let's keep reading anything else. + while c < 64 || c > 126 { buf.push(c); c = iter.next().unwrap().unwrap(); }