From f0b23904f81d261b4f80544bf3c5cc7aafbf440b Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 24 Nov 2026 15:20:26 -0300 Subject: gui: imageScissor is the placement's cells again: item 3's change (nvuylkxw, installed as 654a1632400a) kept a throwaway line of its own experiment (every picture's clip widened by 100000 px, to make SDL's scissor assertion fire on the test surface), restored in the wrong tree (a copy from inside the sketchbook checkout, whose ../pardes is ws-gate's): held to the target by sketchbook's Cells.onTarget it asserted nothing, but a picture was no longer cut at its pane's right edge (a PDF page or an image wider than its pane drew over the panes to its right); no gate row has a picture past its pane's right edge (77/77 frames identical with it); TEST FIRST: gui.zig "a picture's scissor is its placement's cells, cut at its pane's edges" (expected 40, found 100040 on the installed line; passes now) Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- dev/gui/gui.zig | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'dev/gui') diff --git a/dev/gui/gui.zig b/dev/gui/gui.zig index 9ea813fc..aba74a94 100644 --- a/dev/gui/gui.zig +++ b/dev/gui/gui.zig @@ -3904,7 +3904,7 @@ fn imageScissor(g: *const Gui, place: pardes.Placement) c.SDL_Rect { return .{ .x = @intCast(@as(u32, place.dst.x) * g.cell_w), .y = @intCast(@as(u32, place.dst.y) * g.cell_h), - .w = @intCast(@as(u32, place.dst.w) * g.cell_w + 100000), // THROWAWAY: past any target + .w = @intCast(@as(u32, place.dst.w) * g.cell_w), .h = @intCast(@as(u32, place.dst.h) * g.cell_h), }; } @@ -7010,6 +7010,13 @@ test "a held key moves the view at the stream's own rate, never a bounce a line, for (70..90) |k| try std.testing.expectEqual(held.carets[70], held.carets[k]); } +test "a picture's scissor is its placement's cells, cut at its pane's edges" { + const g = testGui(10, 20, 6, 12); + var place: pardes.Placement = undefined; + place.dst = .{ .x = 2, .y = 3, .w = 4, .h = 5 }; + try std.testing.expectEqual(c.SDL_Rect{ .x = 20, .y = 60, .w = 40, .h = 100 }, imageScissor(&g, place)); +} + test "a scroll's shifted rows start under the context rows, and its scissor below their band" { var surface: pardes.Surface = .{}; var g = testGui(10, 20, 6, 12); -- cgit v1.3