summaryrefslogtreecommitdiff
path: root/src/File.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-23 11:12:56 -0300
committerGabriel Schneider <[email protected]>2026-10-23 17:10:58 -0300
commita53a1aafb9804e943bdcd720c2bb688ecb90a888 (patch)
tree197ee0ac4106037d49c5c9fc7a2b6be4186173bf /src/File.zig
parenta0d367b6c54ff29737662fd7cf5a78d4d183cb20 (diff)
downloadpardes-a53a1aafb9804e943bdcd720c2bb688ecb90a888.tar.gz
pardes-a53a1aafb9804e943bdcd720c2bb688ecb90a888.zip
Audit (colours, drawing): one Surface.tint, shared colour maths, the helix copies of hand-ported themes removed
The 22 <name>_helix themes that duplicate a hand-written port are gone; monokai, ayu_dark and nord stay, since others inherit from them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/File.zig')
-rw-r--r--src/File.zig23
1 files changed, 5 insertions, 18 deletions
diff --git a/src/File.zig b/src/File.zig
index 7e05ac9f..e92efaba 100644
--- a/src/File.zig
+++ b/src/File.zig
@@ -1929,16 +1929,6 @@ pub const DiffTints = struct {
}
};
-/// A diff row's tint: its ground from `x` to the pane's edge.
-fn tintRow(s: *Surface, x: u16, y: u16, end: u16, bg: [3]u8) void {
- var col = x;
- while (col < end) : (col += 1) {
- const cell = s.at(col, y);
- cell.default = false;
- cell.style.bg = .{ .rgb = bg };
- }
-}
-
fn synStyle(p: *Pardes, sy: syntax.Syn) ?SynStyle {
return switch (sy) {
.none => null,
@@ -2010,7 +2000,7 @@ pub fn recolorSyntax(p: *Pardes, s: *Surface, pane: *Pane, f: *State, r: pardes.
if (tint) |t| if (prefix_width < tw) {
// A +Diff line added or removed whole: faintly (hunks.zig).
const whole = highlights[base - highlight_start] & syntax.diff_whole != 0;
- if (row_tint or whole) tintRow(s, tx + @as(u16, @intCast(prefix_width)), body_y + vr, tx + tw, if (row_tint) t.bg else t.line_bg);
+ if (row_tint or whole) s.tint(tx + @as(u16, @intCast(prefix_width)), body_y + vr, tw -| @as(u16, @intCast(prefix_width)), if (row_tint) t.bg else t.line_bg, null);
};
// A +Pager's own colours (pager.zig) on every row but one the diff
// look tints: an added or removed line is drawn as pardes draws a
@@ -2228,7 +2218,7 @@ pub fn recolorDiffOutput(p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect, t
const view = maybe orelse continue;
const base = @intFromPtr(rows[view.row].ptr) - flat_start - lo;
const tint = if (base < styles.len) tints.forStyle(styles[base]) else null;
- if (tint) |t| tintRow(s, tx, body_y + @as(u16, @intCast(vr)), tx + tw, t.bg);
+ if (tint) |t| s.tint(tx, body_y + @as(u16, @intCast(vr)), tw, t.bg, null);
var c: usize = 0;
var screen_c: usize = 0;
while (c < line.len and screen_c < tw) {
@@ -2310,12 +2300,9 @@ pub fn paintWordSelection(
if (hi <= lo) continue;
const c0 = @as(i32, prefix_width) + here.pad + displayOffset(pane, row, here.at, lo);
const c1 = @as(i32, prefix_width) + here.pad + displayEndOffset(pane, row, here.at, hi - 1);
- var col = @max(@as(i32, prefix_width), c0);
- while (col <= c1 and col < @as(i32, tw)) : (col += 1) {
- const cell = s.at(tx + @as(u16, @intCast(col)), body_y + @as(u16, @intCast(vr)));
- cell.default = false;
- cell.style.bg = .{ .rgb = bg };
- }
+ const col = @max(@as(i32, prefix_width), c0);
+ const end = @min(c1 + 1, @as(i32, tw));
+ if (col < end) s.tint(tx + @as(u16, @intCast(col)), body_y + @as(u16, @intCast(vr)), @intCast(end - col), bg, null);
}
}