interpret more escape codes gracefully

This commit is contained in:
bunnie 2024-11-05 19:39:40 +08:00
parent a9abba0bb0
commit 5935406f89

View file

@ -219,8 +219,17 @@ fn esc_match(esc_chars: &[u8]) -> Result<Option<char>, ()> {
} }
} }
1 => { 1 => {
if c != 0x5b { match c {
return Err(()); 0x41 => return Ok(Some('↑')),
0x42 => return Ok(Some('↓')),
0x43 => return Ok(Some('→')),
0x44 => return Ok(Some('←')),
0x7e => return Err(()), // premature end
_ => {
if c != 0x5b {
return Err(());
}
}
} }
} }
2 => match c { 2 => match c {