diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-04 23:34:57 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 01:02:08 -0300 |
| commit | c7bab5ec27f8dc1058e282fbbfc8fe9f01cd78bf (patch) | |
| tree | 97e6d279f61c4963ec98b2c87de4b39e40d4184b /src/terminal.zig | |
| parent | 22643b1a1f37f9bf8cc1fcd4a80fb0876b9a0ff9 (diff) | |
| download | pardes-c7bab5ec27f8dc1058e282fbbfc8fe9f01cd78bf.tar.gz pardes-c7bab5ec27f8dc1058e282fbbfc8fe9f01cd78bf.zip | |
terminal and pager: SGR's underline style becomes a cell's by a cast, where two switches mapped one enum onto the same one; a comptime check in terminal.zig holds the two in one order (`off` the cell's `none`)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/terminal.zig')
| -rw-r--r-- | src/terminal.zig | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/terminal.zig b/src/terminal.zig index 1d97318b..acc7efdf 100644 --- a/src/terminal.zig +++ b/src/terminal.zig @@ -2500,6 +2500,13 @@ fn cellAt(pages: *const ghostty_vt.PageList, row: ghostty_vt.Pin, x: u16) ?ghost return .{ .node = row.node, .row = rac.row, .cell = rac.cell, .row_idx = row.y, .col_idx = x }; } +// A cell's underline styles are SGR's, in SGR's order (`off` its `none`): a +// cast takes one to the other (cellStyle, pager.zig). +comptime { + if (enabled) for (@typeInfo(@FieldType(pardes.CellStyle, "ul")).@"enum".field_names, 0..) |name, i| + if (@intFromEnum(@field(ghostty_vt.sgr.Attribute.Underline, if (std.mem.eql(u8, name, "off")) "none" else name)) != i) @compileError("a cell's underline styles are not SGR's"); +} + fn cellStyle(p: *Pardes, ci: ghostty_vt.PageList.Cell, filtered: ?*FilteredColors, scnm: bool) pardes.CellStyle { const style = ci.style(); var cs: pardes.CellStyle = .{ @@ -2512,14 +2519,7 @@ fn cellStyle(p: *Pardes, ci: ghostty_vt.PageList.Cell, filtered: ?*FilteredColor .reverse = style.flags.inverse, .invisible = style.flags.invisible, .strikethrough = style.flags.strikethrough, - .ul = switch (style.flags.underline) { - .none => .off, - .single => .single, - .double => .double, - .curly => .curly, - .dotted => .dotted, - .dashed => .dashed, - }, + .ul = @enumFromInt(@intFromEnum(style.flags.underline)), }; if (filtered == null) switch (ci.cell.content_tag) { .bg_color_palette => cs.bg = palColor(p, ci.cell.content.color_palette.data), |
