config: change osc-color-report-format enum

This commit is contained in:
Mitchell Hashimoto
2023-09-14 13:15:09 -07:00
parent 19ef4a22a9
commit 14724290d8
2 changed files with 10 additions and 8 deletions

View File

@ -315,11 +315,11 @@ keybind: Keybinds = .{},
/// Allowable values are: /// Allowable values are:
/// ///
/// * "none" - OSC 10/11 queries receive no reply /// * "none" - OSC 10/11 queries receive no reply
/// * "bits8" - Color components are return unscaled, i.e. rr/gg/bb /// * "8-bit" - Color components are return unscaled, i.e. rr/gg/bb
/// * "bits16" - Color components are returned scaled, e.g. rrrr/gggg/bbbb /// * "16-bit" - Color components are returned scaled, e.g. rrrr/gggg/bbbb
/// ///
/// The default value is "bits16". /// The default value is "16-bit".
@"osc-color-report-format": OSCColorReportFormat = .bits16, @"osc-color-report-format": OSCColorReportFormat = .@"16-bit",
/// If anything other than false, fullscreen mode on macOS will not use the /// If anything other than false, fullscreen mode on macOS will not use the
/// native fullscreen, but make the window fullscreen without animations and /// native fullscreen, but make the window fullscreen without animations and
@ -1500,6 +1500,6 @@ pub const ShellIntegration = enum {
/// OSC 10 and 11 default color reporting format. /// OSC 10 and 11 default color reporting format.
pub const OSCColorReportFormat = enum { pub const OSCColorReportFormat = enum {
none, none,
bits8, @"8-bit",
bits16, @"16-bit",
}; };

View File

@ -1820,7 +1820,7 @@ const StreamHandler = struct {
var msg: termio.Message = .{ .write_small = .{} }; var msg: termio.Message = .{ .write_small = .{} };
const resp = switch (self.osc_color_report_format) { const resp = switch (self.osc_color_report_format) {
.bits16 => try std.fmt.bufPrint( .@"16-bit" => try std.fmt.bufPrint(
&msg.write_small.data, &msg.write_small.data,
"\x1B]{s};rgb:{x:0>4}/{x:0>4}/{x:0>4}{s}", "\x1B]{s};rgb:{x:0>4}/{x:0>4}/{x:0>4}{s}",
.{ .{
@ -1832,7 +1832,7 @@ const StreamHandler = struct {
}, },
), ),
else => try std.fmt.bufPrint( .@"8-bit" => try std.fmt.bufPrint(
&msg.write_small.data, &msg.write_small.data,
"\x1B]{s};rgb:{x:0>2}/{x:0>2}/{x:0>2}{s}", "\x1B]{s};rgb:{x:0>2}/{x:0>2}/{x:0>2}{s}",
.{ .{
@ -1843,6 +1843,8 @@ const StreamHandler = struct {
terminator.string(), terminator.string(),
}, },
), ),
.none => unreachable, // early return above
}; };
msg.write_small.len = @intCast(resp.len); msg.write_small.len = @intCast(resp.len);
self.messageWriter(msg); self.messageWriter(msg);