diff options
Diffstat (limited to 'dev/tui/tui.zig')
| -rw-r--r-- | dev/tui/tui.zig | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/dev/tui/tui.zig b/dev/tui/tui.zig index d1bbe140..9320e522 100644 --- a/dev/tui/tui.zig +++ b/dev/tui/tui.zig @@ -2917,6 +2917,15 @@ test "a mouse report at row or column 0, or before it, is the window's edge, nev } } +test "an X10 mouse report with a byte below 32, and one with a button no mouse has, are no event, never a panic" { + // A legacy terminal's `ESC [ M` then a control byte: Alt+[, Shift+M, Enter and two keys. + for ([_][]const u8{ "\x1b[M\x0d\x20\x20", "\x1b[M\x20\x0d\x20", "\x1b[M\x20\x20\x1f", "\x1b[<192;1;1M", "\x1b[<195;5;5m" }) |sequence| { + var parser: vaxis.Parser = .{}; + const result = try parser.parse(sequence, std.testing.allocator); + try std.testing.expect(result.event == null and result.n > 0); + } +} + test "a mouse's side buttons, xterm's 8 and 9, are Back and Forward, as SDL's X1 and X2 are" { for ([_]vaxis.Mouse.Button{ .button_8, .button_9 }, [_]pardes.Mouse.Button{ .back, .forward }) |from, to| { const event = mouseEvent(.{ .col = 3, .row = 2, .button = from, .mods = .{}, .type = .press }).?; |
