From 14724290d8fed2dd32dbb657662bb932649b694b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 14 Sep 2023 13:15:09 -0700 Subject: [PATCH] config: change osc-color-report-format enum --- src/config/Config.zig | 12 ++++++------ src/termio/Exec.zig | 6 ++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/config/Config.zig b/src/config/Config.zig index 69827c4c3..b5e4340dd 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -315,11 +315,11 @@ keybind: Keybinds = .{}, /// Allowable values are: /// /// * "none" - OSC 10/11 queries receive no reply -/// * "bits8" - Color components are return unscaled, i.e. rr/gg/bb -/// * "bits16" - Color components are returned scaled, e.g. rrrr/gggg/bbbb +/// * "8-bit" - Color components are return unscaled, i.e. rr/gg/bb +/// * "16-bit" - Color components are returned scaled, e.g. rrrr/gggg/bbbb /// -/// The default value is "bits16". -@"osc-color-report-format": OSCColorReportFormat = .bits16, +/// The default value is "16-bit". +@"osc-color-report-format": OSCColorReportFormat = .@"16-bit", /// If anything other than false, fullscreen mode on macOS will not use the /// 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. pub const OSCColorReportFormat = enum { none, - bits8, - bits16, + @"8-bit", + @"16-bit", }; diff --git a/src/termio/Exec.zig b/src/termio/Exec.zig index 8dec213d2..06911050a 100644 --- a/src/termio/Exec.zig +++ b/src/termio/Exec.zig @@ -1820,7 +1820,7 @@ const StreamHandler = struct { var msg: termio.Message = .{ .write_small = .{} }; const resp = switch (self.osc_color_report_format) { - .bits16 => try std.fmt.bufPrint( + .@"16-bit" => try std.fmt.bufPrint( &msg.write_small.data, "\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, "\x1B]{s};rgb:{x:0>2}/{x:0>2}/{x:0>2}{s}", .{ @@ -1843,6 +1843,8 @@ const StreamHandler = struct { terminator.string(), }, ), + + .none => unreachable, // early return above }; msg.write_small.len = @intCast(resp.len); self.messageWriter(msg);