diff --git a/src/Grid.zig b/src/Grid.zig index ccdc1f14e..91f9f7714 100644 --- a/src/Grid.zig +++ b/src/Grid.zig @@ -307,8 +307,6 @@ pub fn updateCells(self: *Grid, term: Terminal) !void { // In inverted mode, the background MUST be set to something // (is never null) so it is either the fg or default fg. The // fg is either the bg or default background. - // - // TODO(mitchellh): How should this interact with DECSCNM? .bg = cell.fg orelse self.foreground, .fg = cell.bg orelse self.background, }; diff --git a/src/Window.zig b/src/Window.zig index e38a5aafb..80c0482e8 100644 --- a/src/Window.zig +++ b/src/Window.zig @@ -582,18 +582,19 @@ fn renderTimerCallback(t: *libuv.Timer) void { const win = t.getData(Window).?; // Calculate foreground and background colors + const bg = win.grid.background; const fg = win.grid.foreground; - defer win.grid.foreground = fg; + defer { + win.grid.background = bg; + win.grid.foreground = fg; + } if (win.terminal.mode_reverse_colors) { - win.grid.foreground = .{ - .r = @floatToInt(u8, win.bg_r * 255), - .g = @floatToInt(u8, win.bg_g * 255), - .b = @floatToInt(u8, win.bg_b * 255), - }; + win.grid.background = fg; + win.grid.foreground = bg; } // Set our background - const bg: struct { + const gl_bg: struct { r: f32, g: f32, b: f32, @@ -609,7 +610,7 @@ fn renderTimerCallback(t: *libuv.Timer) void { .b = win.bg_b, .a = win.bg_a, }; - gl.clearColor(bg.r, bg.g, bg.b, bg.a); + gl.clearColor(gl_bg.r, gl_bg.g, gl_bg.b, gl_bg.a); gl.clear(gl.c.GL_COLOR_BUFFER_BIT); // Update the cells for drawing