diff --git a/src/renderer/Metal.zig b/src/renderer/Metal.zig index 5ad45da8e3..084c3eceba 100644 --- a/src/renderer/Metal.zig +++ b/src/renderer/Metal.zig @@ -2650,8 +2650,12 @@ fn rebuildCells( const style = cursor_style_ orelse break :cursor; const cursor_color = self.cursor_color orelse self.default_cursor_color orelse color: { if (self.cursor_invert) { + // Use the styles from the cell under the cursor, if any. const sty = screen.cursor.page_pin.style(screen.cursor.page_cell); - break :color sty.fg(color_palette, self.config.bold_is_bright) orelse self.foreground_color orelse self.default_foreground_color; + break :color (if (sty.flags.inverse) + sty.bg(screen.cursor.page_cell, color_palette) + else + sty.fg(color_palette, self.config.bold_is_bright)) orelse self.foreground_color orelse self.default_foreground_color; } else { break :color self.foreground_color orelse self.default_foreground_color; } @@ -2681,7 +2685,10 @@ fn rebuildCells( const uniform_color = if (self.cursor_invert) blk: { const sty = screen.cursor.page_pin.style(screen.cursor.page_cell); - break :blk sty.bg(screen.cursor.page_cell, color_palette) orelse self.background_color orelse self.default_background_color; + break :blk (if (sty.flags.inverse) + sty.fg(color_palette, self.config.bold_is_bright) + else + sty.bg(screen.cursor.page_cell, color_palette)) orelse self.background_color orelse self.default_background_color; } else if (self.config.cursor_text) |txt| txt else diff --git a/src/renderer/OpenGL.zig b/src/renderer/OpenGL.zig index 157354d1dc..02863d2df1 100644 --- a/src/renderer/OpenGL.zig +++ b/src/renderer/OpenGL.zig @@ -1737,8 +1737,12 @@ pub fn rebuildCells( const cursor_color = self.cursor_color orelse self.default_cursor_color orelse color: { if (self.cursor_invert) { + // Use the styles from the cell under the cursor, if any. const sty = screen.cursor.page_pin.style(screen.cursor.page_cell); - break :color sty.fg(color_palette, self.config.bold_is_bright) orelse self.foreground_color orelse self.default_foreground_color; + break :color (if (sty.flags.inverse) + sty.bg(screen.cursor.page_cell, color_palette) + else + sty.fg(color_palette, self.config.bold_is_bright)) orelse self.foreground_color orelse self.default_foreground_color; } else { break :color self.foreground_color orelse self.default_foreground_color; } @@ -1748,8 +1752,12 @@ pub fn rebuildCells( for (cursor_cells.items) |*cell| { if (cell.mode.isFg() and cell.mode != .fg_color) { const cell_color = if (self.cursor_invert) blk: { + // Use the styles from the cell under the cursor, if any. const sty = screen.cursor.page_pin.style(screen.cursor.page_cell); - break :blk sty.bg(screen.cursor.page_cell, color_palette) orelse self.background_color orelse self.default_background_color; + break :blk (if (sty.flags.inverse) + sty.fg(color_palette, self.config.bold_is_bright) + else + sty.bg(screen.cursor.page_cell, color_palette)) orelse self.background_color orelse self.default_background_color; } else if (self.config.cursor_text) |txt| txt else