Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

Merge branch 'ui/tui-scrollbar-osc52' into verify/tui-interaction-audit

Rach Pradhanafb4696e2411
diff --cc TUI/glyphs.zig
index 5f601ac0,663a14db..0ce694bf
--- a/TUI/glyphs.zig
+++ b/TUI/glyphs.zig
@@@ -127,15 -114,12 +129,20 @@@ pub const system = "\u{00B7}"
pub const denied = "\u{2298}";
pub const failed = "\u{2717}";
pub const cursor = "\u{258B}";
+ /// The transcript scrollbar's thumb (scrollbar.zig). Narrow-class on purpose:
+ /// it is painted ON the last column, so a glyph a terminal draws two cells wide
+ /// would push itself off the row. The Block Elements (▐, █) read better and are
+ /// EAW-Ambiguous, which is exactly the trade this registry exists to refuse.
+ pub const scroll_thumb = "\u{275A}";
+/// The tool-run disclosure pair. Both are EAW-Narrow — ONE column in every
+/// terminal, ambiguous-wide setting included — so flipping a run open cannot
+/// shift the verb beside it by a column. The `chev_flip` animation below is
+/// what asserts that; the pair is a state change, not a tick, but the width
+/// law it has to obey is the animated one.
+pub const chev_closed = "\u{203A}";
+pub const chev_open = "\u{2304}";
+
fn lookup(cp: u21) ?Glyph {
for (registry) |g| {
if (g.cp == cp) return g;
diff --cc TUI/keys.zig
index 70b2aa4f,0bc037a9..a0e29144
--- a/TUI/keys.zig
+++ b/TUI/keys.zig
@@@ -170,10 -169,11 +170,15 @@@ fn pageSize(self: *const Model) u32
}
pub fn scrollBy(self: *Model, delta: i32) void {
+ // The content slid out from under a pointer that never moved: the hovered
+ // row now names a different entry, so the affordance is dropped and the
+ // next motion report re-arms it.
+ hover.scrolled(self);
+ // Every door into the viewport comes through here — wheel, arrows, page
+ // keys — so this is the one place the scrollbar's fade clock has to be
+ // wound (scrollbar.zig). A tail-parked viewport shows the gutter for a
+ // moment after the last movement and then lets it go.
+ self.scroll_seen_ms = @max(self.now_ms, 1);
if (delta > 0) {
self.scroll +|= @as(usize, @intCast(delta));
self.follow = false;
diff --cc TUI/render.zig
index 7cbd79ef,d631fd3f..c895fcd7
--- a/TUI/render.zig
+++ b/TUI/render.zig
@@@ -9,9 -9,9 +9,10 @@@ const app = @import("app.zig")
const chrome = @import("chrome.zig");
const engine = @import("engine.zig");
const glyphs = @import("glyphs.zig");
+const hover = @import("hover.zig");
- const scrollback = @import("scrollback.zig");
const layout_cache = @import("layout_cache.zig");
+ const scrollbar = @import("scrollbar.zig");
+ const scrollback = @import("scrollback.zig");
const scrollpaint = @import("scrollpaint.zig");
const selection = @import("selection.zig");
const theme_mod = @import("theme.zig");
@@@ -189,14 -190,20 +191,23 @@@ pub fn render(self: *Model, gpa: std.me
if (image_card[image_card.len - 1] != '\n') try out.append('\n');
}
try out.appendSlice(bottom_block);
- self.paint_hint = scrollHint(self, prev_band);
- // Hover and selection are both post-passes over the finished frame: the row
- // builders stay unaware of either, and both land on screen rows exactly as
- // the mouse reported them (#529). Hover runs FIRST so a drag band painted
- // over the same row wins — a selection CLAIMS a region, a hover tint only
- // announces one.
- // Selection is a post-pass over the finished frame: the row builders stay
- // unaware of it, and the band lands on screen rows exactly as the mouse
- // reported them (#529).
- const banded = try selection.paint(self, a, out.items, width);
++ // Hover, selection and the scroll gutter are all post-passes over the
++ // finished frame: the row builders stay unaware of all three, and each
++ // lands on screen rows exactly as the mouse reported them (#529). Hover
++ // runs FIRST so a drag band painted over the same row wins — a selection
++ // CLAIMS a region, a hover tint only announces one.
+ const hovered = try hover.paint(self, a, out.items, width);
- return gpa.dupe(u8, try selection.paint(self, a, hovered, width));
++ const banded = try selection.paint(self, a, hovered, width);
+ // The scroll gutter goes LAST, after the capture: the thumb is chrome the
+ // selection must never copy, and it hides for the duration of a drag
+ // anyway (scrollbar.zig owns both halves of that rule).
+ const had_gutter = self.gutter_on;
+ const painted = try scrollbar.paint(self, a, banded, width);
- // The hint describes the FINISHED frames, so it is taken after both
- // post-passes: the gutter reshapes every band row, and whether the painter
++ // The hint describes the FINISHED frames, so it is taken after every
++ // post-pass: the gutter reshapes every band row, and whether the painter
+ // may scroll them depends on the two frames having the same shape.
+ self.paint_hint = scrollHint(self, prev_band, had_gutter and self.gutter_on);
+ return gpa.dupe(u8, painted);
}
/// `count` mid rows starting at `from`, taken from the layout cache when the
diff --cc TUI/root.zig
index 3fc9fe01,79d80901..694e0e53
--- a/TUI/root.zig
+++ b/TUI/root.zig
@@@ -66,9 -64,9 +66,12 @@@ test
_ = @import("layout_cache.zig");
_ = @import("selection.zig");
_ = @import("selection_tests.zig");
+ _ = @import("theme_tint.zig");
+ _ = @import("hover.zig");
+ _ = @import("hover_tests.zig");
+ _ = @import("osc52.zig");
+ _ = @import("scrollbar.zig");
+ _ = @import("scrollbar_tests.zig");
_ = @import("chrome.zig");
_ = @import("models.zig");
_ = @import("markdown.zig");
diff --cc scripts/eval-tier1.sh
index 04061491,bd2148ba..593e130c
--- a/scripts/eval-tier1.sh
+++ b/scripts/eval-tier1.sh
@@@ -307,15 -299,16 +307,25 @@@ if wanted tuiguard; the
if python3 scripts/test-tui-stream-markdown.py zig-out/bin/graff; then :; else
record_fail tuiguard
fi
+ # A clickable row has to LOOK clickable. Runs a real tool loop against the
+ # codex mock, then reads CELLS off a virtual screen: the hovered summary
+ # takes the theme's hover background and its ◆ becomes ›, its neighbour is
+ # untouched, leaving restores it, a single click still expands, and a
+ # double click is one net toggle. With the post-pass refused the probe
+ # fails on the tint (verified), so this is a gate on both halves.
+ if python3 scripts/test-tui-hover.py zig-out/bin/graff; then :; else
+ record_fail tuiguard
+ fi
+ # The scroll gutter has to land on a CELL and then leave no trace, and the
+ # OSC 52 copy has to leave the process — neither is visible to a unit test.
+ # Reads the thumb off the last column of the virtual screen, compares that
+ # column against a forced full repaint once it fades, and matches the
+ # base64 on the wire against the rows the drag covered. Each of the three
+ # is a verified gate: removing the fade rule, the fade EXPIRY, or the tty
+ # write each fails a different check.
+ if python3 scripts/test-tui-scrollbar-osc52.py zig-out/bin/graff; then :; else
+ record_fail tuiguard
+ fi
fi
fi