From 8a40a71e2eab06452ad55aacfeaf78a85586f3dd Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 24 Nov 2026 15:20:26 -0300 Subject: gui: a picture is cut at its pane's right edge again: imageScissor's width is its placement's cells, as it was before 654a1632400a: that build (nvuylkxw, installed 2026-11-24 14:50) carried a throwaway line of the clip experiment (`+ 100000, // THROWAWAY: past any target`: every picture's clip run 100000 px past its width, so that SDL's scissor assertion could be met and the hold in sketchbook shown), restored in another workspace through `../pardes` from the shared sketchbook checkout and so kept in this one; held to the target by sketchbook's Cells.onTarget it asserted nothing, but 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 of 77 frames identical); TEST: gui.zig "a picture's scissor is its placement's cells, cut at its pane's edges" (fails on 654a1632400a: w 100040 for 40); the same change as yrslyomp on the multi-client line, put on main by itself for an install of its own Co-Authored-By: Claude Opus Co-Authored-By: Claude Fable 5.2 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