diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-05 22:21:45 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 23:08:36 -0300 |
| commit | 71e5a0f4a8685b385fac762995d45575b638179f (patch) | |
| tree | bf643875b0567b45cf659c1b3ad4b872f311a774 /src/ninep/screen.zig | |
| parent | d8e5fc18f5923c4213de1cb4105a677e725200af (diff) | |
| download | pardes-71e5a0f4a8685b385fac762995d45575b638179f.tar.gz pardes-71e5a0f4a8685b385fac762995d45575b638179f.zip | |
kinds #1, the paint contract: a picture over the cells is one Placement (raster: ptr, w, h, stride; src in pixels; dst in the frame's cells; at, where in them in pixels, or none for the frontend to fit; key, the pixels' identity by pane serial, page and revision; a terminal program's kitty z; dirty, the rows changed since an older key; art, the pane's Petscii, Palette and Ascii), where ImagePlace carried native.{revision, page, fit, pan_x, pan_y, geometry, pixel_offset_y, paper_bg, exact}, cell rects and an ImageCacheKey of three shapes by build; a PDF strip's scroll is its body region's scroll_px, whose fraction the window draws as pixel_offset_y was; glyph art leaves the core for src/Art.zig, the frontends' (the matcher, both palettes and a cache by key, ex image.zig's GlyphArt and TerminalImages' glyph cache): the core always hands an image pane, a PDF's pages and a terminal's kitty images as placements, whatever the frontend shows, and the tty draws them as glyph art without kitty graphics or when the pane asks, the window when the pane asks; the four words set the same pane bytes as before and the frontend reads them off the placement, so config.zig, builtins.zig and exec.zig are untouched; /screen lists a frame's placements as images (only a frame with pictures has the field); no golden changes: the snapshot goldens are the tty's, which draws the same art (images.snap and tagbottomimage.snap pass unchanged, and the tty's bytes for an image, its Palette and its Ascii are byte-identical to the base's), no /screen golden holds a picture, and the window's goldens hash the same; tests: kitty.zig's glyph-art case becomes its core half (a placement over the 8x4 cells, the cells the pane's) with the art in tui.zig's own test, terminal.zig's glyph-art case the same, surface.zig's two ImageCacheKey cases one keyOf case, the GlyphArt cases move to Art.zig with a frame case; gates: core-test 959/959, behaviour-test 244/244, unit-test 1486/1487 tui and 1530/1531 gui, pane-test 171/172, snap all ok, process-test 0 of 37 failed on both, hxdiff 19 and hxparity 6 mismatches by the base's names, replicas, gui-golden, monkey-gui, kitty-test 44/44, kitty-harness and image-harness on both, daemon.py main and window-clients
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/ninep/screen.zig')
| -rw-r--r-- | src/ninep/screen.zig | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/ninep/screen.zig b/src/ninep/screen.zig index 71b656d2..8d8b6e33 100644 --- a/src/ninep/screen.zig +++ b/src/ninep/screen.zig @@ -39,7 +39,24 @@ pub fn render(p: *Pardes) ![]u8 { if (i != 0) try writer.writeByte(','); try std.json.Stringify.value(.{ if (cell.default) " " else cell.grapheme(), index }, .{}, writer); } - try writer.writeAll("]}\n"); + try writer.writeByte(']'); + // The pictures over the cells, which every frontend realises its own + // way (pixels, or glyph art in `rect`'s cells): a frame without any + // has no `images`. + if (surface.placements.items.len > 0) { + try writer.writeAll(",\"images\":["); + for (surface.placements.items, 0..) |place, i| { + if (i != 0) try writer.writeByte(','); + const serial = if (p.panes[place.pane]) |pane| pane.serial else 0; + try writer.print("{{\"serial\":{d},\"rect\":[{d},{d},{d},{d}],\"src\":[{d},{d},{d},{d}],\"key\":\"{x:0>16}\",\"petscii\":{}}}", .{ + serial, place.dst.x, place.dst.y, place.dst.w, place.dst.h, + place.src.x, place.src.y, place.src.w, place.src.h, place.key, + place.art.glyph, + }); + } + try writer.writeByte(']'); + } + try writer.writeAll("}\n"); return out.toOwnedSlice(); } @@ -266,8 +283,8 @@ test "screen inspection leaves the next real frame as it would have been" { try testing.expectEqual(expected.rows, actual.rows); try testing.expectEqualDeep(expected.cursor, actual.cursor); try testing.expectEqual(expected.cells.len, actual.cells.len); - try testing.expectEqual(@as(usize, 0), expected.images.items.len); - try testing.expectEqual(@as(usize, 0), actual.images.items.len); + try testing.expectEqual(@as(usize, 0), expected.placements.items.len); + try testing.expectEqual(@as(usize, 0), actual.placements.items.len); for (expected.cells, actual.cells) |*left, *right| try testing.expect(left.visuallyEqual(right)); control.presented(); inspected.presented(); |
