Skip to content
Snippets Groups Projects
Commit 8c82c461 authored by Alexandre Bury's avatar Alexandre Bury Committed by ticki
Browse files

Handles CSI `~` sequences with multiple values (#70)

* Handles CSI `~` sequences with multiple values

Fixes #62

* Fix doc typo
parent 786001f0
No related branches found
No related tags found
No related merge requests found
......@@ -225,8 +225,21 @@ where I: Iterator<Item = Result<u8, Error>>
},
// Special key code.
b'~' => {
let num: u8 = String::from_utf8(buf).unwrap().parse().unwrap();
match num {
let str_buf = String::from_utf8(buf).unwrap();
// This CSI sequence can be a list of
// semicolon-separated numbers.
let nums: Vec<u8> = str_buf.split(';')
.map(|n| n.parse().unwrap())
.collect();
if nums.is_empty() {
return error;
}
// TODO: handle multiple values for key modififiers
// (ex: values [3, 2] means Shift+Delete)
match nums[0] {
1 | 7 => Event::Key(Key::Home),
2 => Event::Key(Key::Insert),
3 => Event::Key(Key::Delete),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment