mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 00:36:07 +03:00
handle inversion with screen inversion properly
This commit is contained in:
@ -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,
|
||||
};
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user