diff options
Diffstat (limited to 'src/Output.zig')
| -rw-r--r-- | src/Output.zig | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/Output.zig b/src/Output.zig index b8dd5e34..6ea81924 100644 --- a/src/Output.zig +++ b/src/Output.zig @@ -54,10 +54,17 @@ const RowDecoration = struct { mark_end: usize = 0, severity: enum { none, err, warning, info, hint } = .none, - pub fn styleAt(row: RowDecoration, p: *const Pardes, byte: usize) ?pardes.CellStyle { - // Body paper changes immediately, so its ink must change with it - // even while the surrounding tags are still fading. - const chrome = pardes.ChromeTheme.fromTheme(p.theme()); + /// Nothing in the row is decorated: most rows of most files. + pub fn plain(row: RowDecoration) bool { + return !row.declaration and row.location_end == 0 and row.prefix_end == 0 and row.mark_end <= row.mark_start; + } + + /// `chrome` is the theme's own (Pardes.bodyChrome): body paper changes + /// immediately, so its ink must change with it even while the + /// surrounding tags are still fading. Once a frame, never a grapheme: + /// working it out takes the contrast searches' pow calls. + pub fn styleAt(row: RowDecoration, chrome: *const pardes.ChromeTheme, byte: usize) ?pardes.CellStyle { + if (row.plain()) return null; if (row.declaration or byte < @max(row.location_end, row.prefix_end)) return .{ .fg = .{ .rgb = chrome.lineno } }; if (byte < row.mark_start or byte >= row.mark_end) return null; |
