terminal: decscusr

This commit is contained in:
Mitchell Hashimoto
2023-10-10 12:24:11 -07:00
parent c980234cb4
commit 7a8f2bfed6
2 changed files with 58 additions and 0 deletions

View File

@@ -1487,3 +1487,37 @@ test "stream: DECEL, DECSEL" {
try testing.expect(!s.handler.protected.?);
}
}
test "stream: DECSCUSR" {
const H = struct {
style: ?ansi.CursorStyle = null,
pub fn setCursorStyle(self: *@This(), style: ansi.CursorStyle) !void {
self.style = style;
}
};
var s: Stream(H) = .{ .handler = .{} };
try s.nextSlice("\x1B[ q");
try testing.expect(s.handler.style.? == .default);
try s.nextSlice("\x1B[1 q");
try testing.expect(s.handler.style.? == .blinking_block);
}
test "stream: DECSCUSR without space" {
const H = struct {
style: ?ansi.CursorStyle = null,
pub fn setCursorStyle(self: *@This(), style: ansi.CursorStyle) !void {
self.style = style;
}
};
var s: Stream(H) = .{ .handler = .{} };
try s.nextSlice("\x1B[q");
try testing.expect(s.handler.style == null);
try s.nextSlice("\x1B[1q");
try testing.expect(s.handler.style == null);
}