mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +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
|
// In inverted mode, the background MUST be set to something
|
||||||
// (is never null) so it is either the fg or default fg. The
|
// (is never null) so it is either the fg or default fg. The
|
||||||
// fg is either the bg or default background.
|
// fg is either the bg or default background.
|
||||||
//
|
|
||||||
// TODO(mitchellh): How should this interact with DECSCNM?
|
|
||||||
.bg = cell.fg orelse self.foreground,
|
.bg = cell.fg orelse self.foreground,
|
||||||
.fg = cell.bg orelse self.background,
|
.fg = cell.bg orelse self.background,
|
||||||
};
|
};
|
||||||
|
@ -582,18 +582,19 @@ fn renderTimerCallback(t: *libuv.Timer) void {
|
|||||||
const win = t.getData(Window).?;
|
const win = t.getData(Window).?;
|
||||||
|
|
||||||
// Calculate foreground and background colors
|
// Calculate foreground and background colors
|
||||||
|
const bg = win.grid.background;
|
||||||
const fg = win.grid.foreground;
|
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) {
|
if (win.terminal.mode_reverse_colors) {
|
||||||
win.grid.foreground = .{
|
win.grid.background = fg;
|
||||||
.r = @floatToInt(u8, win.bg_r * 255),
|
win.grid.foreground = bg;
|
||||||
.g = @floatToInt(u8, win.bg_g * 255),
|
|
||||||
.b = @floatToInt(u8, win.bg_b * 255),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set our background
|
// Set our background
|
||||||
const bg: struct {
|
const gl_bg: struct {
|
||||||
r: f32,
|
r: f32,
|
||||||
g: f32,
|
g: f32,
|
||||||
b: f32,
|
b: f32,
|
||||||
@ -609,7 +610,7 @@ fn renderTimerCallback(t: *libuv.Timer) void {
|
|||||||
.b = win.bg_b,
|
.b = win.bg_b,
|
||||||
.a = win.bg_a,
|
.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);
|
gl.clear(gl.c.GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
// Update the cells for drawing
|
// Update the cells for drawing
|
||||||
|
Reference in New Issue
Block a user