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;
|
break :glyph;
|
||||||
}
|
}
|
||||||
|
|
||||||
var mode: mtl_shaders.CellText.Mode = .{
|
var mode: mtl_shaders.CellText.Mode = .{ .fg = true };
|
||||||
.fg = true,
|
|
||||||
.fg_constrained = false,
|
|
||||||
.fg_color = false,
|
|
||||||
.cursor = false,
|
|
||||||
.fg_powerline = false,
|
|
||||||
.fg_blink = false,
|
|
||||||
};
|
|
||||||
|
|
||||||
switch (try fgMode(
|
switch (try fgMode(
|
||||||
render.presentation,
|
render.presentation,
|
||||||
@ -2613,14 +2606,7 @@ fn updateCell(
|
|||||||
const color = style.underlineColor(palette) orelse colors.fg;
|
const color = style.underlineColor(palette) orelse colors.fg;
|
||||||
|
|
||||||
try self.cells.add(self.alloc, .underline, .{
|
try self.cells.add(self.alloc, .underline, .{
|
||||||
.mode = .{
|
.mode = .{ .fg = true },
|
||||||
.fg = true,
|
|
||||||
.fg_constrained = false,
|
|
||||||
.fg_color = false,
|
|
||||||
.cursor = false,
|
|
||||||
.fg_powerline = false,
|
|
||||||
.fg_blink = false,
|
|
||||||
},
|
|
||||||
.grid_pos = .{ @intCast(coord.x), @intCast(coord.y) },
|
.grid_pos = .{ @intCast(coord.x), @intCast(coord.y) },
|
||||||
.constraint_width = cell.gridWidth(),
|
.constraint_width = cell.gridWidth(),
|
||||||
.color = .{ color.r, color.g, color.b, alpha },
|
.color = .{ color.r, color.g, color.b, alpha },
|
||||||
@ -2645,14 +2631,7 @@ fn updateCell(
|
|||||||
);
|
);
|
||||||
|
|
||||||
try self.cells.add(self.alloc, .strikethrough, .{
|
try self.cells.add(self.alloc, .strikethrough, .{
|
||||||
.mode = .{
|
.mode = .{ .fg = true },
|
||||||
.fg = true,
|
|
||||||
.fg_constrained = false,
|
|
||||||
.fg_color = false,
|
|
||||||
.cursor = false,
|
|
||||||
.fg_powerline = false,
|
|
||||||
.fg_blink = false,
|
|
||||||
},
|
|
||||||
.grid_pos = .{ @intCast(coord.x), @intCast(coord.y) },
|
.grid_pos = .{ @intCast(coord.x), @intCast(coord.y) },
|
||||||
.constraint_width = cell.gridWidth(),
|
.constraint_width = cell.gridWidth(),
|
||||||
.color = .{ colors.fg.r, colors.fg.g, colors.fg.b, alpha },
|
.color = .{ colors.fg.r, colors.fg.g, colors.fg.b, alpha },
|
||||||
@ -2714,14 +2693,7 @@ fn addCursor(
|
|||||||
};
|
};
|
||||||
|
|
||||||
self.cells.setCursor(.{
|
self.cells.setCursor(.{
|
||||||
.mode = .{
|
.mode = .{ .fg = false, .cursor = true },
|
||||||
.fg = false,
|
|
||||||
.fg_constrained = false,
|
|
||||||
.fg_color = false,
|
|
||||||
.cursor = true,
|
|
||||||
.fg_powerline = false,
|
|
||||||
.fg_blink = false,
|
|
||||||
},
|
|
||||||
.grid_pos = .{ x, screen.cursor.y },
|
.grid_pos = .{ x, screen.cursor.y },
|
||||||
.color = .{ cursor_color.r, cursor_color.g, cursor_color.b, alpha },
|
.color = .{ cursor_color.r, cursor_color.g, cursor_color.b, alpha },
|
||||||
.glyph_pos = .{ render.glyph.atlas_x, render.glyph.atlas_y },
|
.glyph_pos = .{ render.glyph.atlas_x, render.glyph.atlas_y },
|
||||||
@ -2770,14 +2742,7 @@ fn addPreeditCell(
|
|||||||
|
|
||||||
// Add our text
|
// Add our text
|
||||||
try self.cells.add(self.alloc, .text, .{
|
try self.cells.add(self.alloc, .text, .{
|
||||||
.mode = .{
|
.mode = .{ .fg = true },
|
||||||
.fg = true,
|
|
||||||
.fg_constrained = false,
|
|
||||||
.fg_color = false,
|
|
||||||
.cursor = false,
|
|
||||||
.fg_powerline = false,
|
|
||||||
.fg_blink = false,
|
|
||||||
},
|
|
||||||
.grid_pos = .{ @intCast(coord.x), @intCast(coord.y) },
|
.grid_pos = .{ @intCast(coord.x), @intCast(coord.y) },
|
||||||
.color = .{ fg.r, fg.g, fg.b, 255 },
|
.color = .{ fg.r, fg.g, fg.b, 255 },
|
||||||
.glyph_pos = .{ render.glyph.atlas_x, render.glyph.atlas_y },
|
.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) {
|
pub const Mode = packed struct(u8) {
|
||||||
fg: bool,
|
fg: bool,
|
||||||
fg_constrained: bool,
|
fg_constrained: bool = false,
|
||||||
fg_color: bool,
|
fg_color: bool = false,
|
||||||
cursor: bool,
|
cursor: bool = false,
|
||||||
fg_powerline: bool,
|
fg_powerline: bool = false,
|
||||||
fg_blink: bool,
|
fg_blink: bool = false,
|
||||||
|
|
||||||
_padding: u2 = 0,
|
_padding: u2 = 0,
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user