mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
terminfo: switch to semicolon SGR 48 to prevent render issues
This commit is contained in:
@ -531,6 +531,35 @@ test "csi: SGR ESC [ 38 : 2 m" {
|
||||
}
|
||||
}
|
||||
|
||||
test "csi: SGR ESC [ 48 : 2 m" {
|
||||
var p = init();
|
||||
_ = p.next(0x1B);
|
||||
for ("[48:2:240:143:104") |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('m');
|
||||
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 == 'm');
|
||||
try testing.expect(d.sep == .colon);
|
||||
try testing.expect(d.params.len == 5);
|
||||
try testing.expectEqual(@as(u16, 48), d.params[0]);
|
||||
try testing.expectEqual(@as(u16, 2), d.params[1]);
|
||||
try testing.expectEqual(@as(u16, 240), d.params[2]);
|
||||
try testing.expectEqual(@as(u16, 143), d.params[3]);
|
||||
try testing.expectEqual(@as(u16, 104), d.params[4]);
|
||||
}
|
||||
}
|
||||
|
||||
test "csi: SGR ESC [4:3m colon" {
|
||||
var p = init();
|
||||
_ = p.next(0x1B);
|
||||
|
@ -467,6 +467,16 @@ test "sgr: 256 color" {
|
||||
try testing.expect(p.next().? == .@"256_bg");
|
||||
}
|
||||
|
||||
test "sgr: 24-bit bg color" {
|
||||
{
|
||||
const v = testParseColon(&[_]u16{ 48, 2, 1, 2, 3 });
|
||||
try testing.expect(v == .direct_color_bg);
|
||||
try testing.expectEqual(@as(u8, 1), v.direct_color_bg.r);
|
||||
try testing.expectEqual(@as(u8, 2), v.direct_color_bg.g);
|
||||
try testing.expectEqual(@as(u8, 3), v.direct_color_bg.b);
|
||||
}
|
||||
}
|
||||
|
||||
test "sgr: underline color" {
|
||||
{
|
||||
const v = testParseColon(&[_]u16{ 58, 2, 1, 2, 3 });
|
||||
|
@ -48,7 +48,7 @@ pub fn Stream(comptime Handler: type) type {
|
||||
tracy.value(@intCast(u64, c));
|
||||
defer tracy.end();
|
||||
|
||||
//log.debug("char: {x}", .{c});
|
||||
// log.debug("char: {c}", .{c});
|
||||
const actions = self.parser.next(c);
|
||||
for (actions) |action_opt| {
|
||||
// if (action_opt) |action| {
|
||||
|
@ -39,7 +39,7 @@ pub const ghostty: Source = .{
|
||||
.{ .name = "ccc", .value = .{ .boolean = {} } },
|
||||
|
||||
// supports changing the window title.
|
||||
//.{ .name = "hs", .value = .{ .boolean = {} } },
|
||||
.{ .name = "hs", .value = .{ .boolean = {} } },
|
||||
|
||||
// terminal has a meta key
|
||||
.{ .name = "km", .value = .{ .boolean = {} } },
|
||||
@ -155,7 +155,9 @@ pub const ghostty: Source = .{
|
||||
.{ .name = "rmxx", .value = .{ .string = "\\E[29m" } },
|
||||
.{ .name = "setab", .value = .{ .string = "\\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m" } },
|
||||
.{ .name = "setaf", .value = .{ .string = "\\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m" } },
|
||||
.{ .name = "setrgbb", .value = .{ .string = "\\E[48:2:%p1%d:%p2%d:%p3%dm" } },
|
||||
.{ .name = "setrgbb", .value = .{ .string = "\\E[48;2;%p1%d;%p2%d;%p3%dm" } },
|
||||
// This causes weird rendering issues, why?
|
||||
//.{ .name = "setrgbb", .value = .{ .string = "\\E[48:2:%p1%d:%p2%d:%p3%dm" } },
|
||||
.{ .name = "setrgbf", .value = .{ .string = "\\E[38:2:%p1%d:%p2%d:%p3%dm" } },
|
||||
.{ .name = "sgr", .value = .{ .string = "%?%p9%t\\E(0%e\\E(B%;\\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m" } },
|
||||
.{ .name = "sgr0", .value = .{ .string = "\\E(B\\E[m" } },
|
||||
|
Reference in New Issue
Block a user