From cbfa22555eda19d3dc95722ad30f18781d5ca13b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 28 Aug 2023 08:36:00 -0700 Subject: [PATCH] terminal: test to ensure that DECRQM can parse --- src/terminal/Parser.zig | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/terminal/Parser.zig b/src/terminal/Parser.zig index 90aaefcd6..ee65a165f 100644 --- a/src/terminal/Parser.zig +++ b/src/terminal/Parser.zig @@ -694,6 +694,33 @@ test "csi: colon for non-m final" { try testing.expect(p.state == .ground); } +test "csi: request mode decrqm" { + var p = init(); + _ = p.next(0x1B); + for ("[?2026$") |c| { + const a = p.next(c); + try testing.expect(a[0] == null); + try testing.expect(a[1] == null); + try testing.expect(a[2] == null); + } + + { + const a = p.next('p'); + try testing.expect(p.state == .ground); + try testing.expect(a[0] == null); + try testing.expect(a[1].? == .csi_dispatch); + try testing.expect(a[2] == null); + + const d = a[1].?.csi_dispatch; + try testing.expect(d.final == 'p'); + try testing.expectEqual(@as(usize, 2), d.intermediates.len); + try testing.expectEqual(@as(usize, 1), d.params.len); + try testing.expectEqual(@as(u16, '?'), d.intermediates[0]); + try testing.expectEqual(@as(u16, '$'), d.intermediates[1]); + try testing.expectEqual(@as(u16, 2026), d.params[0]); + } +} + test "osc: change window title" { var p = init(); _ = p.next(0x1B);