mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
osc: fix OSC4 response
When reporting colors via OSC4, the index must also be reported.
This commit is contained in:
@ -2278,7 +2278,20 @@ const StreamHandler = struct {
|
||||
|
||||
var msg: termio.Message = .{ .write_small = .{} };
|
||||
const resp = switch (self.osc_color_report_format) {
|
||||
.@"16-bit" => try std.fmt.bufPrint(
|
||||
.@"16-bit" => switch (kind) {
|
||||
.palette => |i| try std.fmt.bufPrint(
|
||||
&msg.write_small.data,
|
||||
"\x1B]{s};{d};rgb:{x:0>4}/{x:0>4}/{x:0>4}{s}",
|
||||
.{
|
||||
kind.code(),
|
||||
i,
|
||||
@as(u16, color.r) * 257,
|
||||
@as(u16, color.g) * 257,
|
||||
@as(u16, color.b) * 257,
|
||||
terminator.string(),
|
||||
},
|
||||
),
|
||||
else => try std.fmt.bufPrint(
|
||||
&msg.write_small.data,
|
||||
"\x1B]{s};rgb:{x:0>4}/{x:0>4}/{x:0>4}{s}",
|
||||
.{
|
||||
@ -2289,8 +2302,22 @@ const StreamHandler = struct {
|
||||
terminator.string(),
|
||||
},
|
||||
),
|
||||
},
|
||||
|
||||
.@"8-bit" => try std.fmt.bufPrint(
|
||||
.@"8-bit" => switch (kind) {
|
||||
.palette => |i| try std.fmt.bufPrint(
|
||||
&msg.write_small.data,
|
||||
"\x1B]{s};{d};rgb:{x:0>2}/{x:0>2}/{x:0>2}{s}",
|
||||
.{
|
||||
kind.code(),
|
||||
i,
|
||||
@as(u16, color.r),
|
||||
@as(u16, color.g),
|
||||
@as(u16, color.b),
|
||||
terminator.string(),
|
||||
},
|
||||
),
|
||||
else => try std.fmt.bufPrint(
|
||||
&msg.write_small.data,
|
||||
"\x1B]{s};rgb:{x:0>2}/{x:0>2}/{x:0>2}{s}",
|
||||
.{
|
||||
@ -2301,7 +2328,7 @@ const StreamHandler = struct {
|
||||
terminator.string(),
|
||||
},
|
||||
),
|
||||
|
||||
},
|
||||
.none => unreachable, // early return above
|
||||
};
|
||||
msg.write_small.len = @intCast(resp.len);
|
||||
|
Reference in New Issue
Block a user