vtparse: recognize utf8 encoded c1 codes in more cases
There were two bugs here: * \u8D (the utf8 encoded representation of 0x8d, aka: RI) was not recognized as a C1 code and was instead passed through as printable text. * The \u8D is a zero-width sequence which means that a subsequent set_cell call on the new empty-by-default line wouldn't allocate any cells in the line array, and the assigment to the line would panic. This commit avoids the panic for the second case, and then fixes up the vtparser to correctly recognize the sequence as a C1 control. refs: https://github.com/wez/wezterm/issues/768
This commit is contained in:
1 parent
9a1314c5b1
commit
ff153ba27f
4 files changed
+28
-4
No files matched your search
+11
-1
@@ -622,7 +622,9 @@ impl VTParser {
|
||||
let byte = ((c as u32) & 0xff) as u8;
|
||||
|
||||
let (action, state) = lookup(self.utf8_return_state, byte);
|
||||
if state != self.utf8_return_state && state != State::Utf8Sequence {
|
||||
if action == Action::Execute
|
||||
|| (state != self.utf8_return_state && state != State::Utf8Sequence)
|
||||
{
|
||||
self.action(lookup_exit(self.utf8_return_state), 0, actor);
|
||||
self.action(action, byte, actor);
|
||||
self.action(lookup_entry(state), 0, actor);
|
||||
@@ -941,6 +943,14 @@ mod test {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn utf8_control() {
|
||||
assert_eq!(
|
||||
parse_as_vec("\u{8d}".as_bytes()),
|
||||
vec![VTAction::ExecuteC0orC1(0x8d)]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tmux_control() {
|
||||
assert_eq!(
|
||||
|
||||
Reference in new issue
Block a user