renderer/metal: only invert if block

This commit is contained in:
Mitchell Hashimoto
2024-04-27 22:26:40 -07:00
parent 3a7dc355a0
commit 06f21a0daa

View File

@ -1873,9 +1873,6 @@ fn rebuildCells2(
cursor_style_: ?renderer.CursorStyle, cursor_style_: ?renderer.CursorStyle,
color_palette: *const terminal.color.Palette, color_palette: *const terminal.color.Palette,
) !void { ) !void {
// TODO: cursor_cell
// TODO: cursor_Row
// Create an arena for all our temporary allocations while rebuilding // Create an arena for all our temporary allocations while rebuilding
var arena = ArenaAllocator.init(self.alloc); var arena = ArenaAllocator.init(self.alloc);
defer arena.deinit(); defer arena.deinit();
@ -1990,22 +1987,23 @@ fn rebuildCells2(
// Setup our cursor rendering information. // Setup our cursor rendering information.
cursor: { cursor: {
// If we have no cursor style then we don't render the cursor. // By default, we don't handle cursor inversion on the shader.
const style = cursor_style_ orelse {
self.cells.setCursor(null); self.cells.setCursor(null);
self.uniforms.cursor_pos = .{ self.uniforms.cursor_pos = .{
std.math.maxInt(u16), std.math.maxInt(u16),
std.math.maxInt(u16), std.math.maxInt(u16),
}; };
break :cursor;
};
// Prepare the cursor cell contents. // Prepare the cursor cell contents.
const style = cursor_style_ orelse break :cursor;
self.addCursor2(screen, style); self.addCursor2(screen, style);
// Setup our uniforms for the cursor so that any data // If the cursor is visible then we set our uniforms.
// under the cursor can render differently. if (style == .block and screen.viewportIsBottom()) {
self.uniforms.cursor_pos = .{ screen.cursor.x, screen.cursor.y }; self.uniforms.cursor_pos = .{
screen.cursor.x,
screen.cursor.y,
};
self.uniforms.cursor_color = if (self.config.cursor_text) |txt| .{ self.uniforms.cursor_color = if (self.config.cursor_text) |txt| .{
txt.r, txt.r,
txt.g, txt.g,
@ -2018,6 +2016,7 @@ fn rebuildCells2(
255, 255,
}; };
} }
}
// If we have a preedit, we try to render the preedit text on top // If we have a preedit, we try to render the preedit text on top
// of the cursor. // of the cursor.