diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 02:31:20 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | f749eb712d990a9b03f1db372d5311e77bd32edd (patch) | |
| tree | ee4d9966f1eb293054b7ed865c9d4d6eb49e432b /src/builtins.zig | |
| parent | 8f6621f9f70db86d56266a59b56dfb92b324b0d9 (diff) | |
| parent | b3d32656413734952bc918c2d4cfd12fede6c214 (diff) | |
| download | pardes-f749eb712d990a9b03f1db372d5311e77bd32edd.tar.gz pardes-f749eb712d990a9b03f1db372d5311e77bd32edd.zip | |
integration: the terminal behind src/Term.zig, with the diff viewer and the plumber's first phase
A merge of term-phase0 and pardes-next. File.zig's recolorSyntax keeps the theme's grounds and names Term.Filter and Term.Span; the changelog keeps both sides' entries, the palette sentence in the place of the entry the terminal work cut down. core-test 985/985 on tui; the diff, pager and tree process cases pass, goldens unchanged.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src/builtins.zig')
| -rw-r--r-- | src/builtins.zig | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/builtins.zig b/src/builtins.zig index b2690920..d106330e 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -74,8 +74,7 @@ pub const PaneKind = enum { .image => pane.addon != null, .picture => pane.addon != null or pane.isTerminal(), .program_colors => pane.isTerminal() or (pane.file != null and pane.file.?.pager), - .diff => if (pane.file) |f| pane.colorAlgo() == .diff or - (f.output != null and std.meta.eql(f.output.?.from, panes.Output.Origin{ .cmd = .Diff })) else false, + .diff => @import("hunks.zig").shows(pane), }; } @@ -1094,17 +1093,12 @@ pub const Filter = struct { }; /// Stack a diff's hunks as a diff viewer shows them, each under its place and the declarations around it, in a +Diff; on a +Diff, show the diff itself as text. +/// The diff viewer's one registration: its word and traits here, all else +/// its own (hunks.zig). pub const Diff = struct { pub const needs: PaneKind = .diff; pub const output: OutputTraits = .{ .name = config.diff_buffer, .steps = true, .locations = true }; - pub fn run(c: Ctx) void { - const f = &c.pane.file.?; - if (panes.Output.diffSource(c.p, f)) |source| return panes.Output.showDiffText(c.p, c.id, source); - _ = panes.Output.openDiff(c.p, c.id, f.path, f.content) catch |err| switch (err) { - error.NoHunks => c.p.reportFailure(c.id, "Diff: no hunk in it"), - else => c.p.reportError(c.id, "hunks", err), - }; - } + pub const run = @import("hunks.zig").word; }; /// Cycle the pane's input modes: terminals add raw tty mode to normal/insert. |
