mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
renderer(metal): set defaults for cell mode enum
To reduce code duplication and bring it more in line with the OpenGL equivalent.
This commit is contained in:
@ -2555,14 +2555,7 @@ fn updateCell(
|
||||
break :glyph;
|
||||
}
|
||||
|
||||
var mode: mtl_shaders.CellText.Mode = .{
|
||||
.fg = true,
|
||||
.fg_constrained = false,
|
||||
.fg_color = false,
|
||||
.cursor = false,
|
||||
.fg_powerline = false,
|
||||
.fg_blink = false,
|
||||
};
|
||||
var mode: mtl_shaders.CellText.Mode = .{ .fg = true };
|
||||
|
||||
switch (try fgMode(
|
||||
render.presentation,
|
||||
@ -2613,14 +2606,7 @@ fn updateCell(
|
||||
const color = style.underlineColor(palette) orelse colors.fg;
|
||||
|
||||
try self.cells.add(self.alloc, .underline, .{
|
||||
.mode = .{
|
||||
.fg = true,
|
||||
.fg_constrained = false,
|
||||
.fg_color = false,
|
||||
.cursor = false,
|
||||
.fg_powerline = false,
|
||||
.fg_blink = false,
|
||||
},
|
||||
.mode = .{ .fg = true },
|
||||
.grid_pos = .{ @intCast(coord.x), @intCast(coord.y) },
|
||||
.constraint_width = cell.gridWidth(),
|
||||
.color = .{ color.r, color.g, color.b, alpha },
|
||||
@ -2645,14 +2631,7 @@ fn updateCell(
|
||||
);
|
||||
|
||||
try self.cells.add(self.alloc, .strikethrough, .{
|
||||
.mode = .{
|
||||
.fg = true,
|
||||
.fg_constrained = false,
|
||||
.fg_color = false,
|
||||
.cursor = false,
|
||||
.fg_powerline = false,
|
||||
.fg_blink = false,
|
||||
},
|
||||
.mode = .{ .fg = true },
|
||||
.grid_pos = .{ @intCast(coord.x), @intCast(coord.y) },
|
||||
.constraint_width = cell.gridWidth(),
|
||||
.color = .{ colors.fg.r, colors.fg.g, colors.fg.b, alpha },
|
||||
@ -2714,14 +2693,7 @@ fn addCursor(
|
||||
};
|
||||
|
||||
self.cells.setCursor(.{
|
||||
.mode = .{
|
||||
.fg = false,
|
||||
.fg_constrained = false,
|
||||
.fg_color = false,
|
||||
.cursor = true,
|
||||
.fg_powerline = false,
|
||||
.fg_blink = false,
|
||||
},
|
||||
.mode = .{ .fg = false, .cursor = true },
|
||||
.grid_pos = .{ x, screen.cursor.y },
|
||||
.color = .{ cursor_color.r, cursor_color.g, cursor_color.b, alpha },
|
||||
.glyph_pos = .{ render.glyph.atlas_x, render.glyph.atlas_y },
|
||||
@ -2770,14 +2742,7 @@ fn addPreeditCell(
|
||||
|
||||
// Add our text
|
||||
try self.cells.add(self.alloc, .text, .{
|
||||
.mode = .{
|
||||
.fg = true,
|
||||
.fg_constrained = false,
|
||||
.fg_color = false,
|
||||
.cursor = false,
|
||||
.fg_powerline = false,
|
||||
.fg_blink = false,
|
||||
},
|
||||
.mode = .{ .fg = true },
|
||||
.grid_pos = .{ @intCast(coord.x), @intCast(coord.y) },
|
||||
.color = .{ fg.r, fg.g, fg.b, 255 },
|
||||
.glyph_pos = .{ render.glyph.atlas_x, render.glyph.atlas_y },
|
||||
|
@ -329,11 +329,11 @@ pub const CellText = extern struct {
|
||||
|
||||
pub const Mode = packed struct(u8) {
|
||||
fg: bool,
|
||||
fg_constrained: bool,
|
||||
fg_color: bool,
|
||||
cursor: bool,
|
||||
fg_powerline: bool,
|
||||
fg_blink: bool,
|
||||
fg_constrained: bool = false,
|
||||
fg_color: bool = false,
|
||||
cursor: bool = false,
|
||||
fg_powerline: bool = false,
|
||||
fg_blink: bool = false,
|
||||
|
||||
_padding: u2 = 0,
|
||||
};
|
||||
|
Reference in New Issue
Block a user