diff options
Diffstat (limited to 'abi/addon.zig')
| -rw-r--r-- | abi/addon.zig | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/abi/addon.zig b/abi/addon.zig index 53227fbb..dfbac270 100644 --- a/abi/addon.zig +++ b/abi/addon.zig @@ -37,9 +37,9 @@ pub const c = @import("pardes_addon"); const Allocator = std.mem.Allocator; /// The ABI this file speaks: a header of another needs it brought along. -pub const abi = 0x30003; +pub const abi = 0x30004; comptime { - if (c.PA_ABI != abi) @compileError("addon.zig speaks ABI 3.3 and the header another"); + if (c.PA_ABI != abi) @compileError("addon.zig speaks ABI 3.4 and the header another"); } /// A word the kind brings: `opens` a pane of it, else goes to the pane's @@ -160,6 +160,10 @@ pub const Window = struct { /// The view painted (View.id), and whether it shows pictures as glyph art. view: u8, glyphs: bool, + /// The theme's search hits and the current one (a pardes older than + /// ABI 3.4: the amber its PDFs drew them in). + hit: Color, + hit_current: Color, /// `text` (UTF-8) from column x of row y on, a character a cell, cut at /// the edge: column first, where the header's pa_put is row first. @@ -315,7 +319,9 @@ pub fn ops(comptime T: type) c.pa_ops { if (@hasDecl(T, "prefix")) t.*.prefix_len = write(T.prefix, s, &t.*.prefix, t.*.prefix.len); } fn paint(st: ?*anyopaque, w: [*c]const c.pa_window, out: [*c]c.pa_paint) callconv(.c) void { - T.paint(self(st) orelse return, .{ .cells = w.*.cells, .stride = w.*.stride, .cols = w.*.cols, .rows = w.*.rows, .cell_w = w.*.cell_w, .cell_h = w.*.cell_h, .focused = w.*.focused != 0, .view = w.*.view, .glyphs = w.*.glyphs != 0 }, .{ .out = out }); + const amber: Color = .rgb(0xff, 0xd5, 0x4f); + const hits = api.abi >= 0x30004; + T.paint(self(st) orelse return, .{ .cells = w.*.cells, .stride = w.*.stride, .cols = w.*.cols, .rows = w.*.rows, .cell_w = w.*.cell_w, .cell_h = w.*.cell_h, .focused = w.*.focused != 0, .view = w.*.view, .glyphs = w.*.glyphs != 0, .hit = if (hits) @fromBackingInt(w.*.hit) else amber, .hit_current = if (hits) @fromBackingInt(w.*.hit_current) else amber }, .{ .out = out }); } fn view(st: ?*anyopaque, v: [*c]const c.pa_view) callconv(.c) void { T.view(self(st) orelse return, @as(*const View, @ptrCast(v)).*); |
