summaryrefslogtreecommitdiff
path: root/src/Output.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-12 10:56:42 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commitf2b02c455f2bcdfb905a015eefbb630a28b4b12e (patch)
treec344c7ad42ec288dd5e1ebd0eb6d25f5aa2fbccc /src/Output.zig
parentfc38c73c59f7855a4caad8aa4d3bb8e023309c13 (diff)
downloadpardes-f2b02c455f2bcdfb905a015eefbb630a28b4b12e.tar.gz
pardes-f2b02c455f2bcdfb905a015eefbb630a28b4b12e.zip
addons: an addon can hand the frontend a GPU scene (ABI 3.1), and a snake drawn by shaders does; a commit's patch keeps its own +Diff pane; a real ZLS checked through the window build
ABI 3.1 appends an optional `gpu` callback and its context to pa_paint: one self-contained sketchbook SGPU v1 scene for the pane, at most 4 MiB, copied during the call, the last successful call winning. The SDL frontend runs it on its own GPU through sketchbook's executor and composites its target texture into the pane; replicas carry the scene beside the authoritative pane frame; cells and rasters stay the fallback for terminals, older hosts and frontends without an executor. addons/snake_shader is such an addon (`zig build snake-shader`, the SnakeShader word: a board that follows its pane, buffered turns, a CRT look), with test/gpu_snake.py, test/gpu_snake_interaction.py and test/gpu_upgrade.py. Commit patches open as `+Diff-<short-hash>` and reuse only their own commit's pane, so another paged patch no longer replaces one already open. The language-server client looks in the standard per-user bin directory, which desktop launchers often leave out of PATH, and takes an empty answer that beats the startup progress notification onto the wire; test/real_zls.py checks imports, hover, references, rename previews, diagnostics and completion against a real ZLS from a private home. The dump's schema reader skips two fields older builds persisted, and a replica's shadow of a kind ticks when the authority's does. The reference, the guide, the building and setup notes and the changelog say so. The working copy as it stood on 2026-11-12; message written by Claude from the diff, at the author's request.
Diffstat (limited to 'src/Output.zig')
-rw-r--r--src/Output.zig16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/Output.zig b/src/Output.zig
index bb75e29f..0c6fdfc2 100644
--- a/src/Output.zig
+++ b/src/Output.zig
@@ -15,6 +15,7 @@ const look = @import("look.zig");
const locations = @import("locations.zig");
const layout = @import("layout.zig");
const hunks = @import("hunks.zig");
+const diff = @import("diff.zig");
const Pane = panes.Pane;
const File = panes.File;
@@ -439,6 +440,8 @@ pub fn fillRows(p: *Pardes, id: usize, dir: []const u8, from: Origin, arg: []con
if (!shared and !std.meta.eql(o.from, from)) continue;
if (!shared and by_arg and !std.mem.eql(u8, o.arg(), arg)) continue;
if (!std.mem.eql(u8, std.Io.Dir.path.dirname(rf.path) orelse "", dir)) continue;
+ if (std.meta.eql(from, Origin{ .cmd = .Diff }) and
+ !std.mem.eql(u8, diff.commitHash(rf.content) orelse "", diff.commitHash(result_content) orelse "")) continue;
o.from = from;
p.fs.refilled = rp.serial;
try setArg(o, arg);
@@ -497,7 +500,18 @@ pub fn openDiff(p: *Pardes, id: usize, path: []const u8, content: []const u8) !u
for (result.rows) |row| has_hunk = has_hunk or row.kind == .match;
if (!has_hunk) return error.NoHunks;
const arg = if (std.mem.eql(u8, root, dir) or path.len > max_arg) std.Io.Dir.path.basename(path) else path;
- return fillRows(p, id, root, .{ .cmd = .Diff }, arg, result.content, result.rows, null);
+ const title = if (diff.commitHash(content)) |hash|
+ try std.fmt.allocPrint(p.gpa, "{s}/{s}-{s}", .{ std.mem.trimEnd(u8, root, "/"), config.diff_buffer, hash[0..@min(hash.len, 12)] })
+ else
+ null;
+ errdefer if (title) |name| p.gpa.free(name);
+ const hid = try fillRows(p, id, root, .{ .cmd = .Diff }, arg, result.content, result.rows, null);
+ if (title) |name| {
+ const f = &p.panes[hid].?.file.?;
+ p.gpa.free(f.path);
+ f.path = name;
+ }
+ return hid;
}
/// Diff on a +Diff: the diff it stacks, as text. A pane holding it