terminal: check OSC parser for tmux 112 sequences from HN

Saw this on HN:
https://github.com/darrenstarr/VtNetCore/pull/14

I wanted to see if ghostty was vulnerable to it (it is not). But, its a
good example of a weird edge case in the wild and I wanted to make sure
it was redundantly tested. It looks like we read the "spec" (blog posts,
man pages, source of other terminal using tools, etc.) right.
This commit is contained in:
Mitchell Hashimoto
2023-01-17 21:47:38 -08:00
parent e9bf2a5680
commit df52fae76a

View File

@ -607,6 +607,28 @@ test "osc: change window title (end in esc)" {
} }
} }
// https://github.com/darrenstarr/VtNetCore/pull/14
// Saw this on HN, decided to add a test case because why not.
test "osc: 112 incomplete sequence" {
var p = init();
_ = p.next(0x1B);
_ = p.next(']');
_ = p.next('1');
_ = p.next('1');
_ = p.next('2');
{
const a = p.next(0x07);
try testing.expect(p.state == .ground);
try testing.expect(a[0].? == .osc_dispatch);
try testing.expect(a[1] == null);
try testing.expect(a[2] == null);
const cmd = a[0].?.osc_dispatch;
try testing.expect(cmd == .reset_cursor_color);
}
}
test "print: utf8 2 byte" { test "print: utf8 2 byte" {
var p = init(); var p = init();
var a: [3]?Action = undefined; var a: [3]?Action = undefined;