From 28c74918cde4092d964daa847c026ed3de282683 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 00:35:37 -0300 Subject: A terminal pane draws the kitty graphics its program places, so yazi's image and PDF previews show yazi asks the pane XTVERSION, and ghostty-vt answers "libghostty": yazi takes it for Ghostty and sends its previews by the kitty graphics protocol with Unicode placeholders (a=T,U=1, then U+10EEEE cells). ghostty-vt stored the images, but nothing drew them: the placeholders showed as tofu in the GUI and as raw codepoints in the tty, in every build since terminal panes answered queries (vkznsvzs, 2026-07-01). Before that no query was answered and yazi fell back to chafa's text art. Each frame, TerminalImages.zig reads the active screen's images and placements (virtual ones through their placeholder runs, and ones placed on a cell), cuts each into the cell rows it covers, maps those rows through the body's own row walk, clips them to the pane, and hands them on as ImagePlaces with exact geometry (NativePlacement.exact). The GUI draws them as textures; the tty passes them to an outer terminal with kitty graphics as one placement per row, its source cropped to whole cells. Placeholder cells draw no text. Scrolling, a delete, a resize, the alternate screen and a closed pane all fall out of reading the emulator's state every frame. A pane now knows its size in pixels: CSI 14/16/18 t are answered, the emulator's width_px/height_px follow the shell's cells, and the pty's winsize carries pixels (host_io.ptyWinsize), so yazi and a nested pardes size their images right. ghostty-vt's image store is 64 MiB per screen (its library default, 10 MB, refused a large preview), PNG transmissions are decoded with stb_image, and RGB images are converted only while shown. test/yazi_preview.py runs yazi in a hidden window on a PNG and a PDF and checks the captures, also through a tty pardes nested in the pane. Co-Authored-By: Claude Opus 5.5 --- src/TerminalImages.zig | 247 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 247 insertions(+) create mode 100644 src/TerminalImages.zig (limited to 'src/TerminalImages.zig') diff --git a/src/TerminalImages.zig b/src/TerminalImages.zig new file mode 100644 index 00000000..773297b2 --- /dev/null +++ b/src/TerminalImages.zig @@ -0,0 +1,247 @@ +//! A terminal pane's kitty graphics: the images its program sent (yazi's +//! previews, `kitten icat`) drawn where it placed them. ghostty-vt keeps +//! the images and placements; this reads them each frame, cuts each one +//! into the cell rows it covers, clipped to the rows the pane shows, and +//! hands them on as pixels (`ImagePlace`, exact geometry) to a shell that +//! draws them. +//! Both kinds of placement are drawn: one on a cell (`a=T`/`a=p`), which +//! moves with the text it was put on, and a virtual one (`U=1`) shown +//! through the U+10EEEE placeholder cells the program prints. +const std = @import("std"); +const ghostty_vt = @import("ghostty-vt"); +const pardes = @import("pardes.zig"); +const image = @import("image.zig"); + +const TerminalImages = @This(); +const gfx = ghostty_vt.kitty.graphics; +const PixelRect = image.PixelRect; + +/// The bytes ghostty-vt may hold for one screen's images (it evicts the +/// oldest past this): a 4K picture in RGBA, with room for a second. +pub const storage_limit = 64 * 1024 * 1024; + +/// Pixels in RGBA for images ghostty-vt holds in another format (RGB, +/// grey): only for images on screen, dropped the frame they are not. +converted: std.AutoHashMapUnmanaged(u32, Converted) = .empty, + +const Converted = struct { generation: u64, rgba: []u8, used: bool = true }; + +/// One image's rectangle in the pane, in pixels from the viewport's top +/// left corner (above or left of it is negative). +const Rect = struct { x: i64, y: i64, w: i64, h: i64 }; + +pub fn deinit(ti: *TerminalImages, gpa: std.mem.Allocator) void { + var conv = ti.converted.valueIterator(); + while (conv.next()) |c| gpa.free(c.rgba); + ti.converted.deinit(gpa); +} + +/// Accept PNG (`f=100`) as well as raw pixels: ghostty-vt built as a +/// library decodes none itself. stb_image does it, as for image panes. +pub fn installPngDecoder() void { + ghostty_vt.sys.decode_png = &decodePng; +} + +fn decodePng(gpa: std.mem.Allocator, bytes: []const u8) ghostty_vt.sys.DecodeError!ghostty_vt.sys.Image { + const decoded = image.decode(gpa, bytes) orelse return error.InvalidData; + return .{ .width = @intCast(decoded.w), .height = @intCast(decoded.h), .data = decoded.rgba }; +} + +/// Draw the active screen's images. `rows_of[v]` is the body row the +/// viewport's row `v` is shown on, if it is shown; `cols` how many of its +/// columns the body shows, from `tx`. +pub fn draw( + ti: *TerminalImages, + p: *pardes.Pardes, + s: *pardes.Surface, + vt: *ghostty_vt.Terminal, + pane_id: u8, + serial: u32, + tx: u16, + body_y: u16, + cols: u16, + rows_of: []const ?u16, +) void { + var conv = ti.converted.valueIterator(); + while (conv.next()) |c| c.used = false; + defer ti.prune(p.gpa); + + const screen = vt.screens.active; + const storage = &screen.kitty_images; + const pages = &screen.pages; + const top = pages.getTopLeft(.viewport); + const bottom = pages.getBottomRight(.viewport) orelse return; + const cw: u32 = @max(1, p.cell_pixels.w); + const ch: u32 = @max(1, p.cell_pixels.h); + const ctx: Ctx = .{ .ti = ti, .p = p, .pane = pane_id, .serial = serial, .tx = tx, .body_y = body_y, .cols = cols, .rows_of = rows_of, .cw = cw, .ch = ch }; + + // Virtual placements: shown through the placeholder cells, one run of + // them on a row at a time. The placeholders themselves are not text. + var runs = gfx.unicode.placementIterator(top, bottom); + while (runs.next()) |run| { + const at = pages.pointFromPin(.viewport, run.pin) orelse continue; + const v = at.viewport.y; + if (v >= rows_of.len) continue; + const row = rows_of[v] orelse continue; + for (@as(usize, at.viewport.x)..@as(usize, at.viewport.x) + run.width) |x| { + if (x >= cols) break; + const cell = s.at(tx + @as(u16, @intCast(x)), body_y + row); + cell.text[0] = ' '; + cell.len = 1; + } + const img = storage.imageById(run.image_id) orelse continue; + const rp = run.renderPlacement(storage, &img, cw, ch) catch continue; + if (rp.dest_width == 0 or rp.dest_height == 0 or rp.source_width == 0 or rp.source_height == 0) continue; + ctx.place(img, .{ .x = rp.source_x, .y = rp.source_y, .w = rp.source_width, .h = rp.source_height }, .{ + .x = @as(i64, at.viewport.x) * cw + rp.offset_x, + .y = @as(i64, v) * ch + rp.offset_y, + .w = rp.dest_width, + .h = rp.dest_height, + }); + } + + // Placements on a cell: they move with the text they were put on, and + // go where it goes, above the viewport or off the screen. + const origin = pages.pointFromPin(.screen, top) orelse return; + var it = storage.placements.iterator(); + while (it.next()) |entry| { + const placed = entry.value_ptr.*; + const pin = switch (placed.location) { + .pin => |pin| pin, + .virtual => continue, + }; + const img = storage.images.get(entry.key_ptr.image_id) orelse continue; + const at = pages.pointFromPin(.screen, pin.*) orelse continue; + const size = placed.pixelSize(img, vt); + const sx = @min(placed.source_x, img.width); + const sy = @min(placed.source_y, img.height); + const sw = if (placed.source_width > 0) @min(placed.source_width, img.width - sx) else img.width - sx; + const sh = if (placed.source_height > 0) @min(placed.source_height, img.height - sy) else img.height - sy; + if (size.width == 0 or size.height == 0 or sw == 0 or sh == 0) continue; + ctx.place(img, .{ .x = sx, .y = sy, .w = sw, .h = sh }, .{ + .x = @as(i64, at.screen.x) * cw + placed.x_offset, + .y = (@as(i64, at.screen.y) - @as(i64, origin.screen.y)) * ch + placed.y_offset, + .w = size.width, + .h = size.height, + }); + } +} + +const Ctx = struct { + ti: *TerminalImages, + p: *pardes.Pardes, + pane: u8, + serial: u32, + tx: u16, + body_y: u16, + cols: u16, + rows_of: []const ?u16, + cw: u32, + ch: u32, + + /// Draw `src` of `img` over `dst`, one cell row of it at a time: a row + /// is shown, or not, or shown elsewhere, as the body lays it out. + fn place(ctx: Ctx, img: gfx.Image, src: PixelRect, dst: Rect) void { + const cw: i64 = ctx.cw; + const ch: i64 = ctx.ch; + const x0 = @max(dst.x, 0); + const x1 = @min(dst.x + dst.w, @as(i64, ctx.cols) * cw); + if (x1 <= x0) return; + const rgba = ctx.ti.pixelsOf(ctx.p.gpa, img) orelse return; + const first_row = @divFloor(@max(dst.y, 0), ch); + const last_row = @min(@divFloor(dst.y + dst.h - 1, ch), @as(i64, @intCast(ctx.rows_of.len)) - 1); + var v = first_row; + while (v <= last_row) : (v += 1) { + const row = ctx.rows_of[@intCast(v)] orelse continue; + const y0 = @max(dst.y, v * ch); + const y1 = @min(dst.y + dst.h, (v + 1) * ch); + if (y1 <= y0) continue; + // The source pixels under this piece, by the same scale. + const piece: PixelRect = .{ + .x = src.x + @as(u32, @intCast(@divFloor((x0 - dst.x) * src.w, dst.w))), + .y = src.y + @as(u32, @intCast(@divFloor((y0 - dst.y) * src.h, dst.h))), + .w = @max(1, @as(u32, @intCast(@divFloor((x1 - x0) * src.w, dst.w)))), + .h = @max(1, @as(u32, @intCast(@divFloor((y1 - y0) * src.h, dst.h)))), + }; + const c0: u16 = @intCast(@divFloor(x0, cw)); + const c1: u16 = @intCast(@divFloor(x1 + cw - 1, cw)); + _ = ctx.p.appendImagePlace(.{ + .pane = ctx.pane, + .serial = ctx.serial, + .native = .{ + .page = img.id, + .revision = @truncate(img.generation), + .exact = true, + .geometry = .{ .src = piece, .dst = .{ + .x = @intCast(x0 - @as(i64, c0) * cw), + .y = @intCast(y0 - v * ch), + .w = @intCast(x1 - x0), + .h = @intCast(y1 - y0), + } }, + }, + .x = ctx.tx + c0, + .y = ctx.body_y + row, + .w = c1 - c0, + .h = 1, + .rgba = rgba, + .iw = img.width, + .ih = img.height, + }); + } + } +}; + +/// The image's pixels as RGBA: its own bytes when it is held so. +fn pixelsOf(ti: *TerminalImages, gpa: std.mem.Allocator, img: gfx.Image) ?[]const u8 { + const n = @as(usize, img.width) * img.height; + if (n == 0) return null; + if (img.format == .rgba) return if (img.data.len == n * 4) img.data else null; + const gop = ti.converted.getOrPut(gpa, img.id) catch return null; + if (gop.found_existing) { + if (gop.value_ptr.generation == img.generation) { + gop.value_ptr.used = true; + return gop.value_ptr.rgba; + } + gpa.free(gop.value_ptr.rgba); + _ = ti.converted.remove(img.id); + return ti.pixelsOf(gpa, img); + } + const out = convert(gpa, img, n) orelse { + _ = ti.converted.remove(img.id); + return null; + }; + gop.value_ptr.* = .{ .generation = img.generation, .rgba = out }; + return out; +} + +fn convert(gpa: std.mem.Allocator, img: gfx.Image, n: usize) ?[]u8 { + const depth: usize = switch (img.format) { + .rgb => 3, + .gray_alpha => 2, + .gray => 1, + else => return null, + }; + if (img.data.len != n * depth) return null; + const out = gpa.alloc(u8, n * 4) catch return null; + for (0..n) |i| { + const px = img.data[i * depth ..][0..depth]; + out[i * 4 ..][0..4].* = switch (depth) { + 3 => .{ px[0], px[1], px[2], 255 }, + 2 => .{ px[0], px[0], px[0], px[1] }, + else => .{ px[0], px[0], px[0], 255 }, + }; + } + return out; +} + +/// Drop what this frame did not draw: the caches hold only what is shown. +fn prune(ti: *TerminalImages, gpa: std.mem.Allocator) void { + while (true) { + var conv = ti.converted.iterator(); + const stale = while (conv.next()) |entry| { + if (!entry.value_ptr.used) break entry.key_ptr.*; + } else break; + gpa.free(ti.converted.get(stale).?.rgba); + _ = ti.converted.remove(stale); + } +} -- cgit v1.3 From 0bb65902ebec104dac954b59f28500812419e1af Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 00:45:14 -0300 Subject: A terminal's kitty graphics draw as glyph art where pixels cannot, and by choice: Petscii on the pane, TermImages for new ones Under an outer terminal without kitty graphics a tty pardes cannot pass a terminal pane's images on, so it draws them itself as an image pane's Petscii does: each row of an image is matched to C64-palette glyph art over the cells it covers (GlyphArt.renderRect, the exact-grid half of GlyphArt.render), cached while it is on screen. yazi is still told the kitty protocol works, so it keeps sending its previews. The same art is a choice anywhere: the Petscii builtin now takes a terminal pane too (PaneKind.picture), flipping its images between pixels and glyphs, and a terminal holding images, or drawing them as glyphs by choice, says petscii:on|off in its tag as an image pane does. TermImages real|petscii (default real) is what a new terminal starts with; it is in DumpConfig, /ctl and the reference. Co-Authored-By: Claude Opus 5.5 --- docs/typ/reference.typ | 1 + src/TerminalImages.zig | 100 +++++++++++++++++++++++++++++++++++----------- src/builtins.zig | 11 +++++- src/config.zig | 11 +++++- src/image.zig | 21 +++++++--- src/ninep/ctl.zig | 2 +- src/pardes.zig | 1 + src/tagline.zig | 4 ++ src/terminal.zig | 105 ++++++++++++++++++++++++++++++++++++++++++++++++- 9 files changed, 222 insertions(+), 34 deletions(-) (limited to 'src/TerminalImages.zig') diff --git a/docs/typ/reference.typ b/docs/typ/reference.typ index 08fb1d83..3f895a8c 100644 --- a/docs/typ/reference.typ +++ b/docs/typ/reference.typ @@ -300,6 +300,7 @@ word clicked in a tag does. The same lines go in the startup file [`Placement acme|pardes`], [`acme`: where new panes go (#doc("tags", section: "new-panes"))], [`BootShell keep|replace`], [`keep`; `replace` closes the untouched lone shell a dragged document lands beside], [`LookWord search|list`], [`search`: a looked-at word selects its next place, or lists all in `+Search`], + [`TermImages real|petscii`], [`real`: a new terminal draws its program's kitty graphics (yazi's previews) as pixels where the shell can; #word("Petscii") flips one terminal; a tty under a terminal without kitty graphics draws them as glyph art either way], [`Shell `], [`$SHELL` when it is executable, else `/bin/sh`: the shell the next terminal and command pane run; a bare name is looked for in the usual bin directories, not `$PATH`; bare #word("Shell"): `$SHELL` if it is executable, else `/bin/sh`], [`DumpDir `], [`$XDG_DATA_HOME/pardes`, else `~/.local/share/pardes`: where #word("Dump") writes; bare returns to the default], [`TreeContext`], [off: sticky declaration headers in a source pane (per pane, dumped)], diff --git a/src/TerminalImages.zig b/src/TerminalImages.zig index 773297b2..bc1b2ea8 100644 --- a/src/TerminalImages.zig +++ b/src/TerminalImages.zig @@ -2,8 +2,8 @@ //! previews, `kitten icat`) drawn where it placed them. ghostty-vt keeps //! the images and placements; this reads them each frame, cuts each one //! into the cell rows it covers, clipped to the rows the pane shows, and -//! hands them on as pixels (`ImagePlace`, exact geometry) to a shell that -//! draws them. +//! hands them on: as pixels (`ImagePlace`, exact geometry) to a shell that +//! draws them, else as glyph art in the cells, as an image pane's Petscii. //! Both kinds of placement are drawn: one on a cell (`a=T`/`a=p`), which //! moves with the text it was put on, and a virtual one (`U=1`) shown //! through the U+10EEEE placeholder cells the program prints. @@ -14,17 +14,25 @@ const image = @import("image.zig"); const TerminalImages = @This(); const gfx = ghostty_vt.kitty.graphics; +const GlyphArt = image.GlyphArt; const PixelRect = image.PixelRect; /// The bytes ghostty-vt may hold for one screen's images (it evicts the /// oldest past this): a 4K picture in RGBA, with room for a second. pub const storage_limit = 64 * 1024 * 1024; +/// This pane draws its images as glyph art even where pixels could be +/// drawn (the Petscii builtin; TermImages sets it for a new pane). +petscii: bool = false, /// Pixels in RGBA for images ghostty-vt holds in another format (RGB, /// grey): only for images on screen, dropped the frame they are not. converted: std.AutoHashMapUnmanaged(u32, Converted) = .empty, +/// Glyph art for the fragments drawn as cells, kept while on screen. +glyphs: std.AutoHashMapUnmanaged(GlyphKey, Glyphs) = .empty, const Converted = struct { generation: u64, rgba: []u8, used: bool = true }; +const Glyphs = struct { cells: []GlyphArt.Cell, used: bool = true }; +const GlyphKey = struct { id: u32, generation: u64, src: PixelRect, cols: u16 }; /// One image's rectangle in the pane, in pixels from the viewport's top /// left corner (above or left of it is negative). @@ -34,6 +42,9 @@ pub fn deinit(ti: *TerminalImages, gpa: std.mem.Allocator) void { var conv = ti.converted.valueIterator(); while (conv.next()) |c| gpa.free(c.rgba); ti.converted.deinit(gpa); + var gl = ti.glyphs.valueIterator(); + while (gl.next()) |g| gpa.free(g.cells); + ti.glyphs.deinit(gpa); } /// Accept PNG (`f=100`) as well as raw pixels: ghostty-vt built as a @@ -64,6 +75,8 @@ pub fn draw( ) void { var conv = ti.converted.valueIterator(); while (conv.next()) |c| c.used = false; + var gl = ti.glyphs.valueIterator(); + while (gl.next()) |g| g.used = false; defer ti.prune(p.gpa); const screen = vt.screens.active; @@ -73,7 +86,8 @@ pub fn draw( const bottom = pages.getBottomRight(.viewport) orelse return; const cw: u32 = @max(1, p.cell_pixels.w); const ch: u32 = @max(1, p.cell_pixels.h); - const ctx: Ctx = .{ .ti = ti, .p = p, .pane = pane_id, .serial = serial, .tx = tx, .body_y = body_y, .cols = cols, .rows_of = rows_of, .cw = cw, .ch = ch }; + const pixels = p.native_images and !ti.petscii; + const ctx: Ctx = .{ .ti = ti, .p = p, .s = s, .pane = pane_id, .serial = serial, .tx = tx, .body_y = body_y, .cols = cols, .rows_of = rows_of, .cw = cw, .ch = ch, .pixels = pixels }; // Virtual placements: shown through the placeholder cells, one run of // them on a row at a time. The placeholders themselves are not text. @@ -130,6 +144,7 @@ pub fn draw( const Ctx = struct { ti: *TerminalImages, p: *pardes.Pardes, + s: *pardes.Surface, pane: u8, serial: u32, tx: u16, @@ -138,6 +153,7 @@ const Ctx = struct { rows_of: []const ?u16, cw: u32, ch: u32, + pixels: bool, /// Draw `src` of `img` over `dst`, one cell row of it at a time: a row /// is shown, or not, or shown elsewhere, as the body lays it out. @@ -165,27 +181,37 @@ const Ctx = struct { }; const c0: u16 = @intCast(@divFloor(x0, cw)); const c1: u16 = @intCast(@divFloor(x1 + cw - 1, cw)); - _ = ctx.p.appendImagePlace(.{ - .pane = ctx.pane, - .serial = ctx.serial, - .native = .{ - .page = img.id, - .revision = @truncate(img.generation), - .exact = true, - .geometry = .{ .src = piece, .dst = .{ - .x = @intCast(x0 - @as(i64, c0) * cw), - .y = @intCast(y0 - v * ch), - .w = @intCast(x1 - x0), - .h = @intCast(y1 - y0), - } }, - }, - .x = ctx.tx + c0, - .y = ctx.body_y + row, - .w = c1 - c0, - .h = 1, - .rgba = rgba, - .iw = img.width, - .ih = img.height, + if (ctx.pixels) { + _ = ctx.p.appendImagePlace(.{ + .pane = ctx.pane, + .serial = ctx.serial, + .native = .{ + .page = img.id, + .revision = @truncate(img.generation), + .exact = true, + .geometry = .{ .src = piece, .dst = .{ + .x = @intCast(x0 - @as(i64, c0) * cw), + .y = @intCast(y0 - v * ch), + .w = @intCast(x1 - x0), + .h = @intCast(y1 - y0), + } }, + }, + .x = ctx.tx + c0, + .y = ctx.body_y + row, + .w = c1 - c0, + .h = 1, + .rgba = rgba, + .iw = img.width, + .ih = img.height, + }); + continue; + } + // Glyph art fills whole cells: a sliver of a row is left out. + if ((y1 - y0) * 2 < ch) continue; + const cells = ctx.ti.glyphsOf(ctx.p.gpa, img, rgba, piece, c1 - c0) orelse continue; + for (cells, c0..) |*cell, x| ctx.s.set(ctx.tx + @as(u16, @intCast(x)), ctx.body_y + row, cell.glyph[0..cell.glyph_len], .{ + .fg = .{ .rgb = GlyphArt.commodore[cell.fg] }, + .bg = .{ .rgb = GlyphArt.commodore[cell.bg] }, }); } } @@ -234,6 +260,24 @@ fn convert(gpa: std.mem.Allocator, img: gfx.Image, n: usize) ?[]u8 { return out; } +fn glyphsOf(ti: *TerminalImages, gpa: std.mem.Allocator, img: gfx.Image, rgba: []const u8, piece: PixelRect, cols: u16) ?[]const GlyphArt.Cell { + const key: GlyphKey = .{ .id = img.id, .generation = img.generation, .src = piece, .cols = cols }; + if (ti.glyphs.getPtr(key)) |hit| { + hit.used = true; + return hit.cells; + } + const grid = GlyphArt.renderRect(gpa, rgba, img.width, img.height, piece, cols, 1, GlyphArt.commodore, true) catch return null; + if (grid.cells.len != cols) { + gpa.free(grid.cells); + return null; + } + ti.glyphs.put(gpa, key, .{ .cells = grid.cells }) catch { + gpa.free(grid.cells); + return null; + }; + return grid.cells; +} + /// Drop what this frame did not draw: the caches hold only what is shown. fn prune(ti: *TerminalImages, gpa: std.mem.Allocator) void { while (true) { @@ -244,4 +288,12 @@ fn prune(ti: *TerminalImages, gpa: std.mem.Allocator) void { gpa.free(ti.converted.get(stale).?.rgba); _ = ti.converted.remove(stale); } + while (true) { + var gl = ti.glyphs.iterator(); + const stale = while (gl.next()) |entry| { + if (!entry.value_ptr.used) break entry.key_ptr.*; + } else break; + gpa.free(ti.glyphs.get(stale).?.cells); + _ = ti.glyphs.remove(stale); + } } diff --git a/src/builtins.zig b/src/builtins.zig index fb6aa4cf..f51409aa 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -43,12 +43,16 @@ pub const PaneKind = enum { terminal, pdf, image, + /// An image pane, or a terminal, whose program's kitty graphics are + /// pictures too. + picture, pub fn has(kind: PaneKind, pane: *const panes.Pane) bool { return switch (kind) { .terminal => pane.isTerminal(), .pdf => pane.hasPdf(), .image => pane.image != null, + .picture => pane.image != null or pane.isTerminal(), }; } @@ -57,6 +61,7 @@ pub const PaneKind = enum { .terminal => "a terminal", .pdf => "a PDF", .image => "an image", + .picture => "an image or a terminal", }; } }; @@ -981,11 +986,13 @@ pub const PdfSections = struct { } }; -/// glyph art over the host's pixels +/// glyph art over the host's pixels: an image pane's picture, or the +/// kitty graphics a terminal's program placed (yazi's previews) pub const Petscii = struct { - pub const needs: PaneKind = .image; + pub const needs: PaneKind = .picture; pub fn run(c: Ctx) void { if (c.pane.image) |*state| panes.Image.toggleGlyphArt(state); + panes.terminal.togglePetscii(c.pane); } }; diff --git a/src/config.zig b/src/config.zig index 5a9cf070..b6eb4520 100644 --- a/src/config.zig +++ b/src/config.zig @@ -82,6 +82,7 @@ pub const leader_path = paths: { .BootShell = null, .LookWord = null, .Pager = null, + .TermImages = null, .Debug = "td", .Msg = null, .Colors = "tc", @@ -759,14 +760,19 @@ pub const Runtime = struct { /// PAGER and GIT_PAGER set to `pardes -`, a +Pager pane, where the /// user's environment set neither; `off`, the environment as it is. pager: Pager = .pardes, + /// How a new terminal pane draws the kitty graphics its program sends + /// (yazi's previews): `real`, as pixels where the shell can, or + /// `petscii`, as glyph art. The Petscii builtin flips one pane. + term_images: TermImages = .real, pub const ShaderAnimation = enum { off, on, always }; pub const Placement = enum { acme, pardes }; pub const BootShell = enum { keep, replace }; pub const LookWord = enum { search, list }; pub const Pager = enum { pardes, off }; + pub const TermImages = enum { real, petscii }; /// A setting that is one of a few words, each an enum field of Runtime. - pub const Choice = enum { placement, boot_shell, look_word, pager }; + pub const Choice = enum { placement, boot_shell, look_word, pager, term_images }; /// shadow: a soft drop shadow. rim: a light hairline along the top of /// the focused pane's tag rows. auto: a shadow on a light page; on a @@ -1032,6 +1038,7 @@ pub const Runtime = struct { .{ .word = "BootShell", .action = .{ .choice = .boot_shell }, .doc = "A document dropped where a lone untouched shell stands: keep the shell, or replace it." }, .{ .word = "LookWord", .action = .{ .choice = .look_word }, .doc = "A plain word looked at: search selects its next place in the pane, list lists every place in a +Search." }, .{ .word = "Pager", .action = .{ .choice = .pager }, .doc = "What a terminal's commands page through: pardes, a +Pager pane (pardes -), or off, the environment's own; for terminals started after it." }, + .{ .word = "TermImages", .action = .{ .choice = .term_images }, .doc = "How a new terminal draws its program's kitty graphics: real, as pixels where it can, or petscii, as glyph art." }, }; pub fn find(name: []const u8) ?Setting { @@ -1707,6 +1714,7 @@ pub const Runtime = struct { .boot_shell => "replace", .look_word => "list", .pager => "off", + .term_images => "petscii", }, .lift => "rim", .motion => "playful", @@ -1777,6 +1785,7 @@ pub const Runtime = struct { .boot_shell => "BootShell replace\n", .look_word => "LookWord list\n", .pager => "Pager off\n", + .term_images => "TermImages petscii\n", }, .lift => "Lift rim\n", .motion => "Motion playful\n", diff --git a/src/image.zig b/src/image.zig index 936fe19a..3a3f1932 100644 --- a/src/image.zig +++ b/src/image.zig @@ -305,7 +305,6 @@ pub const GlyphArt = struct { pub fn render(gpa: std.mem.Allocator, rgba: []const u8, iw: usize, ih: usize, max_cols: usize, max_rows: usize, pal: Palette, ascii: bool) !Grid { if (iw == 0 or ih == 0 or max_cols == 0 or max_rows == 0) return .{ .cells = try gpa.alloc(Cell, 0), .cols = 0, .rows = 0 }; - const gset: []const Glyph = if (ascii) &glyphs_ascii else &glyphs; // contain-fit; cells are ~twice as tall as wide, so a row spans 2 width-units. var cols = max_cols; var rows = (max_cols * ih) / (2 * iw); @@ -315,16 +314,28 @@ pub const GlyphArt = struct { } cols = std.math.clamp(cols, 1, max_cols); rows = std.math.clamp(rows, 1, max_rows); + return renderRect(gpa, rgba, iw, ih, .{ .w = @intCast(iw), .h = @intCast(ih) }, cols, rows, pal, ascii); + } + /// The pixels of `src` (a rectangle of the `iw` x `ih` image) laid + /// over exactly `cols` x `rows` cells, whatever their shape: a + /// terminal's image fragment is already the size its cells are. + pub fn renderRect(gpa: std.mem.Allocator, rgba: []const u8, iw: usize, ih: usize, src: PixelRect, cols: usize, rows: usize, pal: Palette, ascii: bool) !Grid { + const x0: usize = @min(src.x, iw); + const y0: usize = @min(src.y, ih); + const sw: usize = @min(src.w, iw - x0); + const sh: usize = @min(src.h, ih - y0); + if (sw == 0 or sh == 0 or cols == 0 or rows == 0) return .{ .cells = try gpa.alloc(Cell, 0), .cols = 0, .rows = 0 }; + const gset: []const Glyph = if (ascii) &glyphs_ascii else &glyphs; const cells = try gpa.alloc(Cell, cols * rows); var cy: usize = 0; while (cy < rows) : (cy += 1) { - const ry0 = cy * ih / rows; - const ry1 = @max(ry0 + 1, (cy + 1) * ih / rows); + const ry0 = y0 + cy * sh / rows; + const ry1 = @max(ry0 + 1, y0 + (cy + 1) * sh / rows); var cx: usize = 0; while (cx < cols) : (cx += 1) { - const rx0 = cx * iw / cols; - const rx1 = @max(rx0 + 1, (cx + 1) * iw / cols); + const rx0 = x0 + cx * sw / cols; + const rx1 = @max(rx0 + 1, x0 + (cx + 1) * sw / cols); var cell: [64][3]u8 = undefined; var sy: usize = 0; while (sy < 8) : (sy += 1) { diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 87339b70..cdb6092a 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -1737,7 +1737,7 @@ test "a builtin for one kind of pane is refused on another, and still acts on it defer p.deinit(); const serial = serialOf(p); const cases = [_]struct { []const u8, []const u8 }{ - .{ "Petscii\n", "Petscii: only an image pane takes it" }, + .{ "Petscii\n", "Petscii: only an image or a terminal pane takes it" }, .{ "Palette\n", "Palette: only an image pane takes it" }, .{ "Ascii\n", "Ascii: only an image pane takes it" }, .{ "Filter\n", "Filter: only a terminal pane takes it" }, diff --git a/src/pardes.zig b/src/pardes.zig index aa2c252c..84b891e5 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -4976,6 +4976,7 @@ pub const Pardes = struct { pane.serial = p.next_serial; p.rects[id] = .{}; p.panes[id] = pane; + panes.terminal.adoptSettings(p, pane); // /log hears of it once the update that made it ends, when it has // its file, name and place (`ctlfs.events.announce`). pane.fs.unannounced = true; diff --git a/src/tagline.zig b/src/tagline.zig index 9bd49eef..032fb5a0 100644 --- a/src/tagline.zig +++ b/src/tagline.zig @@ -124,6 +124,10 @@ pub fn pathPrefix(arena: std.mem.Allocator, pane: *Pane) ![]const u8 { // Unsaved text shows on the grip, as acme's modbutton does, not as a // mark in the text: the prefix is the name alone. if (pane.file) |f| return if (pane.prompt == .name) pane.input.own orelse f.path else f.path; + // A terminal showing kitty graphics says how it draws them, as an image + // pane does, and so does one drawing them as glyph art by choice. + if (panes.terminal.petscii(pane)) |on| if (on or panes.terminal.hasImages(pane)) + return std.fmt.allocPrint(arena, "{s} petscii:{s}", .{ (try shownDir(arena, pane)), if (on) "on" else "off" }); return (try shownDir(arena, pane)); } diff --git a/src/terminal.zig b/src/terminal.zig index e6304c0a..0850267e 100644 --- a/src/terminal.zig +++ b/src/terminal.zig @@ -9,6 +9,7 @@ const Surface = pardes.Surface; const modal = @import("modal.zig"); const tracy = @import("tracy.zig"); const dump = @import("dump.zig"); +const tagline = @import("tagline.zig"); const Key = pardes.Key; const Pane = panes.Pane; const EditText = panes.EditText; @@ -2797,6 +2798,36 @@ fn syncPixels(p: *const Pardes, pane: *Pane) void { vt.height_px = @as(u32, vt.rows) * p.cell_pixels.h; } +/// The Petscii builtin on a terminal: its kitty graphics as glyph art, +/// or back to pixels where the shell draws pixels. +pub fn togglePetscii(pane: *Pane) void { + if (comptime !images_enabled) return; + const state = pane.terminal orelse return; + state.images.petscii = !state.images.petscii; +} + +/// Whether the pane draws its kitty graphics as glyph art by choice; null +/// for a pane with no emulator. +pub fn petscii(pane: *const Pane) ?bool { + if (comptime !images_enabled) return null; + const state = pane.terminal orelse return null; + return state.images.petscii; +} + +/// A new terminal takes TermImages: pixels, or glyph art. +pub fn adoptSettings(p: *const Pardes, pane: *Pane) void { + if (comptime !images_enabled) return; + const state = pane.terminal orelse return; + state.images.petscii = p.settings.term_images == .petscii; +} + +/// Whether the screen showing holds any kitty graphics image. +pub fn hasImages(pane: *const Pane) bool { + if (comptime !images_enabled) return false; + const state = pane.terminal orelse return false; + return state.vt.screens.active.kitty_images.images.count() > 0; +} + /// Draw the pane's kitty graphics images over its body rows (after the /// rows and their colours: placeholder cells are blanked here). pub fn drawImages(p: *Pardes, s: *Surface, pane: *Pane, id: usize, tx: u16, tw: u16, body_y: u16, body_h: u16) void { @@ -2828,7 +2859,7 @@ pub fn drawImages(p: *Pardes, s: *Surface, pane: *Pane, id: usize, tx: u16, tw: } // Nothing to draw, no placeholder to blank and nothing cached to let // go: the common case costs the rows' flags. - if (!any_placeholder and screen.kitty_images.placements.count() == 0 and state.images.converted.count() == 0) return; + if (!any_placeholder and screen.kitty_images.placements.count() == 0 and state.images.converted.count() == 0 and state.images.glyphs.count() == 0) return; state.images.draw(p, s, &state.vt, @intCast(id), pane.serial, tx, body_y, @min(tw, pane.cols), rows_of[0..vp_rows]); } @@ -2982,6 +3013,78 @@ test "a virtual kitty placement shows through its placeholder cells, which draw try std.testing.expectEqualStrings("X", s.at(tx + 4, y).grapheme()); } +test "without pixels, or by the Petscii builtin, a terminal's image is glyph art in its cells" { + if (comptime !images_enabled) return error.SkipZigTest; + const gpa = std.testing.allocator; + const p = try Pardes.init(gpa, .{ .cols = 80, .rows = 24, .shells = 1 }); + defer p.deinit(); + p.update(.{ .resize = .{ .cols = 80, .rows = 24, .cell_pixels = .{ .w = 10, .h = 20 } } }); + var frame = std.heap.ArenaAllocator.init(gpa); + defer frame.deinit(); + const pane = p.panes[0].?; + pane.body.mode = .tty; + p.update(.{ .output = .{ .pane = 0, .bytes = kittyTransmit("c=2,r=1") } }); + const r = p.rects[0]; + const tx = r.x + config.GUTTER; + const y = p.bodyTop(pane, r); + const commodore = pardes.image.GlyphArt.commodore; + const painted = struct { + fn check(cell: *const pardes.Cell) bool { + const bg = switch (cell.style.bg) { + .rgb => |rgb| rgb, + else => return false, + }; + for (commodore) |c| if (std.mem.eql(u8, &c, &bg)) return true; + return false; + } + }.check; + + // A shell that draws no pixels (a tty under no kitty graphics): forced. + p.native_images = false; + var s = try p.render(frame.allocator()); + try std.testing.expectEqual(@as(usize, 0), imagePlaces(s).len); + try std.testing.expect(painted(s.at(tx, y)) and painted(s.at(tx + 1, y))); + try std.testing.expect(!painted(s.at(tx + 2, y))); + // The tag says so, as an image pane's does. + try std.testing.expect(std.mem.indexOf(u8, try tagline.tagPrefix(p, pane), " petscii:off") != null); + + // Pixels where they can be drawn; the builtin flips the pane to glyphs + // and back. + p.native_images = true; + _ = frame.reset(.retain_capacity); + s = try p.render(frame.allocator()); + try std.testing.expectEqual(@as(usize, 1), imagePlaces(s).len); + try std.testing.expect(p.executeBuiltinLine(0, "Petscii")); + _ = frame.reset(.retain_capacity); + s = try p.render(frame.allocator()); + try std.testing.expectEqual(@as(usize, 0), imagePlaces(s).len); + try std.testing.expect(painted(s.at(tx, y))); + try std.testing.expect(std.mem.indexOf(u8, try tagline.tagPrefix(p, pane), " petscii:on") != null); + try std.testing.expect(p.executeBuiltinLine(0, "Petscii")); + _ = frame.reset(.retain_capacity); + s = try p.render(frame.allocator()); + try std.testing.expectEqual(@as(usize, 1), imagePlaces(s).len); +} + +test "TermImages is real by default, and petscii makes new terminals draw glyph art" { + if (comptime !images_enabled) return error.SkipZigTest; + const gpa = std.testing.allocator; + const p = try Pardes.init(gpa, .{ .cols = 80, .rows = 24, .shells = 1 }); + defer p.deinit(); + try std.testing.expectEqual(config.Runtime.TermImages.real, p.settings.term_images); + try std.testing.expectEqual(false, petscii(p.panes[0].?).?); + // A pane without images says nothing of them. + try std.testing.expect(std.mem.indexOf(u8, try tagline.tagPrefix(p, p.panes[0].?), "petscii") == null); + try std.testing.expect(p.executeBuiltinLine(0, "TermImages petscii")); + try std.testing.expectEqual(config.Runtime.TermImages.petscii, p.settings.term_images); + // The setting is for new panes: the one there keeps its choice. + try std.testing.expectEqual(false, petscii(p.panes[0].?).?); + const id = p.freeSlot().?; + const fresh = try p.newShell(id, ""); + try std.testing.expectEqual(true, petscii(fresh).?); + try std.testing.expect(std.mem.indexOf(u8, try tagline.tagPrefix(p, fresh), " petscii:on") != null); +} + test "a program asking the cell size in pixels (CSI 16 t) is told the shell's" { if (comptime !images_enabled) return error.SkipZigTest; const gpa = std.testing.allocator; -- cgit v1.3 From bc3d18d27f9fc1155db7fac3946c4d38774f9e65 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 21 Oct 2026 14:35:15 -0300 Subject: Build with Zig 0.17 ghostty, libvaxis and uucode move to ghostty's 0.17 pins, cloud9 to its 0.17 main, SDL to castholm's release-3.4.x (3.4.18), zstbi and tree-sitter to forks with 0.17 build files (see build.zig.zon). A bare zig build copies the binaries into ~/.local/bin (-Dhome-install=false leaves it out): 0.17 keeps the prefix from build scripts. A terminal's edited copy goes when the program clears the screen. tinywin.snap is gone; perf baselines are re-recorded. Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- build.zig | 289 +++++++++++++++----------------- build.zig.zon | 45 ++--- build/snap.zig | 6 +- docs/typ/building.typ | 12 +- docs/typ/install.typ | 2 +- mupdf.zig | 6 +- src/9p_io.zig | 14 +- src/CHANGELOG.md | 8 + src/Layer.zig | 4 +- src/Messages.zig | 14 +- src/TerminalImages.zig | 82 ++++++++- src/builtins.zig | 26 +-- src/colors.zig | 70 ++++---- src/config.zig | 21 ++- src/detached/client.zig | 8 +- src/detached/wire.zig | 39 +++-- src/draw.zig | 22 +-- src/dump.zig | 24 +-- src/esp32p4.zig | 2 +- src/esp32p4/input_rescue.zig | 2 +- src/esp32p4/selftest.zig | 2 +- src/fs.zig | 8 +- src/gui/Post.zig | 14 +- src/gui/gui.zig | 20 +-- src/host_io.zig | 14 +- src/image.zig | 6 +- src/linux/v9fs.zig | 4 +- src/locations.zig | 24 +-- src/look.zig | 6 +- src/lsp/lsp.zig | 2 +- src/lsp/lsp_client.zig | 2 +- src/macos.zig | 26 +-- src/main.zig | 6 + src/memory.zig | 2 +- src/modal.zig | 2 +- src/ninep/addr.zig | 2 +- src/ninep/cols.zig | 10 +- src/ninep/ctl.zig | 14 +- src/ninep/events.zig | 10 +- src/ninep/pane.zig | 11 +- src/ninep/pty.zig | 6 +- src/ninep/screen.zig | 2 +- src/ninep/tree.zig | 16 +- src/normal.zig | 2 +- src/pager.zig | 2 +- src/panes.zig | 2 +- src/pardes.zig | 32 ++-- src/pdf.zig | 10 +- src/regexp.zig | 12 +- src/sam_edit.zig | 2 +- src/syntax.zig | 2 +- src/terminal.zig | 30 +++- src/tty/tty.zig | 22 +-- test/deck/replay.zig | 5 +- test/deck/schema.zig | 10 +- test/e2e_harness.zig | 2 +- test/fs_bench.zig | 4 +- test/history.zig | 10 +- test/hxdiff.zig | 14 +- test/image_harness.zig | 2 +- test/lspbench.zig | 2 +- test/monkey.zig | 2 +- test/panes.zig | 50 +++--- test/pdf.zig | 8 +- test/pdf_scroll_bench.zig | 2 +- test/pdf_sections_bench.zig | 2 +- test/perf-baseline-gui-Debug.json | 1 - test/perf-baseline-gui-debug.json | 1 + test/perf-baseline-tty-Debug.json | 1 - test/perf-baseline-tty-ReleaseFast.json | 1 - test/perf-baseline-tty-debug.json | 1 + test/perf-baseline-tty-fast.json | 1 + test/perf.zig | 15 +- test/snapshot.zig | 40 ++--- test/snapshots/exec.golden | 8 +- test/snapshots/tinywin.golden | 83 --------- test/snapshots/tinywin.snap | 31 ---- test/unit_profile_test.zig | 7 +- tools/gen_themes.zig | 15 +- 80 files changed, 664 insertions(+), 677 deletions(-) delete mode 100644 test/perf-baseline-gui-Debug.json create mode 100644 test/perf-baseline-gui-debug.json delete mode 100644 test/perf-baseline-tty-Debug.json delete mode 100644 test/perf-baseline-tty-ReleaseFast.json create mode 100644 test/perf-baseline-tty-debug.json create mode 100644 test/perf-baseline-tty-fast.json delete mode 100644 test/snapshots/tinywin.golden delete mode 100644 test/snapshots/tinywin.snap (limited to 'src/TerminalImages.zig') diff --git a/README.md b/README.md index 3a566d2a..0a03bdba 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ looks; the keys are helix's; every session is a virtual filesystem, served over 9P, that any program can drive. Get the source with `git clone https://git.sr.ht/~gbrls/pardes && cd pardes` -(also at https://git.0x4200.cafe/pardes). Install with Zig 0.16: +(also at https://git.0x4200.cafe/pardes). Install with Zig 0.17: `zig build -Dplatform=tty --prefix ~/.local` for `pardes` in a terminal, or `-Dplatform=gui` for the `pardes-gui` window. The terminal should report the mouse; Shift-Esc needs the kitty keyboard diff --git a/build.zig b/build.zig index 0246d55f..ddd41a03 100644 --- a/build.zig +++ b/build.zig @@ -59,13 +59,14 @@ pub fn build(b: *std.Build) void { const requested_platform = b.option(Platform, "platform", "which shell to build (tty, gui, web, macos, esp32p4); absent builds the tty cli and the SDL gui together"); const platform = requested_platform orelse .tty; const also_gui = requested_platform == null; - const home_install = also_gui and prefixIsUntouched(b); - if (home_install) { - if (b.graph.environ_map.get("HOME")) |home| { - b.resolveInstallPrefix(b.pathJoin(&.{ home, ".local" }), .{}); - std.debug.print("pardes: installing into {s} (override with --prefix)\n", .{b.install_prefix}); - } - } + // A bare `zig build` also copies the binaries into ~/.local/bin. Zig + // 0.17 keeps the prefix in the maker process, out of this script's + // reach, so `--prefix` no longer turns it off: -Dhome-install=false does. + const home_bin: ?[]const u8 = if (also_gui and (b.option(bool, "home-install", "a bare `zig build` also copies the binaries into ~/.local/bin (default: true)") orelse true)) + if (b.graph.environ_map.get("HOME")) |home| b.pathJoin(&.{ home, ".local", "bin" }) else null + else + null; + const home_install = home_bin != null; const esp32p4_target: std.Target.Query = .{ .cpu_arch = .riscv32, .os_tag = .freestanding, @@ -114,18 +115,18 @@ pub fn build(b: *std.Build) void { const is_web_target = target.result.cpu.arch == .wasm32 and target.result.os.tag == .freestanding; const is_esp32p4_target = target.result.cpu.arch == .riscv32 and target.result.os.tag == .freestanding; const optimize = if (is_web) - .ReleaseSmall - else if (is_esp32p4_target and requested_optimize == .Debug) - .ReleaseFast + .small + else if (is_esp32p4_target and requested_optimize == .debug) + .fast else requested_optimize; const test_build = b.step("test-build", "compile unit-test programs without running them"); const doc_typ_opts = b.addOptions(); - doc_typ_opts.addOption([]const u8, "dir", b.pathFromRoot("docs/typ")); + doc_typ_opts.addOptionPathUntracked("dir", b.path("docs/typ")); // The docs (docs/typ, docs/site): each output is one typst run, and each // reads docs/typ/builtins-*.json; `builtins-json` refreshes this build's from the // registry first (the tool is wired below, once the core module is). - const typst_bin: ?[]const u8 = b.findProgram(&.{"typst"}, &.{}) catch null; + const typst_bin: ?[]const u8 = b.findProgram(.{ .names = &.{"typst"} }); var doc_renders: [3]?*std.Build.Step.Run = @splat(null); const cheatsheet_step = b.step("cheatsheet", "render docs/typ/cheatsheet-a4.typ to /share/doc/pardes/cheatsheet.pdf (needs typst)"); const book_step = b.step("book", "render docs/typ/book.typ to /share/doc/pardes/pardes.pdf (needs typst)"); @@ -139,11 +140,13 @@ pub fn build(b: *std.Build) void { sheet.addFileArg(b.path("docs/typ/cheatsheet-a4.typ")); sheet.has_side_effects = true; cheatsheet_step.dependOn(&b.addInstallFile(sheet.addOutputFileArg("cheatsheet.pdf"), "share/doc/pardes/cheatsheet.pdf").step); - const book = b.addSystemCommand(&.{ typst, "compile", "--ignore-system-fonts", "--root", b.pathFromRoot(".") }); + const book = b.addSystemCommand(&.{ typst, "compile", "--ignore-system-fonts", "--root", "." }); + book.setCwd(b.path(".")); book.addFileArg(b.path("docs/typ/book.typ")); book.has_side_effects = true; book_step.dependOn(&b.addInstallFile(book.addOutputFileArg("pardes.pdf"), "share/doc/pardes/pardes.pdf").step); - const site = b.addSystemCommand(&.{ typst, "compile", "--format", "bundle", "--features", "bundle,html", "--root", b.pathFromRoot(".") }); + const site = b.addSystemCommand(&.{ typst, "compile", "--format", "bundle", "--features", "bundle,html", "--root", "." }); + site.setCwd(b.path(".")); site.addFileArg(b.path("docs/site/site.typ")); const site_dir = site.addOutputDirectoryArg("site"); site.has_side_effects = true; @@ -168,7 +171,7 @@ pub fn build(b: *std.Build) void { .root_source_file = b.path("test/unit_profile.zig"), }), }); - const c_optimize: std.builtin.OptimizeMode = if (optimize == .Debug) .ReleaseFast else optimize; + const c_optimize: std.lang.Optimize = if (optimize == .debug) .fast else optimize; const default_grammars: TreeSitterGrammars = if (is_web) .zig else if (is_esp32p4) .disabled else .full; const requested_grammars = b.option(TreeSitterGrammars, "tree-sitter", "tree-sitter grammar set: disabled, zig, minimal (c/c++/zig), full"); const tree_sitter_grammars = requested_grammars orelse default_grammars; @@ -321,7 +324,7 @@ pub fn build(b: *std.Build) void { .name = "pardes-gen-themes", .root_module = b.createModule(.{ .target = b.graph.host, - .optimize = .Debug, + .optimize = .debug, .root_source_file = b.path("tools/gen_themes.zig"), }), }); @@ -353,7 +356,7 @@ pub fn build(b: *std.Build) void { // `pardes ` alone, like a tarball build; -Dstamp-commit=true // stamps one anyway. const stamp_commit = b.option(bool, "stamp-commit", "embed the git commit in --version and crash records (default: release builds and the ~/.local install)") orelse - (optimize != .Debug or home_install); + (optimize != .debug or home_install); const shell_cfg: ShellConfig = .{ .tree_sitter_grammars = tree_sitter_grammars, .tracy = tracy != null, @@ -391,9 +394,7 @@ pub fn build(b: *std.Build) void { if (tree_sitter_grammars != .disabled) { const tree_sitter_mod = b.dependency("tree_sitter", .{ .target = target, .optimize = c_optimize }).module("tree_sitter"); if (is_web) { - const web_libc_include: std.Build.LazyPath = .{ - .cwd_relative = b.path("src/web/libc/include").getPath(b), - }; + const web_libc_include = b.path("src/web/libc/include"); for (tree_sitter_mod.link_objects.items) |link_object| switch (link_object) { .other_step => |lib| { lib.root_module.link_libc = false; @@ -417,12 +418,11 @@ pub fn build(b: *std.Build) void { (tree_sitter_grammars == .zig and g.tier == .zig)) { const dep = b.dependency(g.dep, .{}); - const query_path = dep.path(g.query); - const query = std.Io.Dir.cwd().readFileAlloc(io, query_path.getPath(b), b.allocator, .limited(0x100000)) catch @panic("read " ++ g.name ++ " highlights"); + const query = configureRead(b, io, dep.builder.root, g.query, 0x100000) catch @panic("read " ++ g.name ++ " highlights"); ts_queries.addOption([]const u8, g.name ++ "_highlights", query); // helix's textobject queries, vendored (vendor/queries); a // grammar without one gets none - const objects = std.Io.Dir.cwd().readFileAlloc(io, b.pathFromRoot("vendor/queries/" ++ g.name ++ "/textobjects.scm"), b.allocator, .limited(0x100000)) catch ""; + const objects = configureRead(b, io, b.root, "vendor/queries/" ++ g.name ++ "/textobjects.scm", 0x100000) catch ""; ts_queries.addOption([]const u8, g.name ++ "_textobjects", objects); const lib = b.addLibrary(.{ @@ -438,8 +438,9 @@ pub fn build(b: *std.Build) void { const ts_cflags = [_][]const u8{ "-fno-sanitize=function", "-DTREE_SITTER_REUSE_ALLOCATOR", + // Relative to the build root, the compiler's working directory. "-include", - b.path("src/tree_sitter_heap.h").getPath(b), + "src/tree_sitter_heap.h", }; lib.root_module.addCSourceFile(.{ .file = dep.path(g.src ++ "/parser.c"), .flags = &ts_cflags }); if (g.scanner) lib.root_module.addCSourceFile(.{ .file = dep.path(g.src ++ "/scanner.c"), .flags = &ts_cflags }); @@ -467,7 +468,7 @@ pub fn build(b: *std.Build) void { // (src/regexp.zig). A bump that moves the anchor stops the build. const mvzr_mod = mvzr: { const dep = b.dependency("mvzr", .{ .target = target, .optimize = optimize }); - const src = std.Io.Dir.cwd().readFileAlloc(io, dep.path("src/mvzr.zig").getPath(b), b.allocator, .limited(1 << 20)) catch @panic("read mvzr"); + const src = configureRead(b, io, dep.builder.root, "src/mvzr.zig", 1 << 20) catch @panic("read mvzr"); const anchor = "fn matchPattern(patt: []const RegOp, sets: []const CharSet, haystack: []const u8, i_in: usize) ?OpMatch {\n"; const at = (std.mem.indexOf(u8, src, anchor) orelse @panic("mvzr's matchPattern changed: redo its step budget in build.zig")) + anchor.len; const spend = @@ -536,7 +537,17 @@ pub fn build(b: *std.Build) void { \\ ; if (std.mem.count(u8, backed, end_anchor) != 1) @panic("mvzr's parser changed: redo its `$` before `|` in build.zig"); - const patched = std.mem.replaceOwned(u8, b.allocator, backed, end_anchor, end_before_alt) catch @panic("OOM"); + var patched = std.mem.replaceOwned(u8, b.allocator, backed, end_anchor, end_before_alt) catch @panic("OOM"); + // Zig 0.17 removed `**`; mvzr still has it (its PR #16 replaces it upstream). + for ([_][3][]const u8{ + .{ "[1]RegOp{.{ .unused = {} }} ** ops", "@splat(.{ .unused = {} })", "1" }, + .{ "[1]CharSet{.{ .low = 0, .hi = 0 }} ** char_sets", "@splat(.{ .low = 0, .hi = 0 })", "1" }, + .{ "\"a\" ** 2048", "&@as([2048]u8, @splat('a'))", "2" }, + .{ "\"12345,\" ** 255", "std.mem.asBytes(&@as([255][6]u8, @splat(\"12345,\".*)))", "1" }, + }) |edit| { + if (std.mem.count(u8, patched, edit[0]) != std.fmt.parseInt(usize, edit[2], 10) catch unreachable) std.debug.panic("mvzr changed at `{s}`: redo its `**` patch in build.zig", .{edit[0]}); + patched = std.mem.replaceOwned(u8, b.allocator, patched, edit[0], edit[1]) catch @panic("OOM"); + } break :mvzr b.createModule(.{ .root_source_file = b.addWriteFiles().add("mvzr.zig", patched), .target = target, .optimize = optimize }); }; @@ -582,6 +593,7 @@ pub fn build(b: *std.Build) void { }); mupdf.linkTo(mupdf_mod); mupdf_mod.addImport("c_heap", c_heap_mod); + mupdf_mod.addImport("pdf_c", b.addTranslateC(.{ .root_source_file = b.path("src/pdf_bridge.h"), .target = target, .optimize = optimize }).createModule()); mupdf_mod.addIncludePath(b.path("src")); mupdf_mod.addCSourceFile(.{ .file = b.path("src/pdf_bridge.c"), @@ -599,12 +611,13 @@ pub fn build(b: *std.Build) void { const pdf_bench_mod = b.createModule(.{ .target = target, - .optimize = .ReleaseFast, + .optimize = .fast, .root_source_file = b.path("src/pdf.zig"), .link_libc = true, }); mupdf.linkTo(pdf_bench_mod); pdf_bench_mod.addImport("c_heap", c_heap_mod); + pdf_bench_mod.addImport("pdf_c", b.addTranslateC(.{ .root_source_file = b.path("src/pdf_bridge.h"), .target = target, .optimize = .fast }).createModule()); pdf_bench_mod.addIncludePath(b.path("src")); pdf_bench_mod.addCSourceFile(.{ .file = b.path("src/pdf_bridge.c"), @@ -614,14 +627,14 @@ pub fn build(b: *std.Build) void { .name = "pardes-pdf-bench", .root_module = b.createModule(.{ .target = target, - .optimize = .ReleaseFast, + .optimize = .fast, .root_source_file = b.path("test/pdf_bench.zig"), .link_libc = true, }), }); pdf_bench.root_module.addImport("mupdf", pdf_bench_mod); const run_pdf_bench = b.addRunArtifact(pdf_bench); - if (b.args) |args| run_pdf_bench.addArgs(args); + run_pdf_bench.addPassthruArgs(); run_pdf_bench.setCwd(b.path(".")); pdf_bench_step.dependOn(&run_pdf_bench.step); @@ -629,7 +642,7 @@ pub fn build(b: *std.Build) void { .name = "pardes-pdf-sections-bench", .root_module = b.createModule(.{ .target = target, - .optimize = .ReleaseFast, + .optimize = .fast, .root_source_file = b.path("test/pdf_sections_bench.zig"), .link_libc = true, }), @@ -637,10 +650,10 @@ pub fn build(b: *std.Build) void { pdf_sections_bench.root_module.addImport("pardes", core_module); pdf_sections_bench.root_module.addImport("mupdf", mupdf_mod); const sections_bench_opts = b.addOptions(); - sections_bench_opts.addOption(bool, "release_fast_core", optimize == .ReleaseFast); + sections_bench_opts.addOption(bool, "release_fast_core", optimize == .fast); pdf_sections_bench.root_module.addOptions("pdf_sections_bench_config", sections_bench_opts); const run_pdf_sections_bench = b.addRunArtifact(pdf_sections_bench); - if (b.args) |args| run_pdf_sections_bench.addArgs(args); + run_pdf_sections_bench.addPassthruArgs(); run_pdf_sections_bench.setCwd(b.path(".")); pdf_sections_bench_step.dependOn(&run_pdf_sections_bench.step); @@ -648,7 +661,7 @@ pub fn build(b: *std.Build) void { .name = "pardes-pdf-pointer-bench", .root_module = b.createModule(.{ .target = target, - .optimize = .ReleaseFast, + .optimize = .fast, .root_source_file = b.path("test/pdf_pointer_bench.zig"), .link_libc = true, }), @@ -656,7 +669,7 @@ pub fn build(b: *std.Build) void { pdf_pointer_bench.root_module.addImport("pardes", core_module); pdf_pointer_bench.root_module.addImport("mupdf", mupdf_mod); const run_pdf_pointer_bench = b.addRunArtifact(pdf_pointer_bench); - if (b.args) |args| run_pdf_pointer_bench.addArgs(args); + run_pdf_pointer_bench.addPassthruArgs(); run_pdf_pointer_bench.setCwd(b.path(".")); pdf_pointer_bench_step.dependOn(&run_pdf_pointer_bench.step); @@ -672,11 +685,11 @@ pub fn build(b: *std.Build) void { pdf_scroll_bench.root_module.addImport("pardes", core_module); pdf_scroll_bench.root_module.addImport("mupdf", mupdf_mod); const scroll_bench_opts = b.addOptions(); - scroll_bench_opts.addOption(bool, "release_fast_core", optimize == .ReleaseFast); + scroll_bench_opts.addOption(bool, "release_fast_core", optimize == .fast); scroll_bench_opts.addOption([]const u8, "core_optimize", @tagName(optimize)); pdf_scroll_bench.root_module.addOptions("pdf_scroll_bench_config", scroll_bench_opts); const run_pdf_scroll_bench = b.addRunArtifact(pdf_scroll_bench); - if (b.args) |args| run_pdf_scroll_bench.addArgs(args); + run_pdf_scroll_bench.addPassthruArgs(); run_pdf_scroll_bench.setCwd(b.path(".")); pdf_scroll_bench_step.dependOn(&run_pdf_scroll_bench.step); } @@ -712,15 +725,13 @@ pub fn build(b: *std.Build) void { // - An X10 mouse report and a kitty graphics reply cut short by a read // wait for their rest: the first became three bytes of text, the // second sliced past its input. - // - A malformed color or clipboard reply is dropped instead of failing - // the parse, which stopped input; so is a byte no UTF-8 starts with. - // - An OSC reply ends at its first terminator: one ended by BEL ran on to - // the next sequence's ESC and left what lay between as text. + // - A byte no UTF-8 starts with is dropped instead of failing the parse, + // which stopped input. (vaxis itself now drops a malformed color or + // clipboard reply and ends an OSC at its first terminator.) // - A device report's fields are sought in the sequence, not past it. // A bump that moves an anchor stops the build. { - const parser_path = vaxis_dep.path("src/Parser.zig").getPath(b); - var src = std.Io.Dir.cwd().readFileAlloc(io, parser_path, b.allocator, .limited(1 << 20)) catch @panic("read vaxis Parser.zig"); + var src = configureRead(b, io, vaxis_dep.builder.root, "src/Parser.zig", 1 << 20) catch @panic("read vaxis Parser.zig"); const edits = [_]struct { anchor: []const u8, with: []const u8, count: usize = 1 }{ .{ .anchor = @@ -731,7 +742,7 @@ pub fn build(b: *std.Build) void { \\ 0x5F => return parseApc(input), \\ // pardes's patch (its build.zig): ESC before a key's sequence is Alt on the key. \\ 0x1B => if (input.len > 2 and (input[2] == '[' or input[2] == 'O')) { - \\ var inner = if (input[2] == '[') parseCsi(input[1..], &self.buf) else parseSs3(input[1..]); + \\ var inner = if (input[2] == '[') parseCsi(input[1..], &self.buf, self.cursor_position_requests) else parseSs3(input[1..]); \\ if (inner.n == 0) return inner; \\ if (inner.event) |*event| switch (event.*) { \\ .key_press, .key_release => |*key| key.mods.alt = true, @@ -765,71 +776,17 @@ pub fn build(b: *std.Build) void { \\ switch (input[2]) { , }, - .{ - .anchor = - \\ const esc_result = skipUntilST(input); - \\ if (esc_result.n > 0) break :blk esc_result.n; - \\ - \\ // No escape, could be BEL terminated - \\ const bel = std.mem.indexOfScalarPos(u8, input, 2, 0x07) orelse return .{ - \\ .event = null, - \\ .n = 0, - \\ }; - \\ bel_terminated = true; - \\ break :blk bel + 1; - , - .with = - \\ // pardes's patch (its build.zig): whichever terminator comes first ends it. - \\ const esc = std.mem.indexOfScalarPos(u8, input, 2, 0x1b); - \\ const bel = std.mem.indexOfScalarPos(u8, input, 2, 0x07); - \\ if (bel != null and (esc == null or bel.? < esc.?)) { - \\ bel_terminated = true; - \\ break :blk bel.? + 1; - \\ } - \\ const esc_result = skipUntilST(input); - \\ if (esc_result.n > 0) break :blk esc_result.n; - \\ return .{ .event = null, .n = 0 }; - , - }, - .{ - .anchor = " const color = try Color.rgbFromSpec(color_spec);\n", - .with = " const color = Color.rgbFromSpec(color_spec) catch return null_event; // pardes's patch (its build.zig)\n", - .count = 2, - }, - .{ - .anchor = - \\ if (input[semicolon_idx + 1] != 'c') return null_event; - \\ const payload = if (bel_terminated) - \\ input[semicolon_idx + 3 .. sequence.len - 1] - \\ else - \\ input[semicolon_idx + 3 .. sequence.len - 2]; - \\ const decoder = std.base64.standard.Decoder; - \\ const text = try paste_allocator.?.alloc(u8, try decoder.calcSizeForSlice(payload)); - \\ try decoder.decode(text, payload); - , - .with = - \\ // pardes's patch (its build.zig): a malformed reply is dropped. - \\ const body_end = if (bel_terminated) sequence.len - 1 else sequence.len - 2; - \\ if (semicolon_idx + 3 > body_end or input[semicolon_idx + 1] != 'c') return null_event; - \\ const payload = input[semicolon_idx + 3 .. body_end]; - \\ const decoder = std.base64.standard.Decoder; - \\ const gpa = paste_allocator orelse return null_event; - \\ const text = gpa.alloc(u8, decoder.calcSizeForSlice(payload) catch return null_event) catch return null_event; - \\ decoder.decode(text, payload) catch { - \\ gpa.free(text); - \\ return null_event; - \\ }; - , - }, .{ .anchor = \\ 'A', 'B', 'C', 'D', 'E', 'F', 'H', 'P', 'Q', 'R', 'S' => { + \\ // Legacy keys \\ , .with = \\ 'A', 'B', 'C', 'D', 'E', 'F', 'H', 'P', 'Q', 'R', 'S' => { \\ // pardes's patch (its build.zig): a cursor position report is no key. \\ if (final == 'R' and cursorReport(sequence)) return null_event; + \\ // Legacy keys \\ , }, @@ -882,8 +839,7 @@ pub fn build(b: *std.Build) void { // (InactiveDim on a focus change) sent every blank of every pane it // touched again: 7 KB a click for three shell panes. The terminal // keeps the old ink there, and so does vaxis's last frame. - const render_path = vaxis_dep.path("src/Vaxis.zig").getPath(b); - var render_src = std.Io.Dir.cwd().readFileAlloc(io, render_path, b.allocator, .limited(1 << 20)) catch @panic("read vaxis Vaxis.zig"); + var render_src = configureRead(b, io, vaxis_dep.builder.root, "src/Vaxis.zig", 1 << 20) catch @panic("read vaxis Vaxis.zig"); const render_anchor = \\ if ((!self.refresh and \\ last.eql(cell) and @@ -941,7 +897,7 @@ pub fn build(b: *std.Build) void { var ghostty_vt_for_snap: ?*std.Build.Module = null; const ghostty_simd = !freestanding_core and (!target.result.os.tag.isDarwin() or b.graph.host.result.os.tag.isDarwin()); - const ghostty_optimize: std.builtin.OptimizeMode = if (optimize == .Debug) .ReleaseSafe else optimize; + const ghostty_optimize: std.lang.Optimize = if (optimize == .debug) .safe else optimize; const ghostty_dep = if (is_esp32p4) null else b.lazyDependency("ghostty", .{ .target = target, .optimize = ghostty_optimize, .simd = ghostty_simd, .@"app-runtime" = .none, .@"emit-xcframework" = false }); if (ghostty_dep) |dep| { const ghostty_vt = dep.module("ghostty-vt"); @@ -1017,6 +973,17 @@ pub fn build(b: *std.Build) void { const sdl_lib = dep.artifact("SDL3"); gm.linkLibrary(sdl_lib); gm.addIncludePath(dep.path("include")); + // gui.zig's `c`: SDL and the font shim, which @cImport gave it before Zig 0.17. + const header = b.addWriteFiles().add("gui_c.h", + \\#define SDL_DISABLE_OLD_NAMES 1 + \\#include + \\#include "font.h" + \\ + ); + const gui_c = b.addTranslateC(.{ .root_source_file = header, .target = target, .optimize = optimize }); + gui_c.addIncludePath(dep.path("include")); + gui_c.addIncludePath(b.path("src/gui")); + gm.addImport("gui_c", gui_c.createModule()); } gm.linkLibrary(freetype.?); // HarfBuzz from source, like FreeType: its FreeType integration @@ -1105,7 +1072,7 @@ pub fn build(b: *std.Build) void { }) |file| web_step.dependOn(&b.addInstallFileWithDir(b.path(file[0]), .{ .custom = "web" }, file[1]).step); const run_web_harness = b.addSystemCommand(&.{ "node", "test/web_harness.mjs" }); - run_web_harness.addArg(b.getInstallPath(.{ .custom = "web" }, "")); + run_web_harness.addDirectoryArg(installed("web")); run_web_harness.step.dependOn(web_step); b.step("web-harness", "run the dependency-free JS/WASM DOM harness").dependOn(&run_web_harness.step); b.getInstallStep().dependOn(web_step); @@ -1149,9 +1116,9 @@ pub fn build(b: *std.Build) void { const min_version = b.fmt("{d}.{d}", .{ macos_min_version.major, macos_min_version.minor }); const swift_mode: []const u8 = switch (optimize) { - .Debug => "-Onone", - .ReleaseSmall => "-Osize", - .ReleaseFast, .ReleaseSafe => "-O", + .debug => "-Onone", + .small => "-Osize", + .fast, .safe => "-O", }; const link = b.addSystemCommand(&.{ "swiftc", swift_mode, "-target", triple, "-import-objc-header" }); @@ -1218,7 +1185,8 @@ pub fn build(b: *std.Build) void { const sign = b.addSystemCommand(&.{ "codesign", "--force", "--sign", macos_identity }); if (!std.mem.eql(u8, macos_identity, "-")) sign.addArgs(&.{ "--options", "runtime", "--timestamp" }); - sign.addArg(b.getInstallPath(.prefix, "pardes.app")); + sign.setCwd(installed("")); + sign.addArg("pardes.app"); sign.has_side_effects = true; sign.step.dependOn(&install_app_bin.step); sign.step.dependOn(&install_plist.step); @@ -1227,8 +1195,8 @@ pub fn build(b: *std.Build) void { app_step.dependOn(&sign.step); const dmg = b.addSystemCommand(&.{ "hdiutil", "create", "-volname", "pardes", "-ov", "-format", "UDZO", "-srcfolder" }); - dmg.addArg(b.getInstallPath(.prefix, "pardes.app")); - dmg.addArg(b.getInstallPath(.prefix, "pardes.dmg")); + dmg.setCwd(installed("")); + dmg.addArgs(&.{ "pardes.app", "pardes.dmg" }); dmg.has_side_effects = true; dmg.step.dependOn(&sign.step); dmg_step.dependOn(&dmg.step); @@ -1267,7 +1235,7 @@ pub fn build(b: *std.Build) void { const run_e2e = std.Build.Step.Run.create(b, "run macos-e2e"); run_e2e.addFileArg(runnable); run_e2e.setCwd(b.path(".")); - if (b.args) |args| run_e2e.addArgs(args); + run_e2e.addPassthruArgs(); run_e2e.has_side_effects = true; e2e_step.dependOn(&run_e2e.step); } else e2e_step.dependOn(&b.addFail("macos-e2e needs a Darwin host and target").step); @@ -1290,7 +1258,7 @@ pub fn build(b: *std.Build) void { .linkage = if (static) .static else null, .root_module = root_mod, }); - b.installArtifact(exe); + installHome(b, exe, home_bin); if (gui_mod) |gm| { var gui_name: []const u8 = "pardes-gui"; if (target.result.os.tag != .linux or target.result.cpu.arch != .x86_64) @@ -1300,7 +1268,7 @@ pub fn build(b: *std.Build) void { .linkage = if (static) .static else null, .root_module = gm, }); - b.installArtifact(gui_exe); + installHome(b, gui_exe, home_bin); } const run = b.addRunArtifact(exe); b.step("run", "descend to the pardes").dependOn(&run.step); @@ -1312,7 +1280,7 @@ pub fn build(b: *std.Build) void { }); const run_iso = b.addRunArtifact(iso_exe); // Something to look at on arrival, read out of the binary itself. - if (b.args) |args| run_iso.addArgs(args) else run_iso.addArg("src/pardes.zig"); + run_iso.addPassthruArgs(); const iso_step = b.step("run-isolated", "descend to a pardes with no host but the terminal"); iso_step.dependOn(&run_iso.step); } @@ -1370,15 +1338,9 @@ pub fn build(b: *std.Build) void { hxdiff.root_module.addImport("pardes", core_module); const run_hxdiff = b.addRunArtifact(hxdiff); run_hxdiff.has_side_effects = true; - if (b.args) |args| run_hxdiff.addArgs(args) else { - run_hxdiff.addArgs(&.{ - "--strict", - "test/hxcases/cases.jsonl", - "test/hxcases/goldens.jsonl", - "test/hxcases/waivers.jsonl", - }); - run_hxdiff.setCwd(b.path(".")); - } + // Bare, it runs the checked-in suite (test/hxdiff.zig). + run_hxdiff.addPassthruArgs(); + run_hxdiff.setCwd(b.path(".")); const hxdiff_step = b.step("hxdiff", "compare Helix results (-- --strict cases reference [waivers]; cases alone emits)"); hxdiff_step.dependOn(&run_hxdiff.step); @@ -1403,16 +1365,8 @@ pub fn build(b: *std.Build) void { const run_hxparity = b.addRunArtifact(hxdiff); run_hxparity.has_side_effects = true; run_hxparity.addArg("--parity"); - if (b.args) |args| run_hxparity.addArgs(args) else { - run_hxparity.addArgs(&.{ - "--strict", - "--waivers", - "test/hxcases/parity-waivers.jsonl", - "test/hxcases/cases.jsonl", - "test/hxcases/parity.jsonl", - }); - run_hxparity.setCwd(b.path(".")); - } + run_hxparity.addPassthruArgs(); + run_hxparity.setCwd(b.path(".")); const hxparity_step = b.step("hxparity", "run the file-vs-pty editing parity suite (-- [--waivers w.jsonl] ...)"); hxparity_step.dependOn(&run_hxparity.step); @@ -1427,21 +1381,21 @@ pub fn build(b: *std.Build) void { .name = "pardes-lspbench", .root_module = b.createModule(.{ .target = target, - .optimize = .ReleaseFast, + .optimize = .fast, .root_source_file = b.path("test/lspbench.zig"), .link_libc = true, }), }); lspbench.root_module.addImport("pardes", core_module); const run_lspbench = b.addRunArtifact(lspbench); - if (b.args) |args| run_lspbench.addArgs(args); + run_lspbench.addPassthruArgs(); run_lspbench.setCwd(b.path(".")); run_lspbench.has_side_effects = true; const lspbench_step = b.step("lspbench", "language-backend latency + feature matrix (-- [--json] [--check] [repo-root]), or one query (-- probe : [arg] [--reps N])"); lspbench_step.dependOn(&run_lspbench.step); const run_lspbench_check = b.addRunArtifact(lspbench); run_lspbench_check.addArg("--check"); - if (b.args) |args| run_lspbench_check.addArgs(args); + run_lspbench_check.addPassthruArgs(); run_lspbench_check.setCwd(b.path(".")); run_lspbench_check.has_side_effects = true; const lspbench_check_step = b.step("lspbench-check", "require every configured language probe to complete correctly"); @@ -1449,12 +1403,12 @@ pub fn build(b: *std.Build) void { const locations_bench_step = b.step("locations-bench", "measure cold/warm result formatting (-Doptimize=ReleaseFast; CSV on stderr)"); - if (optimize != .ReleaseFast) { + if (optimize != .fast) { locations_bench_step.dependOn(&b.addFail("locations-bench requires -Doptimize=ReleaseFast").step); } else { const locations_bench_module = b.createModule(.{ .target = target, - .optimize = .ReleaseFast, + .optimize = .fast, .root_source_file = b.path("test/locations_bench.zig"), .link_libc = true, }); @@ -1465,7 +1419,7 @@ pub fn build(b: *std.Build) void { locations_bench_step.dependOn(&run_locations_bench.step); } - const perf_optimize: std.builtin.OptimizeMode = .ReleaseFast; + const perf_optimize: std.lang.Optimize = .fast; const perf_options = b.addOptions(); const perf_target = std.Target.Query.fromTarget(&target.result); perf_options.addOption(PerfBuild, "identity", .{ @@ -1499,7 +1453,7 @@ pub fn build(b: *std.Build) void { perf.root_module.addOptions("perf_options", perf_options); const run_perf = b.addRunArtifact(perf); run_perf.has_side_effects = true; - if (b.args) |args| run_perf.addArgs(args); + run_perf.addPassthruArgs(); run_perf.setCwd(b.path(".")); const perf_step = b.step("perf", "gesture latency or bounded terminal stress (-- [--json] [--reps N] [--base old.json] [--terminal-mib N])"); perf_step.dependOn(&run_perf.step); @@ -1536,7 +1490,7 @@ pub fn build(b: *std.Build) void { .name = "pardes-fs-bench", .root_module = b.createModule(.{ .target = target, - .optimize = .ReleaseFast, + .optimize = .fast, .root_source_file = b.path("test/fs_bench.zig"), .link_libc = true, }), @@ -1544,7 +1498,7 @@ pub fn build(b: *std.Build) void { fs_bench.root_module.addImport("pardes", core_module); const run_fs_bench = b.addRunArtifact(fs_bench); run_fs_bench.has_side_effects = true; - if (b.args) |args| run_fs_bench.addArgs(args); + run_fs_bench.addPassthruArgs(); run_fs_bench.setCwd(b.path(".")); const fs_bench_step = b.step("fs-bench", "9P filesystem request cost and allocation count (-- [--json] [--reps N])"); fs_bench_step.dependOn(&run_fs_bench.step); @@ -1581,11 +1535,11 @@ pub fn build(b: *std.Build) void { }); syntax_runner.root_module.addImport("syntax", syntax_module); const run_syntax = b.addRunArtifact(syntax_runner); - if (b.args) |args| run_syntax.addArgs(args); + run_syntax.addPassthruArgs(); b.step("syntax", "emit deterministic syntax snapshots").dependOn(&run_syntax.step); const run_syntax_bench = b.addRunArtifact(syntax_runner); run_syntax_bench.addArg("--bench"); - if (b.args) |args| run_syntax_bench.addArgs(args); + run_syntax_bench.addPassthruArgs(); run_syntax_bench.has_side_effects = true; b.step("syntax-bench", "measure highlighting latency and allocations").dependOn(&run_syntax_bench.step); const syntax_test = b.addTest(.{ @@ -1611,7 +1565,7 @@ pub fn build(b: *std.Build) void { // part of fs-test; the long run is manual. const run_monkey9p = b.addSystemCommand(&.{ "python3", "-B", "test/monkey9p.py" }); run_monkey9p.addArtifactArg(exe); - if (b.args) |args| run_monkey9p.addArgs(args); + run_monkey9p.addPassthruArgs(); run_monkey9p.setCwd(b.path(".")); run_monkey9p.has_side_effects = true; b.step("monkey-9p", "random 9P operations checking the documented rules (-- [--seed N]... [--steps M] [--replay F] [--shrink F] [--no-shrink])").dependOn(&run_monkey9p.step); @@ -1622,7 +1576,7 @@ pub fn build(b: *std.Build) void { if (platform == .gui) { const run_monkey_gui = b.addSystemCommand(&.{ "python3", "-B", "test/gui_monkey.py" }); run_monkey_gui.addArtifactArg(exe); - if (b.args) |args| run_monkey_gui.addArgs(args); + run_monkey_gui.addPassthruArgs(); run_monkey_gui.setCwd(b.path(".")); run_monkey_gui.has_side_effects = true; monkey_gui_step.dependOn(&run_monkey_gui.step); @@ -1653,7 +1607,7 @@ pub fn build(b: *std.Build) void { }), }); // Ordinary executable; each launch asks sudo inside its own PTY. - b.installArtifact(v9fs_helper); + installHome(b, v9fs_helper, home_bin); const run_v9fs = b.addSystemCommand(&.{ "python3", "-B", "test/v9fs.py" }); run_v9fs.addArtifactArg(exe); run_v9fs.addArtifactArg(v9fs_helper); @@ -1688,7 +1642,7 @@ pub fn build(b: *std.Build) void { }), }); const run_history = b.addRunArtifact(history); - if (b.args) |args| run_history.addArgs(args); + run_history.addPassthruArgs(); run_history.has_side_effects = true; b.step("history", "compare command output and test/build runtime across jj revisions").dependOn(&run_history.step); @@ -1843,7 +1797,7 @@ pub fn build(b: *std.Build) void { if (unit_match) |check| check.addArtifactArg(shell_test); const run_profile = b.addRunArtifact(unit_profile); run_profile.addArtifactArg(shell_test); - if (b.args) |args| run_profile.addArgs(args); + run_profile.addPassthruArgs(); run_profile.has_side_effects = true; b.step("unit-profile", "report test request time and process memory as JSONL (-- optional filter, --timeout-ms=N)").dependOn(&run_profile.step); const profile_test = b.addExecutable(.{ @@ -1876,19 +1830,38 @@ fn testMatch(b: *std.Build, profiler: *std.Build.Step.Compile, filters: []const return check; } -fn prefixIsUntouched(b: *std.Build) bool { - if (b.dest_dir != null) return false; - const zig_out = b.build_root.join(b.allocator, &.{"zig-out"}) catch @panic("OOM"); - if (!std.mem.eql(u8, b.install_prefix, zig_out)) return false; - return std.mem.eql(u8, b.exe_dir, b.pathJoin(&.{ b.install_path, "bin" })) and - std.mem.eql(u8, b.lib_dir, b.pathJoin(&.{ b.install_path, "lib" })) and - std.mem.eql(u8, b.h_dir, b.pathJoin(&.{ b.install_path, "include" })); +/// Installs `artifact` in the prefix and, given `home_bin`, copies it there +/// too (`install` unlinks first, so a running binary is replaced). +fn installHome(b: *std.Build, artifact: *std.Build.Step.Compile, home_bin: ?[]const u8) void { + b.installArtifact(artifact); + const dir = home_bin orelse return; + const copy = b.addSystemCommand(&.{ "install", "-Dm755" }); + copy.addArtifactArg(artifact); + copy.addArg(b.pathJoin(&.{ dir, artifact.name })); + copy.has_side_effects = true; + b.getInstallStep().dependOn(©.step); +} + +/// A file read while configuring, under a package's root. A dependency's is +/// hash-addressed and never changes under the same pin; this repo's are not +/// tracked one by one, since the configure runs again on every build anyway +/// (findProgram and gitCommit poison its cache). +// ponytail: untracked repo reads; b.dependOnFileContents each one if the configure cache ever stays pure. +fn configureRead(b: *std.Build, io: std.Io, root: std.Build.Cache.Path, sub: []const u8, limit: usize) ![]u8 { + return root.root_dir.handle.readFileAlloc(io, b.pathJoin(&.{ root.subPathOrDot(), sub }), b.allocator, .limited(limit)); +} + +/// `sub` under the install prefix, known only when the build runs. +fn installed(sub: []const u8) std.Build.LazyPath { + return .{ .relative = .{ .base = .install_prefix, .sub_path = sub } }; } fn gitCommit(b: *std.Build) ?[]const u8 { + // HEAD is not a file the configure cache can track. + b.graph.poisonCache(); var code: u8 = 0; const out = b.runAllowFail( - &.{ "git", "-C", b.build_root.path orelse ".", "rev-parse", "--short=12", "HEAD" }, + &.{ "git", "rev-parse", "--short=12", "HEAD" }, &code, .ignore, ) catch return null; @@ -1985,7 +1958,7 @@ fn compileGlsl(b: *std.Build, name: []const u8) std.Build.LazyPath { fn vendoredThemes(b: *std.Build, io: std.Io) []const []const u8 { var count: usize = 0; { - var dir = b.build_root.handle.openDir(io, "vendor/themes", .{ .iterate = true }) catch @panic("open vendor/themes"); + var dir = b.root.root_dir.handle.openDir(io, "vendor/themes", .{ .iterate = true }) catch @panic("open vendor/themes"); defer dir.close(io); var it = dir.iterate(); while (it.next(io) catch @panic("read vendor/themes")) |e| { @@ -1995,7 +1968,7 @@ fn vendoredThemes(b: *std.Build, io: std.Io) []const []const u8 { } const names = b.allocator.alloc([]const u8, count) catch @panic("OOM"); - var dir = b.build_root.handle.openDir(io, "vendor/themes", .{ .iterate = true }) catch @panic("open vendor/themes"); + var dir = b.root.root_dir.handle.openDir(io, "vendor/themes", .{ .iterate = true }) catch @panic("open vendor/themes"); defer dir.close(io); var it = dir.iterate(); var index: usize = 0; diff --git a/build.zig.zon b/build.zig.zon index b1f501fe..a2fc90dd 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -9,52 +9,59 @@ // read-only HTTPS URL is what a manifest can carry. Re-pin with // `zig fetch --save=cloud9 git+https://git.sr.ht/~gbrls/cloud9#`. .cloud9 = .{ - .url = "git+https://git.sr.ht/~gbrls/cloud9#fe9772b178575fcab93de09fc61c2f13db7db1a8", - .hash = "cloud9-0.1.0-yt86qh4qHgC6OpG4gZE9yoQaO8huc5mnQCaqGwuJ0OU1", + .url = "git+https://git.sr.ht/~gbrls/cloud9#d5c37d9122240fe95d308fbe15874e14dd786c5a", + .hash = "cloud9-0.1.0-yt86qnAvHgB1dEWGakukcJ54GZ7J3mv_lm_kApzAuEOY", }, // Pinned to the exact libvaxis commit ghostty is built against, so it // is compatible with ghostty's uucode configuration (the one we share // with it via `external_uucode` in build.zig). .vaxis = .{ - .url = "git+https://github.com/rockorager/libvaxis.git#1dbbe575dff4586fe51e3217aa5c3fecdcbb6089", - .hash = "vaxis-0.6.0-BWNV_CrbCQCscGpzsAlR402rYQ_tV3aAl081c2iRRkka", + .url = "git+https://github.com/rockorager/libvaxis.git#6fd944a27fb3d6f596e981076381a3131f2448b4", + .hash = "vaxis-0.6.0-BWNV_MafDAAEzkVUvrW9NFUqnnMUoeHqrs2mecnD6D7w", }, .ghostty = .{ - .url = "git+https://github.com/ghostty-org/ghostty.git#82e53e3f6e219e0cf0499fe29c82d925ea26cd5e", - .hash = "ghostty-1.3.2-dev-5UdBCzeJJQXw_vG5Hsfx0DYUmF7Exs_9yctijqOIfp7W", + .url = "git+https://github.com/ghostty-org/ghostty.git#521cf2c5d30bd48028ca61546c64e7913764073d", + .hash = "ghostty-1.3.2-dev-5UdBC6WZfwXgQ6HmA5DH6dGNAUqtDMLrhhrHiBX-99J0", }, // Same uucode commit ghostty and vaxis both depend on. We build it // ourselves (with uucode_config.zig) so ghostty-vt and vaxis can share // a single uucode module. See build.zig for the why. .uucode = .{ - .url = "git+https://github.com/jacobsandlund/uucode#2826a37a4562284fdacd8fa029d49509cc9bffcd", - .hash = "uucode-0.2.0-ZZjBPlK5VADj7fdoq7G8LIHzD5o6FSkcBXXrRWr4jnrA", + .url = "git+https://github.com/jacobsandlund/uucode#ea62149739404a73c202b48a33bf6dd2af4bd9b0", + .hash = "uucode-0.2.0-ZZjBPoGFVgCiflJNFc6Io8xzC67B6PA5bUkk4LT0kCxg", }, + // Pivok7's fork: zig-gamedev/zstbi PR #16, "Upgrade to zig 0.17.0" + // (two lines of build.zig). Back to upstream once it is merged. .zstbi = .{ - .url = "git+https://github.com/zig-gamedev/zstbi#3813f5f113b26f644cfa01a30155cc76b3526e91", - .hash = "zstbi-0.11.0-dev-L0Ea_3GWBwAh7m54XX055vwLKPTPij5hyqyeq92MXPE2", + .url = "git+https://github.com/Pivok7/zstbi#bc96f28d341f9c7fb9cbc5dc65aa4c5cf0c8f007", + .hash = "zstbi-0.11.0-dev-L0Ea_3GWBwCpNHVwGU4MPR_oDd0FoQOYNrGodwvJ6Z45", }, - // SDL3 (castholm/SDL zig bindings) — only fetched/compiled when `-Dsdl` - // is set. Lazy so the default vaxis build never touches it. The sdl + // SDL3 (castholm/SDL zig bindings, its release-3.4.x branch for Zig + // 0.17; david-vanderson's fork, pinned before, has no 0.17 build) — only + // fetched/compiled when `-Dsdl` is set. Lazy so the default vaxis build never touches it. The sdl // package resolves its own linux deps from its own build.zig.zon. .sdl = .{ - .url = "git+https://github.com/david-vanderson/SDL#5bbcf665494fe14acadf50601edf6d5f74ebf96a", - .hash = "sdl-0.4.2+3.4.4-SDL--tB1pQFLgwvCakiiOSoZIuVaz6a6-_gOZC66AGRD", + .url = "git+https://github.com/castholm/SDL#dbcb19aa3583c318556ecae3ecbeb29b102d37c5", + .hash = "sdl-0.6.0+3.4.18-SDL--p-gqAGWpnfTLlhs0dgjDtc4P4_CHeNLGY_SX_Fv", .lazy = true, }, // tree-sitter: Zig bindings + the C runtime, plus grammars (parser.c // we link, highlights.scm we read at build time into the ts_queries module). + // pierrelgol's forks of zig-tree-sitter (here) and tree-sitter-c + // (ts_c), which pin a fork of the tree-sitter core: upstream's + // build.zig files still use APIs Zig 0.17 removed. Their diffs touch + // only the build files and tests. Back to upstream once it moves. .tree_sitter = .{ - .url = "git+https://github.com/tree-sitter/zig-tree-sitter#b55d4977d61330390fc733944da06106ff972660", - .hash = "tree_sitter-0.26.0-8heIf3CaAQB4SSumoGzq3gLSz2rkvXxcKFyskRWqDGBz", + .url = "git+https://github.com/pierrelgol/zig-tree-sitter#2ffef82a12d0305e646ade0e67c693cabc661e05", + .hash = "tree_sitter-0.26.0-8heIf1HEAQCVBaR2wlDhGTw16Ttn1bzERVIwlzNcyO6b", }, .ts_rust = .{ .url = "git+https://github.com/tree-sitter/tree-sitter-rust#77a3747266f4d621d0757825e6b11edcbf991ca5", .hash = "N-V-__8AAHJYbgAipcanYj2A6rnj9wtGzjGzANkrOsqiFAxm", }, .ts_c = .{ - .url = "git+https://github.com/tree-sitter/tree-sitter-c#b780e47fc780ddc8da13afa35a3f4ed5c157823d", - .hash = "tree_sitter_c-0.24.2-y5boS-ptQADHoCoVfjGT_nFtFQ5LbomIkW0fxG3_cmdB", + .url = "git+https://github.com/pierrelgol/tree-sitter-c#67949e4c8dc630c18a522919f2bde2e025a0d025", + .hash = "tree_sitter_c-0.24.2-y5boS-htQACe3pz6jHq4tpS8dB6WIo4-zk_ct7lAjvQT", }, .ts_typst = .{ .url = "git+https://github.com/uben0/tree-sitter-typst#13863ddcbaa7b68ee6221cea2e3143415e64aea4", @@ -185,7 +192,7 @@ .lazy = true, }, }, - .minimum_zig_version = "0.16.0", + .minimum_zig_version = "0.17.0", .paths = .{""}, .fingerprint = 0x41dc46101fc764d8, } diff --git a/build/snap.zig b/build/snap.zig index 7aa06884..35a246ad 100644 --- a/build/snap.zig +++ b/build/snap.zig @@ -44,7 +44,7 @@ pub fn addTty(b: *std.Build, opts: struct { const run_snap = b.addRunArtifact(snap); run_snap.addArtifactArg(opts.exe); run_snap.addPrefixedFileArg("--lspmock=", lspmock.getEmittedBin()); - if (b.args) |args| run_snap.addArgs(args); + run_snap.addPassthruArgs(); // scripts fork children and drive real ptys: never cached, never "up to date" run_snap.has_side_effects = true; const snap_step = b.step("snap", "run the snapshot parity suite (-- --update regenerates goldens)"); @@ -63,7 +63,7 @@ pub fn addTty(b: *std.Build, opts: struct { const run_monkey = b.addRunArtifact(monkey); run_monkey.addArtifactArg(snap); run_monkey.addArtifactArg(opts.exe); - if (b.args) |args| run_monkey.addArgs(args); + run_monkey.addPassthruArgs(); run_monkey.has_side_effects = true; b.step("monkey", "random snapshot scripts hunting panics (-- [steps] [--from=N] [--out=DIR])").dependOn(&run_monkey.step); const monkey_tests = b.addTest(.{ .root_module = monkey.root_module }); @@ -101,7 +101,7 @@ pub fn addWeb(b: *std.Build) void { run_web_snap.step.dependOn(&build_web_snap.step); run_web_snap.step.dependOn(&driver_test.step); run_web_snap.has_side_effects = true; - if (b.args) |args| run_web_snap.addArgs(args); + run_web_snap.addPassthruArgs(); b.step("web-snap", "run browser highlighting, touch, Look, resize and scroll checks").dependOn(&run_web_snap.step); b.step("web-e2e", "run the Chrome-driven DOM end-to-end suite").dependOn(&run_web_snap.step); } diff --git a/docs/typ/building.typ b/docs/typ/building.typ index ae2f3a60..8d7524f9 100644 --- a/docs/typ/building.typ +++ b/docs/typ/building.typ @@ -9,7 +9,7 @@ pieces fit. To install it, see #doc("setup", section: "install"). = Platforms -Zig *0.16.0* (`build.zig.zon` pins `minimum_zig_version`). Dependencies are +Zig *0.17.0* (`build.zig.zon` pins `minimum_zig_version`). Dependencies are fetched and pinned by the manifest; the terminal build needs no system package. The SDL shell builds SDL3 and FreeType from source. PDF support builds MuPDF and is on by default (`-Dmupdf=false` drops it). 9P over QUIC @@ -24,10 +24,11 @@ builds MuPDF and is on by default (`-Dmupdf=false` drops it). 9P over QUIC [`zig build -Dplatform=esp32p4`], [a freestanding riscv32 editor object for the ESP32-P4, with a 384 KiB heap], ) -A bare `zig build` installs into `~/.local`; `--prefix ` installs -elsewhere, except `--prefix zig-out`, which counts as no prefix. With -`-Dplatform` the default prefix is `zig-out`, so always pass `-Dplatform` -while developing. Test, benchmark and run steps build what they need +A bare `zig build` installs into the prefix (`zig-out`, or `--prefix +`) and copies the binaries into `~/.local/bin`; `-Dhome-install=false` +leaves that copy out. Zig 0.17 keeps the prefix from the build script, so +`--prefix` alone no longer stops it. With `-Dplatform` nothing is copied, +so always pass `-Dplatform` while developing. Test, benchmark and run steps build what they need without installing. `pardes --version` prints `pardes ` (from `build.zig.zon`), plus the commit for release builds and the `~/.local` install; `pardes --help` lists every flag. @@ -50,6 +51,7 @@ there; its namespace is in `src/esp32p4_gpio.zig`. [`-Djpx`], [bool, `true`: JPEG 2000, and with it scanned PDFs], [`-Dtree-sitter`], [`disabled`, `zig`, `minimal`, `full`; `full` natively, `zig` for web, `disabled` for esp32p4], [`-Dembed-sources`], [bool, `false`: serve the sources under #file("/src")], + [`-Dhome-install`], [bool: a bare `zig build` also copies the binaries into `~/.local/bin`; default true], [`-Dstamp-commit`], [bool: the git commit in `--version` and crash records; on for release builds and the `~/.local` install], [`-Dtheme-animation`], [bool; on except for esp32p4], [`-Dworkspace-tag`], [bool: draw the workspace tag row; on except for macOS, whose menu bar carries it], diff --git a/docs/typ/install.typ b/docs/typ/install.typ index 9758777d..d97d30f7 100644 --- a/docs/typ/install.typ +++ b/docs/typ/install.typ @@ -18,7 +18,7 @@ #let first = project.mirrors.first() #cmd("git clone " + first.clone + " && cd pardes") -With Zig 0.16 (the build fetches everything else; once that is +With Zig 0.17 (the build fetches everything else; once that is downloaded, a first build from a clean cache took 62 seconds on 16 cores): #cmd("# pardes, in a terminal\nzig build -Dplatform=tty --prefix ~/.local") #cmd("# pardes-gui, its own window\nzig build -Dplatform=gui --prefix ~/.local") diff --git a/mupdf.zig b/mupdf.zig index eeadaa5d..761fef92 100644 --- a/mupdf.zig +++ b/mupdf.zig @@ -293,7 +293,7 @@ fn configureModule(module: *std.Build.Module, dependency: *std.Build.Dependency, } fn flatCSources(b: *std.Build, io: std.Io, dependency: *std.Build.Dependency, relative_dir: []const u8) []const []const u8 { - var dir = std.Io.Dir.cwd().openDir(io, dependency.path(relative_dir).getPath(b), .{ .iterate = true }) catch + var dir = dependency.builder.root.root_dir.handle.openDir(io, relative_dir, .{ .iterate = true }) catch std.debug.panic("MuPDF source directory is missing: {s}", .{relative_dir}); defer dir.close(io); @@ -317,9 +317,9 @@ fn flatCSources(b: *std.Build, io: std.Io, dependency: *std.Build.Dependency, re } fn readMakelists(b: *std.Build, io: std.Io, dependency: *std.Build.Dependency) []const u8 { - return std.Io.Dir.cwd().readFileAlloc( + return dependency.builder.root.root_dir.handle.readFileAlloc( io, - dependency.path("Makelists").getPath(b), + "Makelists", b.allocator, .limited(1024 * 1024), ) catch @panic("read MuPDF Makelists"); diff --git a/src/9p_io.zig b/src/9p_io.zig index 18c51ece..27d79b93 100644 --- a/src/9p_io.zig +++ b/src/9p_io.zig @@ -1553,7 +1553,7 @@ test "a socket path too long for sun_path is no listener, and leaves the editor' } else { _ = unsetenv("XDG_RUNTIME_DIR"); }; - const long = "n" ** 120; + const long = &@as([120]u8, @splat('n')); try testing.expect(listen(testing.io, testing.allocator, p, long, "", null, null) == null); try testing.expect(pardes.turn.answer_held == null); try testing.expect(pardes.turn.wake_parked == null); @@ -1567,7 +1567,7 @@ test "a listening editor posts itself into the 9P registry and unposts on stop" _ = try std.fmt.bufPrintSentinel(&directory, "/tmp/pardes-post-XXXXXX", .{}, 0); if (mkdtemp(&directory) == null) return error.TempDirectoryFailed; const dir = std.mem.span(@as([*:0]const u8, &directory)); - const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeZ(u8, std.mem.span(v)) else null; + const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeSentinel(u8, std.mem.span(v), 0) else null; defer { if (old_runtime) |v| { _ = setenv("XDG_RUNTIME_DIR", v, 1); @@ -1628,7 +1628,7 @@ test "Unix TCP and QUIC share one listener through reads writes reconnects and r if (mkdtemp(&directory) == null) return error.TempDirectoryFailed; // What the listener posted and left inside goes with it. defer std.Io.Dir.cwd().deleteTree(testing.io, std.mem.sliceTo(&directory, 0)) catch |err| std.debug.print("deleteTree: {s}\n", .{@errorName(err)}); - const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeZ(u8, std.mem.span(v)) else null; + const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeSentinel(u8, std.mem.span(v), 0) else null; defer { if (old_runtime) |v| { _ = setenv("XDG_RUNTIME_DIR", v, 1); @@ -1749,7 +1749,7 @@ test "a change waits while the editor is out mid-step, a read does not, and the if (mkdtemp(&directory) == null) return error.TempDirectoryFailed; // What the listener posted and left inside goes with it. defer std.Io.Dir.cwd().deleteTree(testing.io, std.mem.sliceTo(&directory, 0)) catch |err| std.debug.print("deleteTree: {s}\n", .{@errorName(err)}); - const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeZ(u8, std.mem.span(v)) else null; + const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeSentinel(u8, std.mem.span(v), 0) else null; defer { if (old_runtime) |v| { _ = setenv("XDG_RUNTIME_DIR", v, 1); @@ -1824,7 +1824,7 @@ test "a held read is answered when the log has news, and a flushed one spends no if (mkdtemp(&directory) == null) return error.TempDirectoryFailed; // What the listener posted and left inside goes with it. defer std.Io.Dir.cwd().deleteTree(testing.io, std.mem.sliceTo(&directory, 0)) catch |err| std.debug.print("deleteTree: {s}\n", .{@errorName(err)}); - const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeZ(u8, std.mem.span(v)) else null; + const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeSentinel(u8, std.mem.span(v), 0) else null; defer { if (old_runtime) |v| { _ = setenv("XDG_RUNTIME_DIR", v, 1); @@ -2051,7 +2051,7 @@ test "a pane's PARDES_MOUNT is the session's directory under 9ns --mntgen, and u const names = [_][*:0]const u8{ "NINE_MNTGEN", "NINE_MOUNT", "PARDES_MOUNT" }; var saved: [names.len]?[:0]u8 = @splat(null); for (names, &saved) |name, *value| { - if (libc.getenv(name)) |old| value.* = try testing.allocator.dupeZ(u8, std.mem.span(old)); + if (libc.getenv(name)) |old| value.* = try testing.allocator.dupeSentinel(u8, std.mem.span(old), 0); } defer for (names, saved) |name, value| { if (value) |old| { @@ -2073,7 +2073,7 @@ test "9P shell environment states being inside pardes apart from how to reach it const names = [_][*:0]const u8{ "XDG_RUNTIME_DIR", "HOME", "PARDES_PID", "PARDES_9P", "PARDES_PANE" }; var saved: [names.len]?[:0]u8 = @splat(null); for (names, &saved) |name, *value| { - if (libc.getenv(name)) |old| value.* = try testing.allocator.dupeZ(u8, std.mem.span(old)); + if (libc.getenv(name)) |old| value.* = try testing.allocator.dupeSentinel(u8, std.mem.span(old), 0); } defer for (names, saved) |name, value| { if (value) |old| { diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index 4fe0760c..c6c2eadd 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -17,6 +17,14 @@ - A diff paged into a session (`git show | pardes -`) opens its `+Diff` alone; the `+Pager` no longer stays folded under it. +- Built with Zig 0.17. A bare `zig build` still puts the binaries in + `~/.local/bin`, now as a copy beside the prefix, which `--prefix` no + longer prevents; `-Dhome-install=false` does. ghostty, libvaxis, uucode + and SDL (3.4.18) move to their Zig 0.17 versions, and tree-sitter to a + 0.28 development snapshot. +- A terminal's edited copy goes when the program clears the screen, + instead of staying where its rows were. + - n/N follow Helix search registers, counts, wrapping and select mode. `*` sets a search from the selection; `Alt-*` omits word boundaries. The location ring remains as LookNext/LookPrev (Space j n/p). diff --git a/src/Layer.zig b/src/Layer.zig index 7a5fcf7e..ba45bc88 100644 --- a/src/Layer.zig +++ b/src/Layer.zig @@ -51,7 +51,7 @@ cols: u16 = 0, rows: u16 = 0, /// A body's compact rows, from its top. context_rows: u16 = 0, -context_separators: std.bit_set.StaticBitSet(limits.wrap_rows) = .initEmpty(), +context_separators: std.bit_set.StaticBitSet(limits.wrap_rows) = .empty, /// `rows * cols`, row after row. cells: []pardes.Cell = &.{}, cursor: ?struct { x: u16, y: u16, bar: bool = false } = null, @@ -72,7 +72,7 @@ pub fn capacity(layer: *const Layer, metrics: Metrics) u16 { } pub fn setContextLines(layer: *Layer, lines: []const i32) void { - layer.context_separators = .initEmpty(); + layer.context_separators = .empty; const count = @min(lines.len, layer.context_rows); var index: usize = 0; while (index + 1 < count and index < limits.wrap_rows) : (index += 1) { diff --git a/src/Messages.zig b/src/Messages.zig index 2314939f..b67a8402 100644 --- a/src/Messages.zig +++ b/src/Messages.zig @@ -519,20 +519,20 @@ pub fn errorWords(err: anyerror, buf: []u8) []const u8 { /// A ZON parse failure in a person's words: the first error the parser /// found and its line, `line 3: expected ','`. pub fn zonWhy(diag: *const std.zon.parse.Diagnostics, buf: []u8) []const u8 { - var errors = diag.iterateErrors(); - const first = errors.next() orelse return "not valid ZON"; - const loc = first.getLocation(diag); - return std.fmt.bufPrint(buf, "line {d}: {f}", .{ loc.line + 1, first.fmtMessage(diag) }) catch "not valid ZON"; + if (diag.errors.len == 0) return "not valid ZON"; + const first = diag.errors[0]; + return std.fmt.bufPrint(buf, "line {d}: {s}", .{ first.loc.line + 1, first.msg }) catch "not valid ZON"; } test "errors are said in words, and a ZON failure names its line" { var buf: [128]u8 = undefined; try std.testing.expectEqualStrings("file not found", errorWords(error.FileNotFound, &buf)); try std.testing.expectEqualStrings("too large", errorWords(error.FileTooLarge, &buf)); - var diag: std.zon.parse.Diagnostics = .{}; - defer diag.deinit(std.testing.allocator); + var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); + defer arena.deinit(); + var diag: std.zon.parse.Diagnostics = undefined; const T = struct { a: u8 }; - try std.testing.expectError(error.ParseZon, std.zon.parse.fromSliceAlloc(T, std.testing.allocator, ".{\n .a = 1,\n .b = 2 }", &diag, .{})); + try std.testing.expectError(error.ParseZon, std.zon.parse.fromSlice(T, .{ .gpa = std.testing.allocator, .arena = arena.allocator(), .source = ".{\n .a = 1,\n .b = 2 }", .diagnostics = &diag })); try std.testing.expect(std.mem.startsWith(u8, zonWhy(&diag, &buf), "line 3: ")); } diff --git a/src/TerminalImages.zig b/src/TerminalImages.zig index bc1b2ea8..4140813f 100644 --- a/src/TerminalImages.zig +++ b/src/TerminalImages.zig @@ -38,6 +38,72 @@ const GlyphKey = struct { id: u32, generation: u64, src: PixelRect, cols: u16 }; /// left corner (above or left of it is negative). const Rect = struct { x: i64, y: i64, w: i64, h: i64 }; +/// The runs of Kitty placeholder cells between two pins, one row's run at a +/// time, as ghostty's own `kitty.graphics.unicode.placementIterator` gave +/// them before it moved into its RenderState, which pardes does not keep. +const PlaceholderRuns = struct { + rows: ghostty_vt.PageList.RowIterator, + row: ?ghostty_vt.Pin, + /// Where the scan of `row` resumes: a run ended by an incompatible + /// placeholder starts the next one there. + x: usize = 0, + + fn init(top: ghostty_vt.Pin, bottom: ghostty_vt.Pin) PlaceholderRuns { + var rows = top.rowIterator(.right_down, bottom); + const row = rows.next(); + return .{ .rows = rows, .row = row }; + } + + fn next(self: *PlaceholderRuns) ?gfx.unicode.Placement { + while (self.row) |row| { + if (!row.rowAndCell().row.kitty_virtual_placeholder) { + self.advance(); + continue; + } + var run: ?gfx.unicode.IncompletePlacement = null; + var start: usize = 0; + const cells = row.cells(.all); + while (self.x < cells.len) : (self.x += 1) { + const cell = &cells[self.x]; + if (cell.codepoint() != gfx.unicode.placeholder) { + if (run) |done| return complete(row, start, done); + continue; + } + const style = row.style(cell); + const curr: gfx.unicode.IncompletePlacement = .init(&style, row.grapheme(cell) orelse &.{}); + if (run) |*prev| { + if (!prev.append(&curr)) return complete(row, start, prev.*); + } else { + run = curr.start(); + start = self.x; + } + } + self.advance(); + if (run) |done| return complete(row, start, done); + } + return null; + } + + fn advance(self: *PlaceholderRuns) void { + self.row = self.rows.next(); + self.x = 0; + } + + fn complete(row: ghostty_vt.Pin, x: usize, run: gfx.unicode.IncompletePlacement) gfx.unicode.Placement { + var pin = row; + pin.x = @intCast(x); + return .{ + .pin = pin, + .image_id = run.imageId(), + .placement_id = run.placement_id orelse 0, + .col = run.col.?, + .row = run.row.?, + .width = run.width, + .height = 1, + }; + } +}; + pub fn deinit(ti: *TerminalImages, gpa: std.mem.Allocator) void { var conv = ti.converted.valueIterator(); while (conv.next()) |c| gpa.free(c.rgba); @@ -91,7 +157,7 @@ pub fn draw( // Virtual placements: shown through the placeholder cells, one run of // them on a row at a time. The placeholders themselves are not text. - var runs = gfx.unicode.placementIterator(top, bottom); + var runs: PlaceholderRuns = .init(top, bottom); while (runs.next()) |run| { const at = pages.pointFromPin(.viewport, run.pin) orelse continue; const v = at.viewport.y; @@ -104,7 +170,8 @@ pub fn draw( cell.len = 1; } const img = storage.imageById(run.image_id) orelse continue; - const rp = run.renderPlacement(storage, &img, cw, ch) catch continue; + const target = storage.placeholderTarget(run.image_id, run.placement_id) orelse continue; + const rp = run.renderPlacement(&target.placement, &img, cw, ch) catch continue; if (rp.dest_width == 0 or rp.dest_height == 0 or rp.source_width == 0 or rp.source_height == 0) continue; ctx.place(img, .{ .x = rp.source_x, .y = rp.source_y, .w = rp.source_width, .h = rp.source_height }, .{ .x = @as(i64, at.viewport.x) * cw + rp.offset_x, @@ -122,7 +189,8 @@ pub fn draw( const placed = entry.value_ptr.*; const pin = switch (placed.location) { .pin => |pin| pin, - .virtual => continue, + // ponytail: a placement relative to another (P=/Q=, new in ghostty) is not drawn; resolve its chain if a program needs it. + .virtual, .relative => continue, }; const img = storage.images.get(entry.key_ptr.image_id) orelse continue; const at = pages.pointFromPin(.screen, pin.*) orelse continue; @@ -221,7 +289,8 @@ const Ctx = struct { fn pixelsOf(ti: *TerminalImages, gpa: std.mem.Allocator, img: gfx.Image) ?[]const u8 { const n = @as(usize, img.width) * img.height; if (n == 0) return null; - if (img.format == .rgba) return if (img.data.len == n * 4) img.data else null; + const data = img.data.bytes() orelse return null; + if (img.format == .rgba) return if (data.len == n * 4) data else null; const gop = ti.converted.getOrPut(gpa, img.id) catch return null; if (gop.found_existing) { if (gop.value_ptr.generation == img.generation) { @@ -247,10 +316,11 @@ fn convert(gpa: std.mem.Allocator, img: gfx.Image, n: usize) ?[]u8 { .gray => 1, else => return null, }; - if (img.data.len != n * depth) return null; + const data = img.data.bytes() orelse return null; + if (data.len != n * depth) return null; const out = gpa.alloc(u8, n * 4) catch return null; for (0..n) |i| { - const px = img.data[i * depth ..][0..depth]; + const px = data[i * depth ..][0..depth]; out[i * 4 ..][0..4].* = switch (depth) { 3 => .{ px[0], px[1], px[2], 255 }, 2 => .{ px[0], px[0], px[0], px[1] }, diff --git a/src/builtins.zig b/src/builtins.zig index f73c5982..d9cef8c9 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -98,11 +98,11 @@ fn isEnabled(comptime T: type) bool { /// word that is one here, or in no build. pub fn absentWhy(name: []const u8) ?[]const u8 { @setEvalBranchQuota(20000); - inline for (@typeInfo(@This()).@"struct".decls) |d| { - if (comptime @TypeOf(@field(@This(), d.name)) == type) { - const T = @field(@This(), d.name); + inline for (@typeInfo(@This()).@"struct".decl_names) |d| { + if (comptime @TypeOf(@field(@This(), d)) == type) { + const T = @field(@This(), d); if (comptime @typeInfo(T) == .@"struct" and @hasDecl(T, "run") and !isEnabled(T)) { - if (std.mem.eql(u8, d.name, name)) return if (@hasDecl(T, "gui_only")) "GUI-only" else "not in this build"; + if (std.mem.eql(u8, d, name)) return if (@hasDecl(T, "gui_only")) "GUI-only" else "not in this build"; } } } @@ -112,12 +112,12 @@ pub fn absentWhy(name: []const u8) ?[]const u8 { fn manualBuiltinCount() comptime_int { comptime { var count = 0; - for (@typeInfo(@This()).@"struct".decls) |d| { - if (@TypeOf(@field(@This(), d.name)) != type) continue; - const T = @field(@This(), d.name); + for (@typeInfo(@This()).@"struct".decl_names) |d| { + if (@TypeOf(@field(@This(), d)) != type) continue; + const T = @field(@This(), d); if (@typeInfo(T) != .@"struct" or !@hasDecl(T, "run") or !isEnabled(T)) continue; if (@TypeOf(T.run) != fn (Ctx) void) - @compileError(d.name ++ ".run must have signature fn (Ctx) void"); + @compileError(d ++ ".run must have signature fn (Ctx) void"); count += 1; } return count; @@ -129,9 +129,9 @@ fn manualBuiltinList() [manualBuiltinCount()]type { @setEvalBranchQuota(4000); var list: [manualBuiltinCount()]type = undefined; var count = 0; - for (@typeInfo(@This()).@"struct".decls) |d| { - if (@TypeOf(@field(@This(), d.name)) != type) continue; - const T = @field(@This(), d.name); + for (@typeInfo(@This()).@"struct".decl_names) |d| { + if (@TypeOf(@field(@This(), d)) != type) continue; + const T = @field(@This(), d); if (@typeInfo(T) != .@"struct" or !@hasDecl(T, "run") or !isEnabled(T)) continue; list[count] = T; count += 1; @@ -317,7 +317,7 @@ test "Exit over a ctl write or a click names every pane it asks about, a second first.file.?.saved_hash = 0; // edited: what it had is not what it has p.newScratchBelow(p.active); const second = p.panes[p.active].?; - panes.File.setContent(p, &second.file.?, try std.testing.allocator.dupe(u8, "x" ** 120)); + panes.File.setContent(p, &second.file.?, try std.testing.allocator.dupe(u8, &@as([120]u8, @splat('x')))); try std.testing.expect(second.file.?.revision != second.file.?.saved_revision); // A ctl write, or a click through exec (ctl.captured). if (clicked) p.fs.capturing = true else p.fs.no_prompt = true; @@ -341,7 +341,7 @@ test "Exit over a ctl write or a click names every pane it asks about, a second try std.testing.expect(noticed); // Edited since: only that one is named again (acme's rule). p.fs.failure_len = 0; - panes.File.setContent(p, &second.file.?, try std.testing.allocator.dupe(u8, "y" ** 120)); + panes.File.setContent(p, &second.file.?, try std.testing.allocator.dupe(u8, &@as([120]u8, @splat('y')))); try std.testing.expect(p.executeBuiltinLine(p.active, "Exit")); try std.testing.expect(!p.quit); const again = p.fs.failure[0..p.fs.failure_len]; diff --git a/src/colors.zig b/src/colors.zig index 379d1301..dd0d8938 100644 --- a/src/colors.zig +++ b/src/colors.zig @@ -205,7 +205,7 @@ const name_tint_chroma: f32 = 0.06; /// ink where that hue holds, the name reads on its ground (nameTintFloor) /// and it stands off the ink. Null when no colour of the theme will do. fn derivedNameTint(th: *const Theme, ink: [3]u8, ground: [3]u8) ?[3]u8 { - const pal = th.palette orelse [_][3]u8{th.kw} ** 16; + const pal = th.palette orelse @as([16][3]u8, @splat(th.kw)); const sources = [_][3]u8{ th.kw, pal[4], pal[5], pal[6], pal[3], pal[2], pal[1], th.num, th.str, th.box } ++ [_][3]u8{ th.column_box orelse th.num, th.box_dirty orelse th.num, th.sel_bg, th.search_bg orelse th.num } ++ [_][3]u8{ th.diagnostic_info orelse th.num, th.diagnostic_hint orelse th.num, th.diagnostic_warning orelse th.num } ++ @@ -468,28 +468,29 @@ const curated = struct { pub const dark = @import("themes/dark.zig"); }; -fn fold(comptime C: type) [@typeInfo(C).@"struct".decls.len]Theme { +fn fold(comptime C: type) [@typeInfo(C).@"struct".decl_names.len]Theme { comptime { @setEvalBranchQuota(400000); - var out: [@typeInfo(C).@"struct".decls.len]Theme = undefined; - for (@typeInfo(C).@"struct".decls, 0..) |d, i| { + var out: [@typeInfo(C).@"struct".decl_names.len]Theme = undefined; + const theme_info = @typeInfo(Theme).@"struct"; + for (@typeInfo(C).@"struct".decl_names, 0..) |d, i| { var t: Theme = undefined; - const source = @field(C, d.name).theme; - for (@typeInfo(Theme).@"struct".fields) |f| { - @field(t, f.name) = if (f.type == ?Decor and @hasField(@TypeOf(source), f.name)) decor: { + const source = @field(C, d).theme; + for (theme_info.field_names, theme_info.field_types, theme_info.field_attrs) |name, T, attrs| { + @field(t, name) = if (T == ?Decor and @hasField(@TypeOf(source), name)) decor: { // A nested literal is folded field by field too. var decor: Decor = .{}; - const given = @field(source, f.name); - for (@typeInfo(Decor).@"struct".fields) |g| if (@hasField(@TypeOf(given), g.name)) { - @field(decor, g.name) = @field(given, g.name); + const given = @field(source, name); + for (@typeInfo(Decor).@"struct".field_names) |g| if (@hasField(@TypeOf(given), g)) { + @field(decor, g) = @field(given, g); }; break :decor decor; - } else if (@hasField(@TypeOf(source), f.name)) - @field(source, f.name) - else if (f.default_value_ptr) |ptr| - @as(*const f.type, @ptrCast(@alignCast(ptr))).* + } else if (@hasField(@TypeOf(source), name)) + @field(source, name) + else if (attrs.defaultValue(T)) |value| + value else - @compileError("theme " ++ d.name ++ " is missing " ++ f.name); + @compileError("theme " ++ d ++ " is missing " ++ name); } out[i] = t; } @@ -501,7 +502,7 @@ fn fold(comptime C: type) [@typeInfo(C).@"struct".decls.len]Theme { /// takes: a faithful port (`dracula`) keeps the plain name, and helix's /// looser copy of it is still there as `dracula_helix` (the zed ones already /// carry `_zed`). -fn foldImports(comptime ours: anytype, comptime C: type) [@typeInfo(C).@"struct".decls.len]Theme { +fn foldImports(comptime ours: anytype, comptime C: type) [@typeInfo(C).@"struct".decl_names.len]Theme { comptime { @setEvalBranchQuota(400000); var out = fold(C); @@ -514,7 +515,7 @@ fn foldImports(comptime ours: anytype, comptime C: type) [@typeInfo(C).@"struct" pub const themes = fold(curated) ++ foldImports(fold(curated), @import("generated_themes")); /// The first `native_count` of `themes` are pardes's own; the rest imported. -pub const native_count = @typeInfo(curated).@"struct".decls.len; +pub const native_count = @typeInfo(curated).@"struct".decl_names.len; /// The picker's sections (`Themes`), in ring order, each running from /// the theme it names to the next section's; `NextColor` and `Theme` still @@ -677,8 +678,8 @@ pub const ChromeTheme = struct { pub fn interpolate(from: ChromeTheme, to: ChromeTheme, step: u16, steps: u16) ChromeTheme { var out: ChromeTheme = undefined; const t = @as(f32, @floatFromInt(@min(step, steps))) / @as(f32, @floatFromInt(@max(1, steps))); - inline for (@typeInfo(ChromeTheme).@"struct".fields) |field| - @field(out, field.name) = if (step == 0) @field(from, field.name) else if (step >= steps) @field(to, field.name) else mixOklab(@field(from, field.name), @field(to, field.name), t); + inline for (@typeInfo(ChromeTheme).@"struct".field_names) |name| + @field(out, name) = if (step == 0) @field(from, name) else if (step >= steps) @field(to, name) else mixOklab(@field(from, name), @field(to, name), t); return out; } }; @@ -801,14 +802,16 @@ pub fn loadThemeFile(p: *Pardes, generation: u32, bytes: []const u8, animate: bo themeFileError(p, request, error.ThemeFileTooLarge); return false; } - const source = p.gpa.dupeZ(u8, bytes) catch |err| { + const source = p.gpa.dupeSentinel(u8, bytes, 0) catch |err| { themeFileError(p, request, err); return false; }; defer p.gpa.free(source); - var diagnostics: std.zon.parse.Diagnostics = .{}; - defer diagnostics.deinit(p.gpa); - const parsed = std.zon.parse.fromSliceAlloc(Theme, p.gpa, source, &diagnostics, .{}) catch |err| { + // The parse's results live in `arena`; the theme kept owns only its name. + var arena: std.heap.ArenaAllocator = .init(p.gpa); + defer arena.deinit(); + var diagnostics: std.zon.parse.Diagnostics = undefined; + var parsed = std.zon.parse.fromSlice(Theme, .{ .gpa = p.gpa, .arena = arena.allocator(), .source = source, .diagnostics = &diagnostics }) catch |err| { if (err != error.ParseZon) themeFileError(p, request, err) else { // Which line, and what the parser wanted there. var why: [200]u8 = undefined; @@ -817,10 +820,13 @@ pub fn loadThemeFile(p: *Pardes, generation: u32, bytes: []const u8, animate: bo return false; }; if (parsed.name.len == 0 or parsed.name.len > 255) { - std.zon.parse.free(p.gpa, parsed); themeFileError(p, request, error.InvalidThemeName); return false; } + parsed.name = p.gpa.dupe(u8, parsed.name) catch |err| { + themeFileError(p, request, err); + return false; + }; const target_chrome = ChromeTheme.fromTheme(&parsed); if (animate and p.animate_theme_changes) @@ -829,7 +835,7 @@ pub fn loadThemeFile(p: *Pardes, generation: u32, bytes: []const u8, animate: bo p.chrome_animation.snap(target_chrome); const old = p.custom_theme; p.custom_theme = parsed; - if (old) |theme_value| std.zon.parse.free(p.gpa, theme_value); + if (old) |theme_value| p.gpa.free(theme_value.name); var settled: [limits.host_path_cap]u8 = undefined; @memcpy(settled[0..request.path.len], request.path); _ = p.theme_file_loaded.set(settled[0..request.path.len]); @@ -847,7 +853,7 @@ pub fn carryTheme(p: *Pardes, old: *const Pardes, index: bool) !void { const t = old.custom_theme orelse return; var copy = t; copy.name = try p.gpa.dupe(u8, t.name); - if (p.custom_theme) |mine| std.zon.parse.free(p.gpa, mine); + if (p.custom_theme) |mine| p.gpa.free(mine.name); p.custom_theme = copy; _ = p.theme_file_loaded.set(old.theme_file_loaded.get()); } @@ -931,7 +937,7 @@ fn likeness(theme_name: []const u8, name: []const u8) usize { in_order += 1; pos = at + 1; } - const inside: usize = if (name.len > 0 and std.ascii.indexOfIgnoreCase(theme_name, name) != null) name.len * 4 else 0; + const inside: usize = if (name.len > 0 and std.ascii.findIgnoreCase(theme_name, name) != null) name.len * 4 else 0; return prefix * 3 + in_order + inside; } @@ -952,7 +958,7 @@ pub fn setThemeIndex(p: *Pardes, index: usize) void { p.chrome_animation.snap(target_chrome); if (p.custom_theme) |theme_value| { p.custom_theme = null; - std.zon.parse.free(p.gpa, theme_value); + p.gpa.free(theme_value.name); } p.theme_file_loaded.clear(); if (p.theme_file_path.get().len > 0) { @@ -1264,10 +1270,12 @@ test "legacy ThemeFile documents inherit Pardes UI roles without new fields" { rest = rest[at + std.mem.indexOfScalar(u8, rest[at..], '}').? + 1 ..]; rest = std.mem.trimStart(u8, rest, " ,"); } - const source = try std.testing.allocator.dupeZ(u8, legacy.items); + const source = try std.testing.allocator.dupeSentinel(u8, legacy.items, 0); defer std.testing.allocator.free(source); - const parsed = try std.zon.parse.fromSliceAlloc(Theme, std.testing.allocator, source, null, .{}); - defer std.zon.parse.free(std.testing.allocator, parsed); + var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); + defer arena.deinit(); + var diagnostics: std.zon.parse.Diagnostics = undefined; + const parsed = try std.zon.parse.fromSlice(Theme, .{ .gpa = std.testing.allocator, .arena = arena.allocator(), .source = source, .diagnostics = &diagnostics }); try std.testing.expectEqual(@as(?[3]u8, null), parsed.tag_active_bg); try std.testing.expectEqual(@as(?[3]u8, null), parsed.tag_name_fg); try std.testing.expectEqual(@as(?[3]u8, null), parsed.tag_active_name_fg); diff --git a/src/config.zig b/src/config.zig index 50009660..8166954d 100644 --- a/src/config.zig +++ b/src/config.zig @@ -2170,10 +2170,12 @@ pub const User = struct { defer gpa.free(one_path); const bytes = try std.Io.Dir.cwd().readFileAlloc(io, one_path, gpa, .limited(4096)); defer gpa.free(bytes); - const source = try gpa.dupeZ(u8, bytes); + const source = try gpa.dupeSentinel(u8, bytes, 0); defer gpa.free(source); - const parsed = try std.zon.parse.fromSliceAlloc(Sample, gpa, source, null, .{}); - defer std.zon.parse.free(gpa, parsed); + var arena: std.heap.ArenaAllocator = .init(gpa); + defer arena.deinit(); + var diagnostics: std.zon.parse.Diagnostics = undefined; + const parsed = try std.zon.parse.fromSlice(Sample, .{ .gpa = gpa, .arena = arena.allocator(), .source = source, .diagnostics = &diagnostics }); try std.testing.expectEqualStrings("one", parsed.name); try std.testing.expectEqual([3]u8{ 1, 2, 3 }, parsed.rgb); } @@ -2239,25 +2241,26 @@ const doc_typ = struct { fn hasChordField(T: type) bool { if (@typeInfo(T) != .array or @typeInfo(@typeInfo(T).array.child) != .@"struct") return false; - for (@typeInfo(@typeInfo(T).array.child).@"struct".fields) |f| if (f.type == Chord) return true; + for (@typeInfo(@typeInfo(T).array.child).@"struct".field_types) |F| if (F == Chord) return true; return false; } /// Bound somewhere in this file: a binding, a prefix or a key list. fn bound(c: Chord) bool { const config = @import("config.zig"); - inline for (@typeInfo(config).@"struct".decls) |d| { - const v = @field(config, d.name); + inline for (@typeInfo(config).@"struct".decl_names) |d| { + const v = @field(config, d); const T = @TypeOf(v); if (T == []const Chord) { for (v) |b| if (same(b, c)) return true; } else if (T == comptime_int or T == u21 or T == u8) { // a prefix or a bare key; only the tty toggle carries Ctrl - const plain = !c.alt and !c.shift and (!c.ctrl or comptime std.mem.indexOf(u8, d.name, "toggle") != null); + const plain = !c.alt and !c.shift and (!c.ctrl or comptime std.mem.indexOf(u8, d, "toggle") != null); if (plain and v >= 0x20 and v < 0x7f and v == c.cp) return true; } else if (comptime hasChordField(T)) { - for (v) |e| inline for (@typeInfo(@TypeOf(e)).@"struct".fields) |f| - if (f.type == Chord and same(@field(e, f.name), c)) return true; + const info = @typeInfo(@TypeOf(v[0])).@"struct"; + for (v) |e| inline for (info.field_names, info.field_types) |name, F| + if (F == Chord and same(@field(e, name), c)) return true; } } return false; diff --git a/src/detached/client.zig b/src/detached/client.zig index 69ab2fdd..cf1842d9 100644 --- a/src/detached/client.zig +++ b/src/detached/client.zig @@ -1182,12 +1182,12 @@ test "detached session: a frontend is never asked to fork, write, or watch" { // One: the union a frontend decodes into has no other variant. Named // rather than counted, so re-adding `spawn` fails with the name in it. - const fields = @typeInfo(wire.ServerMsg).@"union".fields; - inline for (fields) |f| { + const fields = @typeInfo(wire.ServerMsg).@"union".field_names; + inline for (fields) |name| { for (allowed) |ok| { - if (std.mem.eql(u8, f.name, ok)) break; + if (std.mem.eql(u8, name, ok)) break; } else { - std.debug.print("ServerMsg.{s} is not an effect a frontend may perform\n", .{f.name}); + std.debug.print("ServerMsg.{s} is not an effect a frontend may perform\n", .{name}); return error.MachineLocalEffectOnTheWire; } } diff --git a/src/detached/wire.zig b/src/detached/wire.zig index c9d9b578..f1b7a1b3 100644 --- a/src/detached/wire.zig +++ b/src/detached/wire.zig @@ -20,9 +20,10 @@ const chrome_layout: u64 = 0x5e758b47fb0cf8da; comptime { @setEvalBranchQuota(10_000); var hash = std.hash.Fnv1a_64.init(); - for (@typeInfo(pardes.Chrome).@"struct".fields) |field| { - hash.update(field.name); - hash.update(@typeName(field.type)); + const info = @typeInfo(pardes.Chrome).@"struct"; + for (info.field_names, info.field_types) |name, T| { + hash.update(name); + hash.update(@typeName(T)); } if (hash.final() != chrome_layout) @compileError(std.fmt.comptimePrint("pardes.Chrome changed (layout 0x{x}): bump wire.version, then chrome_layout", .{hash.final()})); } @@ -285,21 +286,22 @@ pub const Frame = struct { region.clip > region.rect.w or region.thumb_y > region.rect.h or region.thumb_h > region.rect.h - region.thumb_y) return error.BadValue; regions.appendAssumeCapacity(region); } - inline for (@typeInfo(pardes.Chrome).@"struct".fields) |field| { - const rgb = &@field(chrome, field.name); - if (field.type == ?[3]u8) { + const info = @typeInfo(pardes.Chrome).@"struct"; + inline for (info.field_names, info.field_types) |name, T| { + const rgb = &@field(chrome, name); + if (T == ?[3]u8) { if (try r.getBool()) { rgb.* = .{ 0, 0, 0 }; for (&rgb.*.?) |*channel| channel.* = try r.getByte(); } - } else if (field.type == u8) { + } else if (T == u8) { rgb.* = try r.getByte(); - } else if (field.type == u32) { + } else if (T == u32) { rgb.* = try r.getU32(); - } else if (field.type == f32) { + } else if (T == f32) { rgb.* = @bitCast(try r.getU32()); if (!std.math.isFinite(rgb.*)) return error.BadValue; - } else if (field.type == [8]f32) { + } else if (T == [8]f32) { for (rgb) |*value| { value.* = @bitCast(try r.getU32()); if (!std.math.isFinite(value.*)) return error.BadValue; @@ -781,7 +783,7 @@ pub fn layersBound(layers: []const pardes.Layer, tags: []const pardes.Layer, reg const region_len = 1 + 1 + 4 + 8 + 1 + 2 + 2 + 1 + 2 + 4 + 4; /// The palette: each colour three bytes, a theme's optional ones a flag /// before them. -const chrome_len = @typeInfo(pardes.Chrome).@"struct".fields.len * 4 + 8 * 4; +const chrome_len = @typeInfo(pardes.Chrome).@"struct".field_names.len * 4 + 8 * 4; pub fn encodeFrameLayers(out: []u8, cols: u16, rows: u16, cursor: ?Cursor, pointer_shape: pardes.Surface.PointerShape, cells: []const pardes.Cell, prev: []const pardes.Cell, layers: []const pardes.Layer, tags: []const pardes.Layer, regions: []const pardes.Region, chrome: pardes.Chrome) Error![]const u8 { // The protocol's ceiling, enforced by the ENCODER too, and BEFORE the @@ -865,18 +867,19 @@ pub fn encodeFrameLayers(out: []u8, cols: u16, rows: u16, cursor: ?Cursor, point try w.putU32(@bitCast(region.lift)); try w.putU32(@bitCast(region.line)); } - inline for (@typeInfo(pardes.Chrome).@"struct".fields) |field| { - const rgb = @field(chrome, field.name); - if (field.type == ?[3]u8) { + const info = @typeInfo(pardes.Chrome).@"struct"; + inline for (info.field_names, info.field_types) |name, T| { + const rgb = @field(chrome, name); + if (T == ?[3]u8) { try w.putBool(rgb != null); if (rgb) |value| for (value) |channel| try w.putByte(channel); - } else if (field.type == u8) { + } else if (T == u8) { try w.putByte(rgb); - } else if (field.type == u32) { + } else if (T == u32) { try w.putU32(rgb); - } else if (field.type == f32) { + } else if (T == f32) { try w.putU32(@bitCast(rgb)); - } else if (field.type == [8]f32) { + } else if (T == [8]f32) { for (rgb) |value| try w.putU32(@bitCast(value)); } else for (rgb) |channel| try w.putByte(channel); } diff --git a/src/draw.zig b/src/draw.zig index b35d55e8..e6420ed4 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -1598,7 +1598,7 @@ test "a tag of three rows has its grip on the first, and band under it that stil test "place puts every part where the painters and layers put it, in every layout" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 30 }); defer p.deinit(); - _ = try p.setTestFile("placed\n" ** 80); + _ = try p.setTestFile(std.mem.asBytes(&@as([80][7]u8, @splat("placed\n".*)))); p.newColumn(0); p.newScratchIn(0, p.activeColumn().?); p.newScratchBelow(0); @@ -1713,7 +1713,7 @@ test "a notice wider than its band, as a shader's compile error is, draws its en _ = try p.setTestFile("text\n"); var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); - const long = "Shader /home/someone/shaders/test_shadertoy_invalid.glsl: error: Linking fragment stage: No function definition (body) found: " ** 3; + const long = std.mem.asBytes(&@as([3][126]u8, @splat("Shader /home/someone/shaders/test_shadertoy_invalid.glsl: error: Linking fragment stage: No function definition (body) found: ".*))); for ([_][]const u8{ "Msg " ++ long, "" }) |line| { // The Msg builtin, and the path a failed compile takes (Post.zig). if (line.len > 0) try std.testing.expect(p.executeBuiltinLine(p.active, line)) else p.setMessage(p.active, long); @@ -1952,7 +1952,7 @@ test "the focused cursor glides a jump, lands a step at once, and is exact at re if (!builtins.capabilities.lift) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 30 }); defer p.deinit(); - _ = try p.setTestFile("some text on a line\n" ** 20); + _ = try p.setTestFile(std.mem.asBytes(&@as([20][20]u8, @splat("some text on a line\n".*)))); p.settings.cursor_blink = false; var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); @@ -2078,7 +2078,7 @@ test "a terminal's cursor lands with scrolling output, never gliding against it" defer arena.deinit(); const ms = std.time.ns_per_ms; var now: u64 = std.time.ns_per_s; - p.update(.{ .output = .{ .pane = @intCast(term), .bytes = "line\r\n" ** 20 ++ "$ some command typed" } }); + p.update(.{ .output = .{ .pane = @intCast(term), .bytes = std.mem.asBytes(&@as([20][6]u8, @splat("line\r\n".*))) ++ "$ some command typed" } }); p.advance(now); _ = try p.render(arena.allocator()); // Enter: three lines of output scroll up, the cursor to a new prompt. @@ -2101,10 +2101,10 @@ test "a monkey over notices, prompts, tags and tiny panes at a gui's metrics nev const random = prng.random(); const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 24 }); defer p.deinit(); - _ = try p.setTestFile("fuzz\n\u{754c}\u{754c} wide\n" ** 20); + _ = try p.setTestFile(std.mem.asBytes(&@as([20][17]u8, @splat("fuzz\n\u{754c}\u{754c} wide\n".*)))); var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); - const words = [_][]const u8{ "error:", "\u{754c}", "x", "Shader /tmp/a.glsl:", "e\u{301}", "\t", "long-" ** 20, " " }; + const words = [_][]const u8{ "error:", "\u{754c}", "x", "Shader /tmp/a.glsl:", "e\u{301}", "\t", std.mem.asBytes(&@as([20][5]u8, @splat("long-".*))), " " }; const commands = [_][]const u8{ "New", "Newcol", "Collapse", "Tagbottom", "TreeContext", "Wrap", "Find", "Del", "FocusTint", "Debug" }; var text: std.ArrayListUnmanaged(u8) = .empty; defer text.deinit(std.testing.allocator); @@ -2143,7 +2143,7 @@ test "a monkey over notices, prompts, tags and tiny panes at a gui's metrics nev // A tag of several rows. 5 => if (p.panes[p.active]) |pane| { text.clearRetainingCapacity(); - for (0..random.uintAtMost(usize, 5)) |_| try text.appendSlice(std.testing.allocator, if (random.boolean()) " Look\nmore \u{754c}" else "\n" ++ "x" ** 150); + for (0..random.uintAtMost(usize, 5)) |_| try text.appendSlice(std.testing.allocator, if (random.boolean()) " Look\nmore \u{754c}" else "\n" ++ &@as([150]u8, @splat('x'))); if (pane.tag.own) |own| std.testing.allocator.free(own); pane.tag.own = try std.testing.allocator.dupe(u8, text.items); }, @@ -2173,7 +2173,7 @@ test "a wide glyph cut by a tag's or a notice's edge is joined into the grid as defer arena.deinit(); const pane = p.panes[p.active].?; // Both alignments, so one of them puts a wide glyph across each edge. - for ([_][]const u8{ "\u{754c}" ** 30, "x" ++ "\u{754c}" ** 30 }) |wide| { + for ([_][]const u8{ std.mem.asBytes(&@as([30][3]u8, @splat("\u{754c}".*))), "x" ++ std.mem.asBytes(&@as([30][3]u8, @splat("\u{754c}".*))) }) |wide| { if (pane.tag.own) |own| std.testing.allocator.free(own); pane.tag.own = try std.testing.allocator.dupe(u8, wide); var message: [200]u8 = undefined; @@ -2201,7 +2201,7 @@ test "a body with context rows is painted once, and the grid's rows are what a p if (comptime !@import("syntax.zig").enabled) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 60, .rows = 16 }); defer p.deinit(); - const pane = try p.setTestFile("pub const Box = struct {\n pub fn run() void {\n" ++ (" // body line\n" ** 30) ++ " }\n};\n"); + const pane = try p.setTestFile("pub const Box = struct {\n pub fn run() void {\n" ++ (std.mem.asBytes(&@as([30][21]u8, @splat(" // body line\n".*)))) ++ " }\n};\n"); p.gpa.free(pane.file.?.path); pane.file.?.path = try p.gpa.dupe(u8, "/test.zig"); if (!panes.File.supportsContext(pane)) return error.SkipZigTest; @@ -2250,7 +2250,7 @@ test "a body with context rows is painted once, and the grid's rows are what a p /// Two columns, the file in the left one and a shell in the right, the /// right one focused with its cursor settled. fn twoColumns(p: *Pardes, arena: *std.heap.ArenaAllocator) !void { - _ = try p.setTestFile("some text on a line\n" ** 6); + _ = try p.setTestFile(std.mem.asBytes(&@as([6][20]u8, @splat("some text on a line\n".*)))); _ = try p.newShell(1, ""); try std.testing.expect(layout.splitColumn(p, 0, 1, false)); p.sync(); @@ -2386,7 +2386,7 @@ test "a pane focus reaches brightens on the same spring the one it leaves dims o if (!builtins.capabilities.lift) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 24 }); defer p.deinit(); - _ = try p.setTestFile("some text on a line\n" ** 4); + _ = try p.setTestFile(std.mem.asBytes(&@as([4][20]u8, @splat("some text on a line\n".*)))); p.newScratchBelow(0); p.settings.inactive_dim = 40; p.settings.motion = .smooth; diff --git a/src/dump.zig b/src/dump.zig index 402918c4..545d09ec 100644 --- a/src/dump.zig +++ b/src/dump.zig @@ -421,9 +421,9 @@ pub const Parsed = struct { pub fn check(gpa: std.mem.Allocator, bytes: []const u8, why: []u8) !void { var arena: std.heap.ArenaAllocator = .init(gpa); defer arena.deinit(); - const source = try arena.allocator().dupeZ(u8, bytes); - var diag: std.zon.parse.Diagnostics = .{}; - const state = std.zon.parse.fromSliceAlloc(State, arena.allocator(), source, &diag, .{ .free_on_error = false }) catch |err| { + const source = try arena.allocator().dupeSentinel(u8, bytes, 0); + var diag: std.zon.parse.Diagnostics = undefined; + const state = std.zon.parse.fromSlice(State, .{ .gpa = gpa, .arena = arena.allocator(), .source = source, .diagnostics = &diag }) catch |err| { const said = pardes.Messages.zonWhy(&diag, why[0 .. why.len - 1]); if (said.ptr != why.ptr) @memcpy(why[0..said.len], said); why[said.len] = 0; @@ -436,21 +436,13 @@ pub fn readZon(gpa: std.mem.Allocator, bytes: []const u8, label: []const u8) !Pa var parsed: Parsed = .{ .value = undefined, .arena = .init(gpa) }; errdefer parsed.deinit(); const arena = parsed.arena.allocator(); - const source = try gpa.dupeZ(u8, bytes); + const source = try gpa.dupeSentinel(u8, bytes, 0); defer gpa.free(source); - parsed.value = if (builtin.os.tag == .emscripten or builtin.os.tag == .freestanding) - std.zon.parse.fromSliceAlloc(State, arena, source, null, .{ .free_on_error = false }) catch |err| { - if (err == error.ParseZon) log.err("parse dump {s}: {s}", .{ label, @errorName(err) }); - return err; - } - else blk: { - var diag: std.zon.parse.Diagnostics = .{}; - defer diag.deinit(arena); - break :blk std.zon.parse.fromSliceAlloc(State, arena, source, &diag, .{ .free_on_error = false }) catch |err| { - if (err == error.ParseZon) log.err("parse dump {s}: {f}", .{ label, diag }); - return err; - }; + var diag: std.zon.parse.Diagnostics = undefined; + parsed.value = std.zon.parse.fromSlice(State, .{ .gpa = gpa, .arena = arena, .source = source, .diagnostics = &diag }) catch |err| { + if (err == error.ParseZon) log.err("{f}", .{diag.fmt(label)}); + return err; }; try validate(parsed.value); return parsed; diff --git a/src/esp32p4.zig b/src/esp32p4.zig index 6772e75d..ed18efd9 100644 --- a/src/esp32p4.zig +++ b/src/esp32p4.zig @@ -506,7 +506,7 @@ fn apply(c: *pardes.Pardes, ev: vaxis.Event) void { c.update(.pointer_leave); dirty = true; }, - .focus_in, .mouse_leave => {}, + .focus_in, .mouse_leave, .cursor_position => {}, // Capability replies. vaxis's own Loop sets these fields directly (`Loop.zig:377-403`); // with no Loop, this is where they land. DA1 is the terminator: every terminal answers it // last, so it is the signal that the whole handshake is in and the detected features can be diff --git a/src/esp32p4/input_rescue.zig b/src/esp32p4/input_rescue.zig index ba6974d2..d7556d46 100644 --- a/src/esp32p4/input_rescue.zig +++ b/src/esp32p4/input_rescue.zig @@ -245,7 +245,7 @@ test "a long transmit does not lose the input that arrives during it" { defer port.sent.deinit(std.testing.allocator); var ring: Ring = .{}; - const frame = "\x1b[1;1H" ++ "x" ** 400; + const frame = "\x1b[1;1H" ++ &@as([400]u8, @splat('x')); try std.testing.expectEqual(@as(u32, 0), pump(&port, &ring, frame, 1_000_000)); // Every output byte went out, in order. diff --git a/src/esp32p4/selftest.zig b/src/esp32p4/selftest.zig index 97b43059..19b71e90 100644 --- a/src/esp32p4/selftest.zig +++ b/src/esp32p4/selftest.zig @@ -270,7 +270,7 @@ export fn zig_main() noreturn { const typed = "the quick brown fox jumps over the lazy dog, and then some more besides"; var port: FakePort = .{ .tx_cap = 2, .incoming = typed }; var ring: input_rescue.Ring = .{}; - const frame = "\x1b[1;1H" ++ "x" ** 300; + const frame = "\x1b[1;1H" ++ &@as([300]u8, @splat('x')); const abandoned = input_rescue.pump(&port, &ring, frame, 1_000_000); check("the frame went out whole", abandoned == 0 and port.sent == frame.len); diff --git a/src/fs.zig b/src/fs.zig index fb76cee3..061d4225 100644 --- a/src/fs.zig +++ b/src/fs.zig @@ -677,7 +677,7 @@ pub fn statPath(io: std.Io, path: []const u8, options: std.Io.Dir.StatFileOption } test "a path with a part over 255 bytes is NameTooLong, never a panic" { - const long = "/tmp/" ++ "x" ** 300 ++ "/f"; + const long = "/tmp/" ++ &@as([300]u8, @splat('x')) ++ "/f"; try std.testing.expectError(error.NameTooLong, statPath(std.testing.io, long, .{})); } @@ -1152,7 +1152,7 @@ pub fn find(arena: std.mem.Allocator, dir: []const u8, pat: []const u8, out: []u notes.skipped += 1; continue; }) orelse break; - if (std.ascii.indexOfIgnoreCase(e.basename, pat) != null) { + if (std.ascii.findIgnoreCase(e.basename, pat) != null) { hits[hits_len] = try arena.dupe(u8, e.path); hits_len += 1; } @@ -1167,7 +1167,7 @@ pub fn find(arena: std.mem.Allocator, dir: []const u8, pat: []const u8, out: []u } else { for (sources) |s| { if (hits_len >= hits.len) break; - if (std.ascii.indexOfIgnoreCase(std.fs.path.basename(s.path), pat) != null) { + if (std.ascii.findIgnoreCase(std.fs.path.basename(s.path), pat) != null) { hits[hits_len] = s.path; hits_len += 1; } @@ -1201,7 +1201,7 @@ fn grepText(path: []const u8, text: []const u8, pat: []const u8, out: []u8, budg while (it.next()) |raw| { line += 1; if (result.hits >= budget) break; - const at = std.ascii.indexOfIgnoreCase(raw, pat) orelse continue; + const at = std.ascii.findIgnoreCase(raw, pat) orelse continue; const ln = std.mem.trimEnd(u8, raw, " \t\r"); var cut = @min(ln.len, 200); while (cut > 0 and cut < ln.len and ln[cut] & 0xc0 == 0x80) cut -= 1; diff --git a/src/gui/Post.zig b/src/gui/Post.zig index fc256135..8d0e14d9 100644 --- a/src/gui/Post.zig +++ b/src/gui/Post.zig @@ -610,13 +610,13 @@ const GhosttyUniforms = extern struct { }; test "the uniform block is ghostty's, offset for offset, and the prefix names it in that order" { - const ours = @typeInfo(Uniforms).@"struct".fields; - const theirs = @typeInfo(GhosttyUniforms).@"struct".fields; - try std.testing.expectEqual(theirs.len, ours.len); + const ours = @typeInfo(Uniforms).@"struct"; + const theirs = @typeInfo(GhosttyUniforms).@"struct"; + try std.testing.expectEqual(theirs.field_names.len, ours.field_names.len); try std.testing.expectEqual(@sizeOf(GhosttyUniforms), @sizeOf(Uniforms)); - inline for (ours, theirs) |a, b| { - try std.testing.expectEqual(@offsetOf(GhosttyUniforms, b.name), @offsetOf(Uniforms, a.name)); - try std.testing.expectEqual(b.type, a.type); + inline for (ours.field_names, ours.field_types, theirs.field_names, theirs.field_types) |a, a_type, b, b_type| { + try std.testing.expectEqual(@offsetOf(GhosttyUniforms, b), @offsetOf(Uniforms, a)); + try std.testing.expectEqual(b_type, a_type); } // By NAME: iSelectionForegroundColor sits where ghostty's Zig says // selection_background, which is where its GLSL puts the foreground. @@ -633,7 +633,7 @@ test "the uniform block is ghostty's, offset for offset, and the prefix names it .{ "vec3", "iBackgroundColor" }, .{ "vec3", "iForegroundColor" }, .{ "vec3", "iCursorColor" }, .{ "vec3", "iCursorText" }, .{ "vec3", "iSelectionForegroundColor" }, .{ "vec3", "iSelectionBackgroundColor" }, }; - try std.testing.expectEqual(ours.len, glsl.len); + try std.testing.expectEqual(ours.field_names.len, glsl.len); // Its three blocks (Globals, Palette, Colors) read as one, in order. const start = std.mem.indexOf(u8, prefix, "uniform Globals {").?; const end = std.mem.indexOf(u8, prefix, "uniform PardesPost {").?; diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 5a026664..b8687fd3 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -25,11 +25,7 @@ const ninep_io = @import("../9p_io.zig"); const detached_client = @import("../detached/client.zig"); const tracy = @import("../tracy.zig"); -pub const c = @cImport({ - @cDefine("SDL_DISABLE_OLD_NAMES", "1"); - @cInclude("SDL3/SDL.h"); - @cInclude("font.h"); -}); +pub const c = @import("gui_c"); // SDL3 and font.h, translated by build.zig const host_io = @import("../host_io.zig"); extern "c" fn setenv(name: [*:0]const u8, value: [*:0]const u8, overwrite: c_int) c_int; @@ -4806,7 +4802,7 @@ fn dumpThemes(ctx: ?*anyopaque, pane: u8) void { } fn putClipboard(gpa: std.mem.Allocator, text: []const u8) void { - const z = gpa.dupeZ(u8, text) catch return; + const z = gpa.dupeSentinel(u8, text, 0) catch return; defer gpa.free(z); _ = c.SDL_SetClipboardText(z.ptr); } @@ -5131,7 +5127,7 @@ test "a wheel over codex in a terminal reaches its pty as the mouse reports it a wheelAt(&g, &in, .{ .y = 1, .integer_y = 1 }, mc); try std.testing.expectEqualStrings("\x1b[<64;6;4M", try Sent.take(core, &sent)); wheelAt(&g, &in, .{ .y = -3, .integer_y = -3 }, mc); - try std.testing.expectEqualStrings("\x1b[<65;6;4M" ** 3, try Sent.take(core, &sent)); + try std.testing.expectEqualStrings(std.mem.asBytes(&@as([3][10]u8, @splat("\x1b[<65;6;4M".*))), try Sent.take(core, &sent)); try std.testing.expectEqual(@as(i32, 0), g.scroll_notch); try std.testing.expect(g.scroll_pane == null); // A touchpad's fractions add up to a turn. @@ -7157,7 +7153,7 @@ test "every pixel of a grip column is band, button or ring, and the button sits const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .cols = 60, .rows = 20 }); defer core.deinit(); - const pane = try core.setTestFile("text\n" ** 60); + const pane = try core.setTestFile(std.mem.asBytes(&@as([60][5]u8, @splat("text\n".*)))); pane.tag.own = try gpa.dupe(u8, "second\nthird"); core.newScratchBelow(0); for ([_]struct { w: u32, h: u32, tag: u32 }{ .{ .w = 10, .h = 20, .tag = 12 }, .{ .w = 17, .h = 35, .tag = 30 }, .{ .w = 9, .h = 19, .tag = 15 }, .{ .w = 12, .h = 24, .tag = 24 } }) |m| for ([_]bool{ false, true }) |bottom| for ([_]usize{ 0, 1 }) |focus| for ([_]bool{ false, true }) |dirty| { @@ -10156,7 +10152,7 @@ test "the selection glows round its block, on the body only, fading in over 100 const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .cols = 80, .rows = 24 }); defer core.deinit(); - _ = try core.setTestFile("some text on a line\n" ** 30); + _ = try core.setTestFile(std.mem.asBytes(&@as([30][20]u8, @splat("some text on a line\n".*)))); core.settings.selection_glow = true; pardes.test_api.sync(core); const s = try core.render(core.scratch.allocator()); @@ -10206,7 +10202,7 @@ test "a hovered word glows along its foot, never over the cursor, fading in over const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .cols = 80, .rows = 24 }); defer core.deinit(); - _ = try core.setTestFile("some text on a line\n" ** 30); + _ = try core.setTestFile(std.mem.asBytes(&@as([30][20]u8, @splat("some text on a line\n".*)))); core.settings.hover_glow = true; pardes.test_api.sync(core); const s = try core.render(core.scratch.allocator()); @@ -10256,7 +10252,7 @@ test "occlusion shades each body's edges, inside it, never a tag, a grip or the const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .cols = 80, .rows = 24 }); defer core.deinit(); - _ = try core.setTestFile("some text on a line\n" ** 30); + _ = try core.setTestFile(std.mem.asBytes(&@as([30][20]u8, @splat("some text on a line\n".*)))); core.settings.occlusion = true; pardes.test_api.sync(core); const s = try core.render(core.scratch.allocator()); @@ -10295,7 +10291,7 @@ test "a body tells its first line, and lapis's dots under it move a quarter as f const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .cols = 80, .rows = 24 }); defer core.deinit(); - const pane = try core.setTestFile("line\n" ** 80); + const pane = try core.setTestFile(std.mem.asBytes(&@as([80][5]u8, @splat("line\n".*)))); pane.scrollBy(8); try std.testing.expect(core.executeBuiltinLine(0, "Theme lapis")); core.settings.parallax = true; diff --git a/src/host_io.zig b/src/host_io.zig index a90c903d..d789a77d 100644 --- a/src/host_io.zig +++ b/src/host_io.zig @@ -172,7 +172,7 @@ pub const Lsp = struct { const declared_path = if (file) |f| f.path else ""; const path = try gpa.dupe(u8, filesystem.localPath(declared_path) orelse declared_path); errdefer gpa.free(path); - const source = try gpa.dupeZ(u8, if (file) |f| f.content else ""); + const source = try gpa.dupeSentinel(u8, if (file) |f| f.content else "", 0); errdefer gpa.free(source); const arg = try gpa.dupe(u8, req.arg); errdefer gpa.free(arg); @@ -210,7 +210,7 @@ pub const Lsp = struct { if (f.output != null) continue; const local = filesystem.localPath(f.path) orelse continue; const other_path = try gpa.dupe(u8, local); - const other_source = gpa.dupeZ(u8, f.content) catch |err| { + const other_source = gpa.dupeSentinel(u8, f.content, 0) catch |err| { gpa.free(other_path); return err; }; @@ -785,7 +785,7 @@ pub const Shell = struct { var dir_buf: [4096]u8 = undefined; const dir = dir_buf[0..try tmp.dir.realPath(std.testing.io, &dir_buf)]; var path: [4200:0]u8 = undefined; - const p = try std.fmt.bufPrintZ(&path, "{s}/mysh", .{dir}); + const p = try std.fmt.bufPrintSentinel(&path, "{s}/mysh", .{dir}, 0); try std.testing.expectEqual(Family.bash, familyOf(p.ptr)); try std.testing.expectEqual(Family.none, familyOf("/bin/sh")); } @@ -1662,7 +1662,7 @@ pub fn forkShell( test "shell spawn rejects invalid directories before creating a child" { const rcs: Shell.PromptFiles = .{}; try std.testing.expectError(error.InvalidPath, forkShell(null, 0, &rcs, "/bin/sh", "/tmp\x00/ignored", 24, 80, null)); - const too_long = [_]u8{'x'} ** 4096; + const too_long = @as([4096]u8, @splat('x')); try std.testing.expectError(error.NameTooLong, forkShell(null, 0, &rcs, "/bin/sh", &too_long, 24, 80, null)); var tmp = std.testing.tmpDir(.{}); @@ -1675,7 +1675,7 @@ test "shell spawn rejects invalid directories before creating a child" { try std.testing.expectError(error.NotDir, forkShell(null, 0, &rcs, "/bin/sh", file, 24, 80, null)); const explicit_file = try std.fmt.bufPrint(&path_buf, "/n/os{s}/file", .{directory}); try std.testing.expectError(error.NotDir, forkShell(null, 0, &rcs, "/bin/sh", explicit_file, 24, 80, null)); - const missing = try std.fmt.bufPrint(&path_buf, "{s}/missing/" ++ ("child/" ** 50), .{directory}); + const missing = try std.fmt.bufPrint(&path_buf, "{s}/missing/" ++ (std.mem.asBytes(&@as([50][6]u8, @splat("child/".*)))), .{directory}); try std.testing.expect(missing.len > 256); try std.testing.expectError(error.FileNotFound, forkShell(null, 0, &rcs, "/bin/sh", missing, 24, 80, null)); } @@ -1720,7 +1720,7 @@ test "shell spawn uses an explicit OS directory longer than 256 bytes" { if (!haveFile("/bin/sh")) return error.SkipZigTest; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - const sub_path = "nested-directory-with-more-than-forty-characters/" ** 7; + const sub_path = std.mem.asBytes(&@as([7][49]u8, @splat("nested-directory-with-more-than-forty-characters/".*))); try tmp.dir.createDirPath(std.testing.io, sub_path); var directory_buf: [4096]u8 = undefined; const directory = directory_buf[0..try tmp.dir.realPathFile(std.testing.io, sub_path, &directory_buf)]; @@ -1801,7 +1801,7 @@ test "shell cwd rejects truncation and preserves an owned child path longer than const io = std.testing.io; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - const nested = "nested-directory-with-more-than-forty-characters/" ** 24; + const nested = std.mem.asBytes(&@as([24][49]u8, @splat("nested-directory-with-more-than-forty-characters/".*))); try tmp.dir.createDirPath(io, nested); var path_buf: [pardes.memory.limits.host_path_cap + 1]u8 = undefined; const directory = path_buf[0..try tmp.dir.realPathFile(io, nested, &path_buf)]; diff --git a/src/image.zig b/src/image.zig index 72520ad6..8bf9de08 100644 --- a/src/image.zig +++ b/src/image.zig @@ -242,11 +242,11 @@ pub const GlyphArt = struct { const glyphs_ascii = glyphs ++ ascii_glyphs; fn matchCell(cell: *const [64][3]u8, pal: Palette, gset: []const Glyph) Cell { - var counts = [_]u16{0} ** 16; + var counts = @as([16]u16, @splat(0)); for (cell) |px| counts[nearest(px, pal)] += 1; var cand: [4]u4 = undefined; var ncand: usize = 0; - var used = [_]bool{false} ** 16; + var used = @as([16]bool, @splat(false)); while (ncand < 4) : (ncand += 1) { var best: ?usize = null; for (counts, 0..) |c, i| { @@ -432,7 +432,7 @@ pub const GlyphArt = struct { test "render: tiny image produces a grid within bounds" { const a = std.testing.allocator; // 2x2 checker, RGBA - var img = [_]u8{0} ** (2 * 2 * 4); + var img = @as([2 * 2 * 4]u8, @splat(0)); img[0] = 255; img[1] = 255; img[2] = 255; diff --git a/src/linux/v9fs.zig b/src/linux/v9fs.zig index 5e031bfe..15945e7b 100644 --- a/src/linux/v9fs.zig +++ b/src/linux/v9fs.zig @@ -64,11 +64,11 @@ pub fn helperPath(buf: []u8) ![:0]u8 { const path = if (std.c.getenv("PARDES_V9FS_HELPER")) |env| blk: { const override = std.mem.span(env); if (!std.fs.path.isAbsolute(override)) return error.AbsoluteHelperPathRequired; - break :blk try std.fmt.bufPrintZ(buf, "{s}", .{override}); + break :blk try std.fmt.bufPrintSentinel(buf, "{s}", .{override}, 0); } else blk: { var own: [4096]u8 = undefined; const parent = std.fs.path.dirname(try selfPath(&own)) orelse return error.ExecutablePathUnavailable; - break :blk try std.fmt.bufPrintZ(buf, "{s}/{s}", .{ parent, executable }); + break :blk try std.fmt.bufPrintSentinel(buf, "{s}/{s}", .{ parent, executable }, 0); }; if (std.c.access(path.ptr, 1) != 0) return error.V9fsHelperNotFound; return path; diff --git a/src/locations.zig b/src/locations.zig index 745393e5..2828566d 100644 --- a/src/locations.zig +++ b/src/locations.zig @@ -587,12 +587,13 @@ pub const Config = struct { const key = token[0..colon]; const value = token[colon + 1 ..]; var found = false; - inline for (@typeInfo(Config).@"struct".fields) |field| { - if (std.mem.eql(u8, key, field.name)) { - @field(result, field.name) = switch (@typeInfo(field.type)) { + const info = @typeInfo(Config).@"struct"; + inline for (info.field_names, info.field_types) |name, T| { + if (std.mem.eql(u8, key, name)) { + @field(result, name) = switch (@typeInfo(T)) { .bool => if (std.mem.eql(u8, value, "on")) true else if (std.mem.eql(u8, value, "off")) false else return error.ExpectedOnOrOff, - .int => std.fmt.parseInt(field.type, value, 10) catch return error.InvalidContext, - .@"enum" => std.meta.stringToEnum(field.type, value) orelse return error.InvalidLayout, + .int => std.fmt.parseInt(T, value, 10) catch return error.InvalidContext, + .@"enum" => std.meta.stringToEnum(T, value) orelse return error.InvalidLayout, else => @compileError("unsupported location setting type"), }; found = true; @@ -604,11 +605,12 @@ pub const Config = struct { } pub fn write(config: Config, writer: *std.Io.Writer) !void { - inline for (@typeInfo(Config).@"struct".fields, 0..) |field, index| { + const info = @typeInfo(Config).@"struct"; + inline for (info.field_names, info.field_types, 0..) |name, T, index| { if (index > 0) try writer.writeByte(' '); - try writer.writeAll(field.name ++ ":"); - const value = @field(config, field.name); - switch (@typeInfo(field.type)) { + try writer.writeAll(name ++ ":"); + const value = @field(config, name); + switch (@typeInfo(T)) { .bool => try writer.writeAll(if (value) "on" else "off"), .int => try writer.print("{d}", .{value}), .@"enum" => try writer.writeAll(@tagName(value)), @@ -809,11 +811,11 @@ test "locations cache bounds memory and entries and evicts least recently used" try std.testing.expectEqual(@as(usize, 2), cache.len); try std.testing.expect(cache.bytes <= 40); try std.testing.expectEqualStrings("b.unknown", cache.entries[0].path); - try std.testing.expectError(error.SourceTooLarge, cache.getBounded(gpa, "large.unknown", "x" ** 41, false, false, 40)); + try std.testing.expectError(error.SourceTooLarge, cache.getBounded(gpa, "large.unknown", &@as([41]u8, @splat('x')), false, false, 40)); try std.testing.expectEqual(@as(usize, 2), cache.len); if (syntax.supportsPath("large.zig")) { const before = cache.analyses; - try std.testing.expectError(error.SourceTooLarge, cache.getBounded(gpa, "large.zig", "x" ** 25, true, true, 40)); + try std.testing.expectError(error.SourceTooLarge, cache.getBounded(gpa, "large.zig", &@as([25]u8, @splat('x')), true, true, 40)); try std.testing.expectEqual(before, cache.analyses); } cache.deinit(gpa); diff --git a/src/look.zig b/src/look.zig index 1065cb02..f9c470cf 100644 --- a/src/look.zig +++ b/src/look.zig @@ -671,7 +671,7 @@ pub fn runSearch(p: *Pardes, id: usize, pat_raw: []const u8, kind: Search, start const cl: usize = @intCast(@max(0, pane.body.cur_row)); const cc: usize = @intCast(@max(0, pane.body.cur_col)); for (lines, 0..) |ln, i| { - const at = std.ascii.indexOfIgnoreCase(ln, pat) orelse continue; + const at = std.ascii.findIgnoreCase(ln, pat) orelse continue; const row = try std.fmt.allocPrint(arena, "{s}:{d}:{d}{c}{d} {s}\n", .{ loc, i + 1, at + 1, config.range_sep, at + pat.len, std.mem.trimEnd(u8, ln, " \t"), }); @@ -1273,7 +1273,7 @@ fn missText(text: []const u8, buf: *[miss_path_cap + "…".len]u8) []const u8 { test "a miss names a long path by its start and its end, its middle given up to …" { var cut: [miss_path_cap + "…".len]u8 = undefined; - const long = "/home/someone/" ++ "deep/" ** 80 ++ "the-file.zig"; + const long = "/home/someone/" ++ std.mem.asBytes(&@as([80][5]u8, @splat("deep/".*))) ++ "the-file.zig"; const said = missText(long, &cut); try std.testing.expect(said.len <= miss_path_cap); try std.testing.expect(std.mem.startsWith(u8, said, "/home/someone/")); @@ -2185,7 +2185,7 @@ test "Look ignores missing and out of bounds pane addresses" { test "a pointer resting where a look-hover found nothing does not wake the core every frame" { const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 24 }); defer p.deinit(); - _ = try p.setTestFile(" \n" ** 30); + _ = try p.setTestFile(std.mem.asBytes(&@as([30][6]u8, @splat(" \n".*)))); p.sync(); const r = p.rects[p.active]; // Resting on blanks in the body: a wait, then nothing to open. diff --git a/src/lsp/lsp.zig b/src/lsp/lsp.zig index 96d42bbd..4a70efe5 100644 --- a/src/lsp/lsp.zig +++ b/src/lsp/lsp.zig @@ -92,7 +92,7 @@ else pub const backend_name = "lsp-client"; pub const supports: std.EnumSet(Kind) = blk: { - var s: std.EnumSet(Kind) = .initEmpty(); + var s: std.EnumSet(Kind) = .empty; for (0..backends.len) |i| s.setUnion(backends[i].supports); break :blk s; }; diff --git a/src/lsp/lsp_client.zig b/src/lsp/lsp_client.zig index 54bbaa79..b396879b 100644 --- a/src/lsp/lsp_client.zig +++ b/src/lsp/lsp_client.zig @@ -159,7 +159,7 @@ pub const specs = [_]Spec{ /// answered per connection; a kind its server never advertised simply returns /// no rows, which the harness reports as CLAIMED-EMPTY per language — honest, /// since the claim here is about the protocol, not about every server. -pub const supports: std.EnumSet(lsp.Kind) = .initFull(); +pub const supports: std.EnumSet(lsp.Kind) = .full; /// Routing: an extension in the table whose spec is not disabled by its env /// var. Deliberately does NOT probe for the binary — this runs on the Tab diff --git a/src/macos.zig b/src/macos.zig index 20463481..37db0abd 100644 --- a/src/macos.zig +++ b/src/macos.zig @@ -724,7 +724,7 @@ fn initCore(runtime: ?*const Runtime, cols_arg: u16, rows_arg: u16) !void { // in Debug, libc's malloc otherwise. libc's measured at least as fast as // std.heap.smp_allocator everywhere and faster on MuPDF's page-sized // rasters, so this shell no longer differs. - const gpa = if (builtin.mode == .Debug) debug_gpa.allocator() else std.heap.c_allocator; + const gpa = if (builtin.mode == .debug) debug_gpa.allocator() else std.heap.c_allocator; const allocs = pardes.memory.init(gpa); errdefer pardes.memory.deinit(); @@ -858,7 +858,7 @@ export fn pardes_deinit() void { st.gpa.destroy(st.threaded); pardes.memory.deinit(); // Leaks are logged and do not fail, as std.start treats the others'. - if (builtin.mode == .Debug) { + if (builtin.mode == .debug) { _ = debug_gpa.deinit(); debug_gpa = .init; } @@ -2871,22 +2871,22 @@ test "pardes.h matches the Zig boundary" { try expectEqual(@offsetOf(c.pardes_cell_s, "len"), @offsetOf(Cell, "len")); try expectEqual(@offsetOf(c.pardes_cell_s, "flags"), @offsetOf(Cell, "flags")); try expectEqual(@sizeOf(c.pardes_scene_s), @sizeOf(Scene)); - inline for (@typeInfo(Scene).@"struct".fields) |field| - try expectEqual(@offsetOf(c.pardes_scene_s, field.name), @offsetOf(Scene, field.name)); + inline for (@typeInfo(Scene).@"struct".field_names) |name| + try expectEqual(@offsetOf(c.pardes_scene_s, name), @offsetOf(Scene, name)); try expectEqual(@sizeOf(c.pardes_panel_box_s), @sizeOf(PanelBox)); - inline for (@typeInfo(PanelBox).@"struct".fields) |field| - try expectEqual(@offsetOf(c.pardes_panel_box_s, field.name), @offsetOf(PanelBox, field.name)); + inline for (@typeInfo(PanelBox).@"struct".field_names) |name| + try expectEqual(@offsetOf(c.pardes_panel_box_s, name), @offsetOf(PanelBox, name)); try expectEqual(@sizeOf(c.pardes_panel_track_s), @sizeOf(PanelTrack)); - inline for (@typeInfo(PanelTrack).@"struct".fields) |field| { - const c_name = comptime if (std.mem.eql(u8, field.name, "motion")) + inline for (@typeInfo(PanelTrack).@"struct".field_names) |name| { + const c_name = comptime if (std.mem.eql(u8, name, "motion")) "reserved0" else - field.name; - try expectEqual(@offsetOf(c.pardes_panel_track_s, c_name), @offsetOf(PanelTrack, field.name)); + name; + try expectEqual(@offsetOf(c.pardes_panel_track_s, c_name), @offsetOf(PanelTrack, name)); } try expectEqual(@sizeOf(c.pardes_image_s), @sizeOf(Image)); - inline for (@typeInfo(Image).@"struct".fields) |field| - try expectEqual(@offsetOf(c.pardes_image_s, field.name), @offsetOf(Image, field.name)); + inline for (@typeInfo(Image).@"struct".field_names) |name| + try expectEqual(@offsetOf(c.pardes_image_s, name), @offsetOf(Image, name)); try expectEqual(@sizeOf(c.pardes_runtime_s), @sizeOf(Runtime)); try expectEqual(@as(u32, c.PARDES_COLOR_DEFAULT), color_default); @@ -3177,7 +3177,7 @@ test "mac tag layer ABI preserves logical capacity and physical grip" { }); try std.testing.expectEqual(@as(u32, 11), pardes_tag_layer_value(0, 8)); try std.testing.expectEqual(@as(u8, 'Z'), pardes_tag_layer_cells(0).?[11].text[0]); - var canonical: [24]Cell = @splat(encodeCell(.{ .text = .{'G'} ++ .{0} ** 6, .len = 1, .default = false })); + var canonical: [24]Cell = @splat(encodeCell(.{ .text = .{ 'G', 0, 0, 0, 0, 0, 0 }, .len = 1, .default = false })); var source: [24]pardes.Cell = @splat(.{}); blankTagCells(&canonical, 8, 3, &source, &core.surface.tag_layers); try std.testing.expectEqual(@as(u8, 'G'), canonical[9].text[0]); diff --git a/src/main.zig b/src/main.zig index 26259b43..e3bae75f 100644 --- a/src/main.zig +++ b/src/main.zig @@ -464,6 +464,12 @@ fn nativeMain(init: std.process.Init) !void { } opts.tty_only = explicit_tty or session_only; opts.mounts = mounts[0..mounts_len]; + // `zig build run-isolated` with nothing named: something to look at on + // arrival, read out of the binary itself. + if (pardes.isolated and positional == null) { + session_only = false; + positional = "src/pardes.zig"; + } if (detach != null and attach != null) badArgs(init.io, "--detach and --attach are opposites: one runs the session, the other joins one", .{}); // --wait waits on the pane a FILE opens: with none there is nothing to diff --git a/src/memory.zig b/src/memory.zig index abfd40f6..48403c55 100644 --- a/src/memory.zig +++ b/src/memory.zig @@ -38,7 +38,7 @@ pub const limits = struct { }; const Allocator = std.mem.Allocator; -const debug_enabled = builtin.mode == .Debug; +const debug_enabled = builtin.mode == .debug; pub const Allocators = struct { pardes: Allocator, diff --git a/src/modal.zig b/src/modal.zig index 50e0ddf4..82f1a3a0 100644 --- a/src/modal.zig +++ b/src/modal.zig @@ -163,7 +163,7 @@ pub const Normal = struct { }; pub const Input = struct { - roles: std.EnumSet(Role) = .initEmpty(), + roles: std.EnumSet(Role) = .empty, cp: u21, ctrl: bool = false, alt: bool = false, diff --git a/src/ninep/addr.zig b/src/ninep/addr.zig index b78c46e7..3feda5a2 100644 --- a/src/ninep/addr.zig +++ b/src/ninep/addr.zig @@ -646,7 +646,7 @@ test "the address language, form by form" { try testing.expectEqualStrings(c[1], th.wr(p, addr, c[0]).reply.ename); } - const nested = "," ** 4096; + const nested = &@as([4096]u8, @splat(',')); _ = th.wr(p, addr, "#0"); try testing.expectEqual(E.INVAL, th.wr(p, addr, nested).errno()); } diff --git a/src/ninep/cols.zig b/src/ninep/cols.zig index e3b456ba..59f6ae42 100644 --- a/src/ninep/cols.zig +++ b/src/ninep/cols.zig @@ -288,18 +288,18 @@ test "exactly 4096 bytes written with echo's newline after a truncation fit ever const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); const serial = th.serialOf(p); - const text = "w" ** 4096 ++ "\n"; + const text = &@as([4096]u8, @splat('w')) ++ "\n"; for ([_]u64{ tree.Node.of(serial, .tag), tree.Node.ofCol(layout.columnSerial(p, 0), .tag), @intFromEnum(tree.TopFile.tag) }) |node| { _ = th.call(p, .{ .tag = 1, .op = .setattr, .node = node, .truncate = true }); const h = th.call(p, .{ .tag = 2, .op = .open, .node = node, .omode = 1 }).reply.handle; const r = th.call(p, .{ .tag = 3, .op = .write, .node = node, .handle = h, .data = text }); try testing.expectEqual(tree.Status.ok, r.reply.status); _ = th.call(p, .{ .tag = 4, .op = .release, .node = node, .handle = h, .opened = true }); - try testing.expect(std.mem.endsWith(u8, th.rd(p, node, 0, 1 << 16).bytes, "w" ** 4096)); + try testing.expect(std.mem.endsWith(u8, th.rd(p, node, 0, 1 << 16).bytes, &@as([4096]u8, @splat('w')))); // One more byte is over. _ = th.call(p, .{ .tag = 5, .op = .setattr, .node = node, .truncate = true }); const h2 = th.call(p, .{ .tag = 6, .op = .open, .node = node, .omode = 1 }).reply.handle; - try testing.expectEqual(E.NOSPC, th.call(p, .{ .tag = 7, .op = .write, .node = node, .handle = h2, .data = "w" ** 4097 ++ "\n" }).errno()); + try testing.expectEqual(E.NOSPC, th.call(p, .{ .tag = 7, .op = .write, .node = node, .handle = h2, .data = &@as([4097]u8, @splat('w')) ++ "\n" }).errno()); _ = th.call(p, .{ .tag = 8, .op = .release, .node = node, .handle = h2, .opened = true }); } } @@ -316,7 +316,7 @@ test "a Newcol refused because the tags would not fit logs its err alone and spe for (p.col_panes[col][0..p.col_n[col]]) |k| { const each = p.panes[k].?; if (each.tag.own) |old| p.gpa.free(old); - each.tag.own = try p.gpa.dupe(u8, "word " ** 60); + each.tag.own = try p.gpa.dupe(u8, std.mem.asBytes(&@as([60][5]u8, @splat("word ".*)))); } try testing.expect(p.col_n[col] >= 2); p.sync(); @@ -588,7 +588,7 @@ test "a refused write after a truncation leaves every kind of tag as it was, and defer p.deinit(); const serial = th.serialOf(p); const col = layout.columnSerial(p, 0); - const big = "w" ** (limits.max_tag_tail + 1); + const big = &@as([limits.max_tag_tail + 1]u8, @splat('w')); // Each tag: a truncating open, then a write too long: nothing changes. for ([_]u64{ Node.of(serial, .tag), Node.ofCol(col, .tag), @intFromEnum(tree.TopFile.tag) }) |node| { _ = th.wr(p, node, " Mine"); diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index f6457b83..6b4bbafb 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -1682,9 +1682,9 @@ test "a look's miss repeats the path whole up to 256 bytes, then gives up its mi var line: [512]u8 = undefined; _ = wr(p, root, try std.fmt.bufPrint(&line, "{s}\n", .{long})); try testing.expect(th.logHas(p, try std.fmt.bufPrint(&line, "look: no match for \"{s}\"\n", .{long}))); - const huge = "é" ** 150; // 300 bytes: its middle cut to fit 256, between characters + const huge = std.mem.asBytes(&@as([150][2]u8, @splat("é".*))); // 300 bytes: its middle cut to fit 256, between characters _ = wr(p, root, huge ++ "\n"); - try testing.expect(th.logHas(p, "look: no match for \"" ++ "é" ** 63 ++ "…" ++ "é" ** 63 ++ "\"\n")); + try testing.expect(th.logHas(p, "look: no match for \"" ++ std.mem.asBytes(&@as([63][2]u8, @splat("é".*))) ++ "…" ++ std.mem.asBytes(&@as([63][2]u8, @splat("é".*))) ++ "\"\n")); } test "exec runs a builtin at the pane and records the pane it acted on" { @@ -2041,7 +2041,7 @@ test "Zerox twins dump their text once and come back on one buffer from a Restor defer p.deinit(); const first = serialOf(p); _ = wr(p, Node.of(first, .name), "/tmp/pardes-zerox-dump.txt\n"); - _ = wr(p, Node.of(first, .body), "unsaved " ** 64 ++ "\n"); + _ = wr(p, Node.of(first, .body), std.mem.asBytes(&@as([64][8]u8, @splat("unsaved ".*))) ++ "\n"); try testing.expect(p.executeBuiltinLine(0, "Zerox")); try testing.expect(p.executeBuiltinLine(0, "Zerox")); try pardes.dump.dumpState(p); @@ -2888,7 +2888,7 @@ test "a builtin that fails a ctl write logs only its err, so the same failure ag test "an exec line over the command limit fails the write and says the limit; a builtin's may be longer" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); - const long = "echo " ++ "y" ** pardes.exec.command_max ++ "\n"; + const long = "echo " ++ &@as([pardes.exec.command_max]u8, @splat('y')) ++ "\n"; const refused = wr(p, root_exec, long); try testing.expectEqual(E.INVAL, refused.errno()); try testing.expectEqualStrings(e_too_long, refused.reply.ename); @@ -2896,7 +2896,7 @@ test "an exec line over the command limit fails the write and says the limit; a try testing.expect(th.logHas(p, try std.fmt.bufPrint(&rec, "err {d} exec: invalid command line: a command line is at most 1024 bytes", .{serialOf(p)}))); try testing.expectEqualStrings(e_control, wr(p, root_exec, "echo a\x01b\n").reply.ename); try testing.expect(th.logHas(p, try std.fmt.bufPrint(&rec, "err {d} exec: invalid command line: it holds", .{serialOf(p)}))); - try testing.expectEqual(Status.ok, wr(p, root_exec, "Msg " ++ "z" ** 1100 ++ "\n").reply.status); + try testing.expectEqual(Status.ok, wr(p, root_exec, "Msg " ++ &@as([1100]u8, @splat('z')) ++ "\n").reply.status); } test "Edit's p and = never fail for want of room for +Errors: the text is logged instead" { @@ -4012,8 +4012,8 @@ test "Back and Forward written to exec keep to the focused file, and JumpScope a defer p.deinit(); var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); - try tmp.dir.writeFile(testing.io, .{ .sub_path = "a.txt", .data = "row\n" ** 100 }); - try tmp.dir.writeFile(testing.io, .{ .sub_path = "b.txt", .data = "row\n" ** 100 }); + try tmp.dir.writeFile(testing.io, .{ .sub_path = "a.txt", .data = std.mem.asBytes(&@as([100][4]u8, @splat("row\n".*))) }); + try tmp.dir.writeFile(testing.io, .{ .sub_path = "b.txt", .data = std.mem.asBytes(&@as([100][4]u8, @splat("row\n".*))) }); var dir_buf: [4096]u8 = undefined; const dir = dir_buf[0..try tmp.dir.realPath(testing.io, &dir_buf)]; var line: [4200]u8 = undefined; diff --git a/src/ninep/events.zig b/src/ninep/events.zig index 3910ac05..7b73dc0e 100644 --- a/src/ninep/events.zig +++ b/src/ninep/events.zig @@ -938,7 +938,7 @@ test "event records are acme's bytes, one per read, and .again when empty" { try testing.expectEqualStrings("ML0 ", rd(p, event, 0, 4).bytes); try testing.expectEqualStrings("3 4 3 one\n", rd(p, event, 0, 4096).bytes); - const big = "z" ** max_record_text; + const big = &@as([max_record_text]u8, @splat('z')); _ = noteAction(p, 0, .body_exec, 0, max_record_text, 0, big); try testing.expectEqualStrings("MX0 256 0 0 \n", rd(p, event, 0, 4096).bytes); @@ -1388,7 +1388,7 @@ test "opens of the log share the open records, and a closed one frees its record test "a click in the body reports the offsets of the word it takes, so the record can be written back" { const config = @import("../config.zig"); const gpa = testing.allocator; - const text = "alpha qty beta\n qty\n\tqty\ndef f(qty): return qty.x\n" ++ "w" ** 100 ++ " qty\n"; + const text = "alpha qty beta\n qty\n\tqty\ndef f(qty): return qty.x\n" ++ &@as([100]u8, @splat('w')) ++ " qty\n"; const p = try withFile(gpa, text); defer p.deinit(); // A scratch made over 9P, clicked while another pane has the keyboard. @@ -1459,7 +1459,7 @@ test "follow new skips what the log held and waits for what comes after" { test "a long msg record is cut between words at its cap, with an ellipsis" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); - const long = "word " ** 60; // 300 bytes + const long = std.mem.asBytes(&@as([60][5]u8, @splat("word ".*))); // 300 bytes _ = wr(p, Node.of(serialOf(p), .ctl), "Msg " ++ long ++ "\n"); const log = @intFromEnum(tree.TopFile.log); const h = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle; @@ -1485,7 +1485,7 @@ test "a record is one line of UTF-8: DEL and C1 are spaces, bytes not UTF-8 are test "a long err record keeps its end, its middle given up to an ellipsis" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); - _ = wr(p, @intFromEnum(tree.TopFile.ctl), "Bogus" ++ "abcdefgh" ** 40 ++ "\n"); + _ = wr(p, @intFromEnum(tree.TopFile.ctl), "Bogus" ++ std.mem.asBytes(&@as([40][8]u8, @splat("abcdefgh".*))) ++ "\n"); const log = @intFromEnum(tree.TopFile.log); const h = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle; const text = call(p, .{ .tag = 2, .op = .read, .node = log, .handle = h, .size = 1 << 16 }).bytes; @@ -1500,7 +1500,7 @@ test "a long err record keeps its end, its middle given up to an ellipsis" { test "two failures that agree only in what their records cut are two records, not one counted" { const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); - const long = "why " ** 80; + const long = std.mem.asBytes(&@as([80][4]u8, @splat("why ".*))); p.setMessage(0, long ++ "first"); p.setMessage(0, long ++ "second"); try testing.expect(!th.logHas(p, "(x2)")); diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig index 3b70d62f..8605cab8 100644 --- a/src/ninep/pane.zig +++ b/src/ninep/pane.zig @@ -1427,7 +1427,7 @@ test "a tag write past the limit is refused whole, naming the limit" { const tag = Node.of(serialOf(p), .tag); const before = try testing.allocator.dupe(u8, rd(p, tag, 0, 1 << 16).bytes); defer testing.allocator.free(before); - const big = "w" ** (limits.max_tag_tail + 10); + const big = &@as([limits.max_tag_tail + 10]u8, @splat('w')); const r = wr(p, tag, big); try testing.expectEqual(E.NOSPC, r.errno()); // `no space` is what 9ns maps to ENOSPC, so a shell through a mount @@ -1549,20 +1549,21 @@ test "a name with a component over 255 bytes is refused, and a long path's faile const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); const serial = serialOf(p); - const refused = wr(p, Node.of(serial, .name), "/tmp/" ++ "c" ** 256 ++ "/f.txt\n"); + const refused = wr(p, Node.of(serial, .name), "/tmp/" ++ &@as([256]u8, @splat('c')) ++ "/f.txt\n"); try testing.expectEqual(E.INVAL, refused.errno()); try testing.expectEqualStrings("invalid file name: a component over 255 bytes", refused.reply.ename); - try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .name), "/tmp/" ++ "c" ** 255 ++ "\n").reply.status); + try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .name), "/tmp/" ++ &@as([255]u8, @splat('c')) ++ "\n").reply.status); // Held with no newline, it is refused by that write, not at the close. const held = call(p, .{ .tag = 1, .op = .open, .node = Node.of(serial, .name), .omode = 1 }).reply.handle; - try testing.expectEqual(E.INVAL, call(p, .{ .tag = 2, .op = .write, .node = Node.of(serial, .name), .handle = held, .data = "/tmp/" ++ "e" ** 256 }).errno()); + try testing.expectEqual(E.INVAL, call(p, .{ .tag = 2, .op = .write, .node = Node.of(serial, .name), .handle = held, .data = "/tmp/" ++ &@as([256]u8, @splat('e')) }).errno()); _ = call(p, .{ .tag = 3, .op = .release, .node = Node.of(serial, .name), .handle = held, .opened = true }); try testing.expectEqual(@as(usize, 0), p.fs.closed_lines.items.len); // A Save of a 3000-byte path the host refuses: the waiting write's // reason is at the end, the path giving up its middle. // (Under /tmp: under / a user's Save is refused permission, not // missing.) - const long = "/tmp/nonexistent-pardes-root/" ++ ("d" ** 200 ++ "/") ** 15 ++ "f.txt"; + const segment = &@as([200]u8, @splat('d')) ++ "/"; + const long = "/tmp/nonexistent-pardes-root/" ++ std.mem.asBytes(&@as([15][201]u8, @splat(segment.*))) ++ "f.txt"; const id = p.paneBySerial(serial).?; try nameBuffer(p, id, long, false); p.fs.late_failure_len = 0; diff --git a/src/ninep/pty.zig b/src/ninep/pty.zig index c58cf676..aeb57a00 100644 --- a/src/ninep/pty.zig +++ b/src/ninep/pty.zig @@ -1044,12 +1044,12 @@ test "a run's answer says cut when its output's start is gone, and reads a bound const q = try withTerm(gpa); defer q.deinit(); const kept = q.panes[0].?; - kept.terminal.?.vt.screens.get(.primary).?.pages.explicit_max_size = 1; + kept.terminal.?.vt.screens.get(.primary).?.pages.limits.set(.bytes, 1); const run = Node.of(serialOf(q), .pty_run); sh.put(q, prompt); h = sh.send(q, run); sh.put(q, c); - const lines = "pruned\r\n" ** 64; + const lines = std.mem.asBytes(&@as([64][8]u8, @splat("pruned\r\n".*))); var fed: usize = 0; while (!kept.terminal.?.stream.handler.out_start.?.garbage) : (fed += 1) { if (fed == 1000) return error.TestUnexpectedResult; @@ -1146,7 +1146,7 @@ test "a run's answer longer than its room is cut, its newline kept" { var slot: Run = .{}; const p = try th.withTerm(testing.allocator); defer p.deinit(); - answer(p, &slot, "busy: {s} is running", .{"x" ** 200}); + answer(p, &slot, "busy: {s} is running", .{&@as([200]u8, @splat('x'))}); try testing.expectEqual(slot.answer.len, slot.len); try testing.expectEqual(@as(u8, '\n'), slot.answer[slot.len - 1]); } diff --git a/src/ninep/screen.zig b/src/ninep/screen.zig index b991c3e4..8d4707e0 100644 --- a/src/ninep/screen.zig +++ b/src/ninep/screen.zig @@ -333,7 +333,7 @@ test "a terminal's body is its logical lines: a row the terminal wrapped is join const p = try th.withTerm(testing.allocator); defer p.deinit(); const pane = p.panes[0].?; - const long = "w" ** 50 ++ "x" ** 150; // wider than the pane: it wraps + const long = &@as([50]u8, @splat('w')) ++ &@as([150]u8, @splat('x')); // wider than the pane: it wraps try testing.expect(long.len > pane.cols); p.update(.{ .output = .{ .pane = 0, .bytes = long ++ "\r\nnext" } }); while (p.nextEffect()) |_| {} diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig index eedab43b..5678832b 100644 --- a/src/ninep/tree.zig +++ b/src/ninep/tree.zig @@ -509,7 +509,7 @@ pub fn fitErr(text: []const u8, out: []u8) []const u8 { test "a reason past 128 bytes keeps its end: the path in it gives up its middle" { var out: [128]u8 = undefined; - const long = "Save /home/someone/projects/" ++ "deep/" ** 30 ++ "file.txt: no such directory"; + const long = "Save /home/someone/projects/" ++ std.mem.asBytes(&@as([30][5]u8, @splat("deep/".*))) ++ "file.txt: no such directory"; const fit = fitErr(long, &out); try testing.expect(fit.len <= 128); try testing.expect(std.mem.startsWith(u8, fit, "Save /home/someone/")); @@ -517,7 +517,7 @@ test "a reason past 128 bytes keeps its end: the path in it gives up its middle" try testing.expect(std.mem.indexOf(u8, fit, "…") != null); try testing.expect(std.unicode.utf8ValidateSlice(fit)); // No path: the whole text's middle goes, the end stays. - const words = "why " ** 40 ++ "the reason"; + const words = std.mem.asBytes(&@as([40][4]u8, @splat("why ".*))) ++ "the reason"; try testing.expect(std.mem.endsWith(u8, fitErr(words, &out), "the reason")); try testing.expectEqualStrings("short", fitErr("short", &out)); // Through the tree: a look at a long ./ name not there, a miss, says @@ -525,7 +525,7 @@ test "a reason past 128 bytes keeps its end: the path in it gives up its middle" const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); var line: [512]u8 = undefined; - const r = th.wr(p, Node.of(serialOf(p), .look), try std.fmt.bufPrint(&line, "./{s}x.txt\n", .{"no-such-dir/" ** 20})); + const r = th.wr(p, Node.of(serialOf(p), .look), try std.fmt.bufPrint(&line, "./{s}x.txt\n", .{std.mem.asBytes(&@as([20][12]u8, @splat("no-such-dir/".*)))})); try testing.expectEqual(Status.ok, r.reply.status); try testing.expect(th.logHas(p, "x.txt: no such file")); } @@ -1492,17 +1492,17 @@ test "README names every file the tree serves" { return false; } }; - inline for (@typeInfo(TopFile).@"enum".fields) |f| { - const t: TopFile = @enumFromInt(f.value); + inline for (@typeInfo(TopFile).@"enum".field_values) |value| { + const t: TopFile = @enumFromInt(value); if (t != .root and !words.has(t.fileName())) { std.debug.print("README does not mention /{s}\n", .{t.fileName()}); return error.Undocumented; } } - inline for (@typeInfo(PaneFile).@"enum".fields) |f| { - const t: PaneFile = @enumFromInt(f.value); + inline for (@typeInfo(PaneFile).@"enum".field_values) |value| { + const t: PaneFile = @enumFromInt(value); const ok = if (t == .dir) true else if (t.inPty() and t != .pty) - std.mem.indexOf(u8, fs.help, "pty/" ++ comptime @as(PaneFile, @enumFromInt(f.value)).fileName()) != null + std.mem.indexOf(u8, fs.help, "pty/" ++ comptime @as(PaneFile, @enumFromInt(value)).fileName()) != null else words.has(t.fileName()); if (!ok) { diff --git a/src/normal.zig b/src/normal.zig index 77feb7cf..8de23d1c 100644 --- a/src/normal.zig +++ b/src/normal.zig @@ -1015,7 +1015,7 @@ test "gj/gk step the wrapped rows a body draws while j/k keep the file's lines" const p = try Pardes.init(gpa, .{ .tty_only = true }); defer p.deinit(); while (p.nextEffect()) |_| {} - const long = "a" ** 400; + const long = &@as([400]u8, @splat('a')); const pane = try p.setTestFile(long ++ "\nsecond\n"); p.settings.wrap = true; const width = panes.File.wrapWidth(pane, true); diff --git a/src/pager.zig b/src/pager.zig index 30418623..feabd194 100644 --- a/src/pager.zig +++ b/src/pager.zig @@ -38,7 +38,7 @@ pub fn parse(gpa: std.mem.Allocator, raw: []const u8, colour: bool) !Page { errdefer h.text.deinit(gpa); errdefer h.spans.deinit(gpa); try h.text.ensureTotalCapacity(gpa, raw.len); - var stream: ghostty_vt.Stream(*Handler) = .init(&h); + var stream: ghostty_vt.Stream(*Handler) = .init(.{ .handler = &h }); defer stream.deinit(); stream.nextSlice(raw); if (h.failed) return error.OutOfMemory; diff --git a/src/panes.zig b/src/panes.zig index ba1dedb5..07d5ccb1 100644 --- a/src/panes.zig +++ b/src/panes.zig @@ -318,7 +318,7 @@ pub const Pane = struct { /// `older` is an earlier message line still on screen; `index` says /// which (`Pane.msg_older`). pub const Kind = enum { older, message, leader, prompt }; - pub const max = @typeInfo(Kind).@"enum".fields.len - 1 + message_stack; + pub const max = @typeInfo(Kind).@"enum".field_names.len - 1 + message_stack; kinds: [max]Kind = undefined, index: [max]u8 = @splat(0), diff --git a/src/pardes.zig b/src/pardes.zig index 5f330712..8da0922d 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -807,7 +807,7 @@ test "TreeContext tag style preserves message rows and its opt-out survives rest if (comptime !syntax.enabled) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 60, .rows = 16 }); defer p.deinit(); - const pane = try p.setTestFile("pub const Box = struct {\n pub fn run() void {\n" ++ (" // body\n" ** 30) ++ " }\n};\n"); + const pane = try p.setTestFile("pub const Box = struct {\n pub fn run() void {\n" ++ (std.mem.asBytes(&@as([30][16]u8, @splat(" // body\n".*)))) ++ " }\n};\n"); p.gpa.free(pane.file.?.path); pane.file.?.path = try p.gpa.dupe(u8, "/test.zig"); if (!panes.File.supportsContext(pane)) return error.SkipZigTest; @@ -1247,7 +1247,9 @@ test "Def and Refs are a speaking file's tag words; gd, gr and a 2-1 chord all r const r = p.rects[0]; const x0 = r.x + config.GUTTER + panes.File.gutterWidth(pane); const use_y = p.bodyTop(pane, r) + 1; - const tag = try tagline.tagText(p, p.scratch.allocator(), pane); + // Copied out of the scratch arena, which each p.update resets. + const tag = try std.testing.allocator.dupe(u8, try tagline.tagText(p, p.scratch.allocator(), pane)); + defer std.testing.allocator.free(tag); for ([_]struct { word: []const u8, kind: lsp.Kind }{ .{ .word = " Def ", .kind = .definition }, .{ .word = " Refs", .kind = .references } }) |w| { // B1 sweeps the use of `alpha` on the second line (bytes 30..35), // leaving the cursor at its far end. @@ -1348,7 +1350,7 @@ test "acme placement: under a pane's text when it has many blank rows, else halv try std.testing.expectEqual(text_end, p.rects[second].y); // Fill both with text: no blank space is big, so the biggest pane is // halved. - const full = "x\n" ** 80; + const full = std.mem.asBytes(&@as([80][2]u8, @splat("x\n".*))); for ([_]usize{ top, second }) |id| panes.File.setContent(p, &p.panes[id].?.file.?, try p.gpa.dupe(u8, full)); p.sync(); const big = if (p.rects[second].h >= p.rects[top].h) second else top; @@ -2006,7 +2008,7 @@ test "a command pane shows how its command ended, and the next command there run try std.testing.expectEqual(@as(usize, 0), Count.signals); p.host = host_before; // A command line longer than a command pane takes is refused. - const long = "x" ** (exec.command_max + 1); + const long = &@as([exec.command_max + 1]u8, @splat('x')); try std.testing.expectEqual(@as(?usize, null), exec.execute(p, 1, long)); } @@ -2970,9 +2972,9 @@ test "restored terminals keep monotonic nonzero pane identities" { fn chordName(comptime c: config.Chord) []const u8 { comptime { const mods = (if (c.ctrl) "C-" else "") ++ (if (c.alt) "A-" else "") ++ (if (c.shift) "S-" else ""); - for (@typeInfo(Key).@"struct".decls) |d| { - if (@TypeOf(@field(Key, d.name)) != u21) continue; - if (@field(Key, d.name) == c.cp) return mods ++ d.name; + for (@typeInfo(Key).@"struct".decl_names) |d| { + if (@TypeOf(@field(Key, d)) != u21) continue; + if (@field(Key, d) == c.cp) return mods ++ d; } if (c.cp < 0x20 or c.cp > 0x7e) @compileError("chord has no name for the index"); return mods ++ &[_]u8{@as(u8, @intCast(c.cp))}; @@ -3088,11 +3090,11 @@ pub const builtin_rows: [std.enums.values(Builtin).len]Row = blk: { for (std.enums.values(Builtin), 0..) |b, i| { const keys = if (config.leader_path.get(b)) |path| leaderKeys(path) else ""; const rest = shortcuts(b); - const named = @tagName(b) ++ (if (rest.len == 0) "" else (" " ** (namew - @tagName(b).len)) ++ " " ++ rest); + const named = @tagName(b) ++ (if (rest.len == 0) "" else (&@as([namew - @tagName(b).len]u8, @splat(' '))) ++ " " ++ rest); rows[i] = .{ .path = config.leader_path.get(b), .cmd = b, - .line = keys ++ (" " ** (4 + keyw - keys.len)) ++ " " ++ named, + .line = keys ++ (&@as([4 + keyw - keys.len]u8, @splat(' '))) ++ " " ++ named, }; } const last = "\x7f"; @@ -3111,8 +3113,8 @@ comptime { @setEvalBranchQuota(20000); // one branch per string byte, behind the decl walk that folds Builtin var it = std.mem.tokenizeScalar(u8, config.topbar_str, ' '); words: while (it.next()) |w| { - for (@typeInfo(Builtin).@"enum".fields) |f| - if (std.mem.eql(u8, f.name, w)) continue :words; + for (@typeInfo(Builtin).@"enum".field_names) |name| + if (std.mem.eql(u8, name, w)) continue :words; @compileError("topbar word is not a builtin: " ++ w); } } @@ -4499,7 +4501,7 @@ pub const Pardes = struct { /// Panes made this step that found no room in their column /// (exec.placeNew): closed at the step's end, once whatever made them /// is done with them. - unplaced: std.StaticBitSet(MAX_PANES) = .initEmpty(), + unplaced: std.StaticBitSet(MAX_PANES) = .empty, /// A look's word search is running (look.lookUnresolved): from a /// terminal its rows refill the directory's one +Search (Output). word_look: bool = false, @@ -5018,7 +5020,7 @@ pub const Pardes = struct { if (p.dump_out) |d| gpa.free(d); p.fallback.deinit(); if (p.last_dump) |d| gpa.free(d); - if (p.custom_theme) |theme_value| std.zon.parse.free(gpa, theme_value); + if (p.custom_theme) |theme_value| gpa.free(theme_value.name); if (p.chord_arg) |a| gpa.free(a); for (p.spawn_dirs) |d| if (d) |dir| gpa.free(dir); p.pipe.deinit(gpa); @@ -8508,7 +8510,7 @@ test "raw tty Ctrl-B switches to editor mode without sending child input" { test "the jump list never holds two entries in a row the same, when the one between them goes" { const p = try Pardes.init(std.testing.allocator, .{ .cols = 60, .rows = 40 }); defer p.deinit(); - const pane = try p.setTestFile("a\n" ** 200); + const pane = try p.setTestFile(std.mem.asBytes(&@as([200][2]u8, @splat("a\n".*)))); const at: Loc = .{ .pane = 0, .serial = pane.serial, .line = 1, .col = 1 }; // A, a pane long closed with no file to keep it, A again, then far on. p.jumps[0] = at; @@ -9054,7 +9056,7 @@ const JumpsTest = struct { fn init(order: []const u8) !JumpsTest { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 80 }); errdefer p.deinit(); - const text = "row\n" ** 100; + const text = std.mem.asBytes(&@as([100][4]u8, @splat("row\n".*))); _ = try p.setTestFile(text); var t: JumpsTest = .{ .p = p }; for ([_][]const u8{ "/b.txt", "/test.txt", "" }, 1..) |path, n| { diff --git a/src/pdf.zig b/src/pdf.zig index d98d5ff2..5adc62d1 100644 --- a/src/pdf.zig +++ b/src/pdf.zig @@ -4,9 +4,7 @@ const std = @import("std"); const c_heap = @import("c_heap"); -const c = @cImport({ - @cInclude("pdf_bridge.h"); -}); +const c = @import("pdf_c"); // src/pdf_bridge.h, translated by build.zig /// What MuPDF allocates from, itself and the libraries it bundles (they all /// allocate through its context): `start`'s allocator, through the shared C @@ -1130,7 +1128,7 @@ pub const Document = struct { const page_number = try document.checkedPage(page); if (std.mem.indexOfScalar(u8, needle, 0) != null) return error.InvalidNeedle; - const needle_z = try gpa.dupeZ(u8, needle); + const needle_z = try gpa.dupeSentinel(u8, needle, 0); defer gpa.free(needle_z); var found: c.pardes_pdf_search_result = @@ -2067,7 +2065,7 @@ test "MuPDF search returns normalized oriented quads and word selection text" { const projected = try document.pageText(std.testing.allocator, 0); defer std.testing.allocator.free(projected); - try std.testing.expect(std.ascii.indexOfIgnoreCase(projected, "Pardes") != null); + try std.testing.expect(std.ascii.findIgnoreCase(projected, "Pardes") != null); // Exercise transactional cache replacement before searching page zero // again; a failed ownership handoff here tends to surface as a double drop. if (document.pages > 1) { @@ -2093,7 +2091,7 @@ test "MuPDF search returns normalized oriented quads and word selection text" { const text = try document.copySelection(std.testing.allocator, 0, selected.start, selected.end); defer std.testing.allocator.free(text); - try std.testing.expect(std.ascii.indexOfIgnoreCase(text, "Pardes") != null); + try std.testing.expect(std.ascii.findIgnoreCase(text, "Pardes") != null); } test "highlighted render changes pixels while plain render stays stable" { diff --git a/src/regexp.zig b/src/regexp.zig index 86132f60..4cbca57e 100644 --- a/src/regexp.zig +++ b/src/regexp.zig @@ -58,7 +58,7 @@ pub const Regex = struct { /// Timed on this machine's ReleaseSafe build: 10M steps of the worst /// patterns take 45-80 ms, and a Debug build is ten times slower. - pub const budget: u64 = if (builtin.mode == .Debug) 4_000_000 else 32_000_000; + pub const budget: u64 = if (builtin.mode == .debug) 4_000_000 else 32_000_000; pub const e_long = std.fmt.comptimePrint("bad regular expression: longer than mvzr's {d} operations (about {d} pattern characters)", .{ max_ops, max_ops }); pub const e_anchor = "bad regular expression: in a pattern with \\n, ^ can only come first and $ only just before a \\n"; @@ -503,10 +503,10 @@ test "a class with non-ASCII runes matches those runes: [éa-z], a range of them } test "a pattern past 64 characters compiles, and one past the limit says so" { - var long = try Regex.compile("a" ** 200); - const text = "x" ++ "a" ** 200 ++ "\n"; + var long = try Regex.compile(&@as([200]u8, @splat('a'))); + const text = "x" ++ &@as([200]u8, @splat('a')) ++ "\n"; try std.testing.expectEqual(@as(usize, 1), (try long.find(text, 0, text.len, text.len)).?.start); - try std.testing.expectError(error.TooLong, Regex.compile("a" ** (max_ops + 8))); + try std.testing.expectError(error.TooLong, Regex.compile(&@as([max_ops + 8]u8, @splat('a')))); try std.testing.expectError(error.Bad, Regex.compile("a[b")); } @@ -546,13 +546,13 @@ test "a search that would backtrack without end runs out of budget, promptly" { // As long a chain as mvzr compiles, over runs one `a` short of it: 2^20 // steps from every start. for (0..line.len / 20) |i| line[i * 20 + 19] = 'b'; - var chain = try Regex.compile("a?" ** 20 ++ "a" ** 20); + var chain = try Regex.compile(std.mem.asBytes(&@as([20][2]u8, @splat("a?".*))) ++ &@as([20]u8, @splat('a'))); try std.testing.expectError(error.TooSlow, chain.find(&line, 0, line.len, line.len)); } test "the match is the leftmost, however long the line" { // A window cut into the identifier would find `x... =` from its middle. - const text = "let " ++ "x" ** 100 ++ " = 1"; + const text = "let " ++ &@as([100]u8, @splat('x')) ++ " = 1"; var assign = try Regex.compile("\\s*(\\w+)\\s*="); const m = (try assign.find(text, 0, text.len, text.len)).?; try std.testing.expectEqual(@as(usize, 3), m.start); diff --git a/src/sam_edit.zig b/src/sam_edit.zig index d0c51bdb..f6253c89 100644 --- a/src/sam_edit.zig +++ b/src/sam_edit.zig @@ -1102,7 +1102,7 @@ fn expectEdit(text: []const u8, command: []const u8, want: []const u8) !void { test "an x over 100k lines is 100k searches, each with its own step budget" { const th = @import("ninep/testing.zig"); - const line = "x" ** 80 ++ "\n"; + const line = &@as([80]u8, @splat('x')) ++ "\n"; const text = try std.testing.allocator.alloc(u8, line.len * 100_000); defer std.testing.allocator.free(text); for (0..100_000) |k| @memcpy(text[line.len * k ..][0..line.len], line); diff --git a/src/syntax.zig b/src/syntax.zig index b2f5ea99..fa212ca7 100644 --- a/src/syntax.zig +++ b/src/syntax.zig @@ -1859,7 +1859,7 @@ test "syntax declaration locations clear snapshots without muting ordinary conte defer stop(); const header = "pub fn run() void {"; const content = "| \t" ++ header ++ "\n| \t const value = 42;\nfile.zig:3\t}\n"; - const snapshots = [_]u8{0xff} ** header.len; + const snapshots = @as([header.len]u8, @splat(0xff)); const Row = struct { path: []const u8 = "file.zig", code_start: usize, diff --git a/src/terminal.zig b/src/terminal.zig index 3190c6e3..a8e7931c 100644 --- a/src/terminal.zig +++ b/src/terminal.zig @@ -207,7 +207,7 @@ const LivePalette = struct { var seed = GColor.default; for (base, 0..) |rgb, i| seed[i] = rgb; - self.colors = GColor.generate256Color(seed, .initEmpty(), bg, fg, false); + self.colors = GColor.generate256Color(seed, .empty, bg, fg, false); self.key = key; return &self.colors; } @@ -609,10 +609,10 @@ pub fn create(gpa: std.mem.Allocator, cols: u16, rows: u16) !*Pane { state.vt = try ghostty_vt.Terminal.init(terminalIo(), gpa, .{ .cols = cols, .rows = rows, - .max_scrollback = 16 * 1024 * 1024, + .max_scrollback_bytes = 16 * 1024 * 1024, .kitty_image_storage_limit = if (images_enabled) TerminalImages.storage_limit else 0, }); - state.stream = .initAlloc(gpa, .{ .inner = state.vt.vtHandler() }); + state.stream = .init(.{ .handler = .{ .inner = state.vt.vtHandler() }, .allocator = gpa }); state.replay.head = 0; state.replay.len = 0; state.reply_len = 0; @@ -1055,7 +1055,11 @@ fn ingestWithPositions(pane: *Pane, bytes: []const u8) void { } }; } else failed = true; + // Whether the program cleared the screen (ED 2, a switch of screens); + // pardes reads the flag nowhere else. + pane.terminal.?.vt.flags.dirty.clear = false; ingest(pane, bytes); + const cleared = pane.terminal.?.vt.flags.dirty.clear; // RIS can destroy the alternate screen and every pin it owned. const alive = if (screens.generation(key) == generation) pages else null; var moved = false; @@ -1065,7 +1069,15 @@ fn ingestWithPositions(pane: *Pane, bytes: []const u8) void { if (pin.garbage) pointer_rows_lost = true; }; }; + // The program cleared the screen, or the rows the live copy stood on are + // gone (pruned, a reset): the copy goes with them, as what the program + // drew next. Kept, ghostty would move its rows to the top of what is + // left, over the program's new text. + var copy_lost = cleared or alive == null; for (spans[0..nspans]) |span| { + if (span.overlay == overlay) if (span.start.pin) |pin| if (alive != null and pin.garbage) { + copy_lost = true; + }; const start = pinnedRow(alive, span.start); const rows = @max(1, pinnedRow(alive, span.end) -| start +| 1); moved = moved or start != span.overlay.row or rows != span.overlay.rows; @@ -1096,6 +1108,11 @@ fn ingestWithPositions(pane: *Pane, bytes: []const u8) void { pane.clearPointerSelection(button); pane.sel[button].state = .none; }; + if (copy_lost) if (pane.ovl) |copy| { + pane.gpa.free(copy.text); + pane.ovl = null; + moved = true; + }; if (moved) pane.nsel_snap = 0; // Saved regex-preview offsets name the old flat text. if (failed) { const message = "terminal edit position reset: out of memory"; @@ -1211,7 +1228,7 @@ pub fn commandOutput(pane: *Pane, gpa: std.mem.Allocator, max_rows: usize) !Comm .whole = whole, }; } else true; - return .{ .text = try gpa.dupeZ(u8, ""), .whole = whole }; + return .{ .text = try gpa.dupeSentinel(u8, "", 0), .whole = whole }; } /// At a prompt with nothing typed on its line: no input left of the @@ -2813,7 +2830,7 @@ pub fn redo(p: *Pardes, pane: *Pane) void { pane.ensureCursorVisible(); } -pub fn ptyReport(handler: *ghostty_vt.TerminalStream.Handler, data: [:0]const u8) void { +pub fn ptyReport(handler: *ghostty_vt.TerminalStream.Handler, data: []const u8) void { const state: *State = @alignCast(@fieldParentPtr("vt", handler.terminal)); const room = state.reply.len - state.reply_len; const n = @min(room, data.len); @@ -2968,7 +2985,8 @@ test "a program that asked for focus reports hears CSI I and CSI O as its pane t /// over two cells). inline fn kittyTransmit(comptime extra: []const u8) []const u8 { return comptime blk: { - const pixels = [_]u8{ 255, 0, 0, 255, 0, 0, 0, 0, 255, 0, 0, 255 } ** 2; + const row = [_]u8{ 255, 0, 0, 255, 0, 0, 0, 0, 255, 0, 0, 255 }; + const pixels = row ++ row; var buf: [std.base64.standard.Encoder.calcSize(pixels.len)]u8 = undefined; const b64 = std.base64.standard.Encoder.encode(&buf, &pixels)[0..buf.len].*; break :blk "\x1b_Ga=T,f=24,s=4,v=2,i=7," ++ extra ++ ";" ++ b64 ++ "\x1b\\"; diff --git a/src/tty/tty.zig b/src/tty/tty.zig index ca2cb939..82cb40bd 100644 --- a/src/tty/tty.zig +++ b/src/tty/tty.zig @@ -129,7 +129,7 @@ fn readInput(loop: *Loop, tty: anytype, cache: *vaxis.GraphemeCache) !void { var parser: vaxis.Parser = .{}; var buf: [1024]u8 = undefined; var carried: usize = 0; - while (!loop.should_quit) { + while (true) { // stopInput cancels the task; the read then fails with Canceled if (carried == buf.len) return error.InputSequenceTooLong; const received = try tty.read(buf[carried..]); if (received == 0) return; @@ -295,7 +295,7 @@ test "terminal input preserves fragmented keys queries paste and text after EOF" fn getWinsize(_: *@This()) !vaxis.Winsize { return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 }; } - fn inputFollows(self: *@This(), _: u32) bool { + pub fn inputFollows(self: *@This(), _: u32) bool { return self.next < self.parts.len; } fn read(self: *@This(), buf: []u8) !usize { @@ -380,7 +380,7 @@ test "terminal replies and malformed sequences never become typed text" { fn getWinsize(_: *@This()) !vaxis.Winsize { return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 }; } - fn inputFollows(self: *@This(), _: u32) bool { + pub fn inputFollows(self: *@This(), _: u32) bool { return self.next < self.parts.len; } fn read(self: *@This(), buf: []u8) !usize { @@ -465,7 +465,7 @@ test "terminal input split at every byte with a gap reads as it does whole" { fn getWinsize(_: *@This()) !vaxis.Winsize { return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 }; } - fn inputFollows(self: *@This(), ms: u32) bool { + pub fn inputFollows(self: *@This(), ms: u32) bool { return self.next < self.parts.len and self.gap_ms <= ms; } fn read(self: *@This(), buf: []u8) !usize { @@ -561,7 +561,7 @@ test "an ESC read by itself is the Escape key at once" { fn getWinsize(_: *@This()) !vaxis.Winsize { return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 }; } - fn inputFollows(self: *@This(), _: u32) bool { + pub fn inputFollows(self: *@This(), _: u32) bool { self.asked = true; return self.next < self.parts.len; } @@ -609,7 +609,7 @@ test "a frame's answer is taken wherever the reads cut it, and never typed" { fn getWinsize(_: *@This()) !vaxis.Winsize { return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 }; } - fn inputFollows(self: *@This(), _: u32) bool { + pub fn inputFollows(self: *@This(), _: u32) bool { return self.next < self.parts.len; } fn read(self: *@This(), buf: []u8) !usize { @@ -701,7 +701,7 @@ test "terminal input cancellation joins blocked reads and queued EOF" { fn getWinsize(_: *@This()) !vaxis.Winsize { return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 }; } - fn inputFollows(_: *@This(), _: u32) bool { + pub fn inputFollows(_: *@This(), _: u32) bool { return false; } fn read(self: *@This(), buf: []u8) !usize { @@ -2332,7 +2332,7 @@ test "a terminal pane gets function keys as their sequences and lone modifiers n fn getWinsize(_: *@This()) !vaxis.Winsize { return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 }; } - fn inputFollows(self: *@This(), _: u32) bool { + pub fn inputFollows(self: *@This(), _: u32) bool { return self.next < self.parts.len; } fn read(self: *@This(), buf: []u8) !usize { @@ -3033,7 +3033,7 @@ test "a jump leaves a trail of a few cells behind the cursor that fades in 120 m const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 }); defer core.deinit(); - _ = try core.setTestFile("some text on a line\n" ** 20); + _ = try core.setTestFile(std.mem.asBytes(&@as([20][20]u8, @splat("some text on a line\n".*)))); try std.testing.expect(core.executeBuiltinLine(0, "Theme forge")); core.settings.jump_trail = true; for (0..40) |_| core.update(.tick); @@ -3078,7 +3078,7 @@ test "a notice chip casts a cell's shadow right and down, inside its body, off t const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 }); defer core.deinit(); - _ = try core.setTestFile("some text on a line\n" ** 20); + _ = try core.setTestFile(std.mem.asBytes(&@as([20][20]u8, @splat("some text on a line\n".*)))); try std.testing.expect(core.executeBuiltinLine(0, "Theme forge")); core.settings.chip_shadow = true; try std.testing.expect(core.executeBuiltinLine(0, "Msg a notice")); @@ -3114,7 +3114,7 @@ test "a scrolled pane's thumb brightens and fades back in 250 ms" { const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 }); defer core.deinit(); - const pane = try core.setTestFile("some text on a line\n" ** 200); + const pane = try core.setTestFile(std.mem.asBytes(&@as([200][20]u8, @splat("some text on a line\n".*)))); try std.testing.expect(core.executeBuiltinLine(0, "Theme forge")); core.settings.thumb_flash = true; for (0..40) |_| core.update(.tick); diff --git a/test/deck/replay.zig b/test/deck/replay.zig index 475f7476..49614b46 100644 --- a/test/deck/replay.zig +++ b/test/deck/replay.zig @@ -20,8 +20,9 @@ const Tally = struct { fn replay(src: [:0]const u8) !Tally { const gpa = std.testing.allocator; - const rec = try schema.parse(gpa, src); - defer schema.free(gpa, rec); + var arena: std.heap.ArenaAllocator = .init(gpa); + defer arena.deinit(); + const rec = try schema.parse(gpa, arena.allocator(), src); var d: deck.Deck = .{}; var tally: Tally = .{}; for (rec.events) |ev| { diff --git a/test/deck/schema.zig b/test/deck/schema.zig index 782c829a..401e15e8 100644 --- a/test/deck/schema.zig +++ b/test/deck/schema.zig @@ -61,10 +61,8 @@ pub const Event = struct { }; }; -pub fn parse(gpa: std.mem.Allocator, src: [:0]const u8) error{ OutOfMemory, ParseZon }!Recording { - return std.zon.parse.fromSliceAlloc(Recording, gpa, src, null, .{}); -} - -pub fn free(gpa: std.mem.Allocator, rec: Recording) void { - std.zon.parse.free(gpa, rec); +/// The recording's slices live in `arena`. +pub fn parse(gpa: std.mem.Allocator, arena: std.mem.Allocator, src: [:0]const u8) error{ OutOfMemory, ParseZon }!Recording { + var diagnostics: std.zon.parse.Diagnostics = undefined; + return std.zon.parse.fromSlice(Recording, .{ .gpa = gpa, .arena = arena, .source = src, .diagnostics = &diagnostics }); } diff --git a/test/e2e_harness.zig b/test/e2e_harness.zig index 9e67c49f..a2010c19 100644 --- a/test/e2e_harness.zig +++ b/test/e2e_harness.zig @@ -104,7 +104,7 @@ pub const Harness = struct { term.* = try ghostty_vt.Terminal.init(std.Io.Threaded.global_single_threaded.io(), gpa, .{ .cols = cols, .rows = rows, - .max_scrollback = 1024 * 1024, + .max_scrollback_bytes = 1024 * 1024, }); errdefer term.deinit(gpa); // vtStream() captures a pointer to `term`; term is heap-allocated so the diff --git a/test/fs_bench.zig b/test/fs_bench.zig index 746fe737..4764049f 100644 --- a/test/fs_bench.zig +++ b/test/fs_bench.zig @@ -272,7 +272,7 @@ pub fn main(init: std.process.Init) !void { .tag = 9, .op = .write, .node = s.node(.body), - .data = "x" ** 1024, + .data = &@as([1024]u8, @splat('x')), .size = 1024, }, "append: whole-body swap + undo snapshot"); @@ -327,7 +327,7 @@ pub fn main(init: std.process.Init) !void { try w.writeAll("]}\n"); } else { try w.print("{s:<26} {s:>9} {s:>8} {s}\n", .{ "request", "ns/op", "allocs", "note" }); - try w.print("{s:<26} {s:>9} {s:>8} {s}\n", .{ "-" ** 26, "-" ** 9, "-" ** 8, "-" ** 20 }); + try w.print("{s:<26} {s:>9} {s:>8} {s}\n", .{ &@as([26]u8, @splat('-')), &@as([9]u8, @splat('-')), &@as([8]u8, @splat('-')), &@as([20]u8, @splat('-')) }); for (rows.items) |r| try w.print("{s:<26} {d:>9} {d:>8} {s}\n", .{ r.name, r.ns, r.allocs, r.note }); } diff --git a/test/history.zig b/test/history.zig index 5ce45239..d399f7aa 100644 --- a/test/history.zig +++ b/test/history.zig @@ -432,24 +432,24 @@ test "history benchmark cases are nonempty unique and matched by name" { try std.testing.expectError(error.MissingField, readBenchmarks(arena, "{\"case\":\"first\"}")); const before = try readBenchmarks(arena, benchmark_fixture); const missing = try readBenchmarks(arena, "{\"case\":\"first\",\"bytes\":10,\"median_ns\":100,\"cold_ns\":100,\"allocations\":10,\"allocated_bytes\":1000}"); - try std.testing.expectError(error.DifferentBenchmarks, compareBenchmarks(.{before} ** 4, .{missing} ** 4, null, &report.writer)); + try std.testing.expectError(error.DifferentBenchmarks, compareBenchmarks(@splat(before), @splat(missing), null, &report.writer)); const renamed = \\{"case":"first","bytes":10,"median_ns":100,"cold_ns":100,"allocations":10,"allocated_bytes":1000} \\{"case":"renamed","bytes":20,"median_ns":100,"cold_ns":100,"allocations":10,"allocated_bytes":1000} ; const different = try readBenchmarks(arena, renamed); - try std.testing.expectError(error.DifferentBenchmarks, compareBenchmarks(.{before} ** 4, .{different} ** 4, null, &report.writer)); + try std.testing.expectError(error.DifferentBenchmarks, compareBenchmarks(@splat(before), @splat(different), null, &report.writer)); const reordered = \\{"case":"last","bytes":20,"median_ns":100,"cold_ns":100,"allocations":10,"allocated_bytes":1000} \\{"case":"first","bytes":10,"median_ns":100,"cold_ns":100,"allocations":10,"allocated_bytes":1000} ; const same = try readBenchmarks(arena, reordered); - try std.testing.expect(!try compareBenchmarks(.{before} ** 4, .{same} ** 4, 1, &report.writer)); + try std.testing.expect(!try compareBenchmarks(@splat(before), @splat(same), 1, &report.writer)); var samples = [4][]Benchmark{ before, before, before, different }; - try std.testing.expectError(error.DifferentBenchmarks, compareBenchmarks(.{before} ** 4, samples, null, &report.writer)); + try std.testing.expectError(error.DifferentBenchmarks, compareBenchmarks(@splat(before), samples, null, &report.writer)); samples[3] = try arena.dupe(Benchmark, before); samples[3][0].bytes += 1; - try std.testing.expectError(error.DifferentBenchmarkInputs, compareBenchmarks(.{before} ** 4, samples, null, &report.writer)); + try std.testing.expectError(error.DifferentBenchmarkInputs, compareBenchmarks(@splat(before), samples, null, &report.writer)); } test "history benchmark gate uses repeated process captures rather than the first process alone" { diff --git a/test/hxdiff.zig b/test/hxdiff.zig index 48c7ab93..b12bcd8e 100644 --- a/test/hxdiff.zig +++ b/test/hxdiff.zig @@ -39,7 +39,7 @@ pub fn main(init: std.process.Init) !void { var pane_override: ?[]const u8 = null; var goldens_path: ?[]const u8 = null; var waivers_path: ?[]const u8 = null; - const paths = try arena.alloc([]const u8, args.len - 1); + const paths = try arena.alloc([]const u8, @max(args.len - 1, 3)); // room for the defaults below var n_paths: usize = 0; var want_waivers = false; for (args[1..]) |a| { @@ -67,6 +67,18 @@ pub fn main(init: std.process.Init) !void { n_paths += 1; } } + // Named nothing (`zig build hxdiff` or `hxparity` bare): the checked-in + // suite, run from the repository root. + if (n_paths == 0 and !want_waivers) { + strict = true; + const defaults: []const []const u8 = if (parity) + &.{ "test/hxcases/cases.jsonl", "test/hxcases/parity.jsonl" } + else + &.{ "test/hxcases/cases.jsonl", "test/hxcases/goldens.jsonl", "test/hxcases/waivers.jsonl" }; + if (parity) waivers_path = waivers_path orelse "test/hxcases/parity-waivers.jsonl"; + @memcpy(paths[0..defaults.len], defaults); + n_paths = defaults.len; + } if (n_paths == 0 or want_waivers) fatal("usage: pardes-hxdiff [--parity] ... [goldens.jsonl [waivers.jsonl]]", .{}); const case_paths = paths[0..if (parity) n_paths else 1]; diff --git a/test/image_harness.zig b/test/image_harness.zig index 474ec48b..b45851cc 100644 --- a/test/image_harness.zig +++ b/test/image_harness.zig @@ -38,7 +38,7 @@ pub fn main(init: std.process.Init) !void { const args = try init.minimal.args.toSlice(arena); if (args.len != 3 and args.len != 4) return error.BadArgs; - const exe = try arena.dupeZ(u8, args[1]); + const exe = try arena.dupeSentinel(u8, args[1], 0); const backend = args[2]; const pdf_mode = args.len == 4 and std.mem.eql(u8, args[3], "pdf"); if (args.len == 4 and !pdf_mode) return error.BadArgs; diff --git a/test/lspbench.zig b/test/lspbench.zig index 02138d24..d0e25aee 100644 --- a/test/lspbench.zig +++ b/test/lspbench.zig @@ -216,7 +216,7 @@ fn reportText(rs: []const Result, rss: u64) void { const o = std.debug.print; o("backend: {s}\n\n", .{lsp.backend_name}); o("{s:<24} {s:>9} {s:>7} {s:>10} {s:>10} {s}\n", .{ "kind", "supports", "rows", "cold(us)", "warm(us)", "verdict" }); - o("{s}\n", .{"-" ** 78}); + o("{s}\n", .{&@as([78]u8, @splat('-'))}); var claimed: usize = 0; var working: usize = 0; var lies: usize = 0; diff --git a/test/monkey.zig b/test/monkey.zig index 83869ce4..dcea0b43 100644 --- a/test/monkey.zig +++ b/test/monkey.zig @@ -44,7 +44,7 @@ fn generate(gpa: std.mem.Allocator, seed: u64, steps: usize) ![]u8 { var s: Script = .{ .gpa = gpa }; try s.line("# pardes-monkey seed {d}, {d} steps", .{ seed, steps }); try s.line("file bad.txt hello \\xff\\xfe world\\nlatin-1 caf\\xe9 tail\\ntruncated \\xe6\\x97 here\\nend\\n", .{}); - try s.line("file wide.txt {s}tail\\nsecond line\\n", .{"\\xe6\\x97\\xa5\\xe6\\x9c\\xac\\xe8\\xaa\\x9e " ** 8}); + try s.line("file wide.txt {s}tail\\nsecond line\\n", .{std.mem.asBytes(&@as([8][37]u8, @splat("\\xe6\\x97\\xa5\\xe6\\x9c\\xac\\xe8\\xaa\\x9e ".*)))}); try s.line("lines long.txt 400 some words after the number, long enough to wrap in a narrow pane", .{}); try s.line("start 24 80 bad.txt", .{}); try s.line("wait 8000 Newcol Joincol", .{}); diff --git a/test/panes.zig b/test/panes.zig index 86e52838..54100f91 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -42,7 +42,7 @@ const TagLayerTests = struct { p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 5, .tagline_h = 10 }; p.gpa.free(pane.file.?.path); pane.file.?.path = try p.gpa.dupe(u8, "/x"); - try setTag(pane, " " ++ "a" ** 38 ++ "\t界 END"); + try setTag(pane, " " ++ &@as([38]u8, @splat('a')) ++ "\t界 END"); var frame = std.heap.ArenaAllocator.init(p.gpa); defer frame.deinit(); _ = try p.render(frame.allocator()); @@ -135,7 +135,7 @@ const TagLayerTests = struct { try std.testing.expectEqual(@as(i32, 0), p.panes[second].?.input.cur_col); p.update(.{ .key = .{ .cp = Key.escape } }); const left = p.panes[0].?; - try setTag(left, " " ++ "a" ** 110); + try setTag(left, " " ++ &@as([110]u8, @splat('a'))); _ = try p.render(frame.allocator()); const left_layer = try findLayer(p, .pane, 0); const left_text = try pardes.tagline.tagText(p, frame.allocator(), left); @@ -149,7 +149,7 @@ const TagLayerTests = struct { try std.testing.expectEqual(panes.File.rawAtDisplay(left_text, end_col), @as(usize, @intCast(left.tag.cur_col))); try std.testing.expect(left.sel[0].state == .done and left.sel[0].r0 == 0); p.update(.{ .key = .{ .cp = Key.escape } }); - const long = "a" ** 60 ++ "界END"; + const long = &@as([60]u8, @splat('a')) ++ "界END"; p.global_tag.own = try p.gpa.dupe(u8, long); for (p.col_tags[0..p.ncol]) |*tag| tag.own = try p.gpa.dupe(u8, long); _ = try p.render(frame.allocator()); @@ -581,7 +581,7 @@ const BodyHitTests = struct { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 64, .rows = 18 }); defer p.deinit(); p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 8, .tagline_h = 10 }; - const pane = try TreeContextTests.setZigFile(p, "const Box = struct {\n pub fn work(\n value: usize,\n ) void {\n" ++ " // body\n" ** 60 ++ " }\n};\n"); + const pane = try TreeContextTests.setZigFile(p, "const Box = struct {\n pub fn work(\n value: usize,\n ) void {\n" ++ std.mem.asBytes(&@as([60][16]u8, @splat(" // body\n".*))) ++ " }\n};\n"); try std.testing.expect(p.executeBuiltinLine(0, "TreeContext")); pane.scrollBy(10); var frame = std.heap.ArenaAllocator.init(p.gpa); @@ -629,7 +629,7 @@ const LineNumberLookTests = struct { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 64, .rows = 18 }); defer p.deinit(); p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 8, .tagline_h = 10 }; - const pane = try TreeContextTests.setZigFile(p, "const Box = struct {\n pub fn work(\n value: usize,\n ) void {\n" ++ " // body\n" ** 60 ++ " }\n};\n"); + const pane = try TreeContextTests.setZigFile(p, "const Box = struct {\n pub fn work(\n value: usize,\n ) void {\n" ++ std.mem.asBytes(&@as([60][16]u8, @splat(" // body\n".*))) ++ " }\n};\n"); try std.testing.expect(p.executeBuiltinLine(0, "TreeContext")); pane.scrollBy(30); var frame = std.heap.ArenaAllocator.init(p.gpa); @@ -686,7 +686,7 @@ const TreeContextTests = struct { if (!syntax.enabled) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 64, .rows = 18 }); defer p.deinit(); - const pane = try setZigFile(p, "const Box = struct {\n\n // omitted member comment\n\n pub fn work(\n value: usize,\n ) void {\n" ++ " // body\n" ** 30 ++ " }\n};\n"); + const pane = try setZigFile(p, "const Box = struct {\n\n // omitted member comment\n\n pub fn work(\n value: usize,\n ) void {\n" ++ std.mem.asBytes(&@as([30][16]u8, @splat(" // body\n".*))) ++ " }\n};\n"); p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 8, .tagline_h = 10 }; try std.testing.expect(p.executeBuiltinLine(0, "TreeContext")); pane.scrollBy(10); @@ -717,7 +717,7 @@ const TreeContextTests = struct { if (context and !syntax.enabled) continue; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 64, .rows = 18 }); defer p.deinit(); - const pane = try setZigFile(p, "pub fn work() void {\n" ++ " // body\n" ** 100 ++ "}\n"); + const pane = try setZigFile(p, "pub fn work() void {\n" ++ std.mem.asBytes(&@as([100][12]u8, @splat(" // body\n".*))) ++ "}\n"); if (context) try std.testing.expect(p.executeBuiltinLine(0, "TreeContext")); var frame = std.heap.ArenaAllocator.init(p.gpa); defer frame.deinit(); @@ -792,7 +792,7 @@ const TreeContextTests = struct { if (!syntax.enabled) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 48, .rows = 14 }); defer p.deinit(); - const pane = try setZigFile(p, "pub fn @\"界name\"(\n\tvalue: usize,\n) void {\n" ++ " _ = value;\n" ** 12 ++ "}\n"); + const pane = try setZigFile(p, "pub fn @\"界name\"(\n\tvalue: usize,\n) void {\n" ++ std.mem.asBytes(&@as([12][15]u8, @splat(" _ = value;\n".*))) ++ "}\n"); pane.tag_expanded = false; // a one-row tag keeps this small screen's rows p.sync(); p.settings.wrap = false; @@ -820,7 +820,7 @@ const TreeContextTests = struct { // Read the body top again: the click cleared the announcement band the // builtin above put up, so the body moved with it. try std.testing.expectEqual(p.bodyTop(pane, p.rects[0]), cursor.y); - panes.File.setContent(p, &pane.file.?, try p.gpa.dupe(u8, "// no enclosing declaration\n" ** 18)); + panes.File.setContent(p, &pane.file.?, try p.gpa.dupe(u8, std.mem.asBytes(&@as([18][28]u8, @splat("// no enclosing declaration\n".*))))); _ = try p.render(frame.allocator()); try std.testing.expectEqual(@as(u16, 0), pane.context_rows); try std.testing.expectEqual(pane.scroll(), pane.wrapAt(0).line); @@ -942,7 +942,7 @@ const TtySelectionTests = struct { try noChildInput(p); _ = try p.render(frame.allocator()); try std.testing.expectEqualStrings(expected, pardes.test_api.heldSelection(p, 0).?); - p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b]133;C\x07" ++ "\r\nnew output" ** 30 } }); + p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b]133;C\x07" ++ std.mem.asBytes(&@as([30][12]u8, @splat("\r\nnew output".*))) } }); _ = try p.render(frame.allocator()); try std.testing.expectEqual(panes.Text.Mode.tty, pane.body.mode); try std.testing.expectEqualStrings(expected, pardes.test_api.heldSelection(p, 0).?); @@ -1266,7 +1266,7 @@ const ClickCursorTests = struct { test "click operands and hover follow the scrolled source selection" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 40, .rows = 14 }); defer p.deinit(); - const pane = try p.setTestFile("zero\none\ntwo\nthree\nalpha beta\nfive\ngamma delta\nseven\n" ++ "tail\n" ** 20); + const pane = try p.setTestFile("zero\none\ntwo\nthree\nalpha beta\nfive\ngamma delta\nseven\n" ++ std.mem.asBytes(&@as([20][5]u8, @splat("tail\n".*)))); p.presentation.enabled = false; p.settings.wrap = false; var frame = std.heap.ArenaAllocator.init(p.gpa); @@ -1323,7 +1323,7 @@ const JumpSelectionTests = struct { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 34, .rows = 10 }); defer p.deinit(); p.settings.wrap = wrap; - const text = try std.fmt.allocPrint(p.gpa, "{s}{s}", .{ prefix, "unrelated destination text\n" ** 80 }); + const text = try std.fmt.allocPrint(p.gpa, "{s}{s}", .{ prefix, std.mem.asBytes(&@as([80][27]u8, @splat("unrelated destination text\n".*))) }); defer p.gpa.free(text); const pane = try p.setTestFile(text); var frame = std.heap.ArenaAllocator.init(p.gpa); @@ -1813,7 +1813,7 @@ test "a word the tag's wrapping breaks across rows is still one word to a click" var pad: usize = 1; const shown = while (pad < 80) : (pad += 1) { p.gpa.free(pane.file.?.path); - const path = try std.fmt.allocPrint(arena.allocator(), "/{s}/f.zig", .{("a" ** 80)[0..pad]}); + const path = try std.fmt.allocPrint(arena.allocator(), "/{s}/f.zig", .{(&@as([80]u8, @splat('a')))[0..pad]}); pane.file.?.path = try p.gpa.dupe(u8, path); p.sync(); const s = try pardes.tagline.shownTag(p, arena.allocator(), pane); @@ -1866,7 +1866,7 @@ test "terminal output keeps following new rows after scrollback eviction" { pane.body.mode = .tty; pane.tty_filter = false; const pages = &pane.terminal.?.vt.screens.active.pages; - pages.explicit_max_size = 64 * 1024; + pages.limits.set(.bytes, 64 * 1024); var frame = std.heap.ArenaAllocator.init(gpa); defer frame.deinit(); var evictions: usize = 0; @@ -1885,7 +1885,7 @@ test "terminal output keeps following new rows after scrollback eviction" { if (pages.scrollbar().total < previous) evictions += 1; } try std.testing.expect(evictions > phase); - try std.testing.expect(pages.page_size <= pages.maxSize()); + try std.testing.expect(pages.page_size <= pages.limits.max(.bytes)); const sb = pages.scrollbar(); try std.testing.expectEqual(sb.total - pane.rows, sb.offset); const full = try panes.terminal.screenTextAlloc(pane, gpa); @@ -1926,7 +1926,7 @@ test "terminal edit stays on its surviving row when old scrollback is evicted" { const pane = p.panes[0].?; pane.body.mode = .tty; const pages = &pane.terminal.?.vt.screens.active.pages; - pages.explicit_max_size = 64 * 1024; + pages.limits.set(.bytes, 64 * 1024); var next: usize = 0; while (next < 3000) { var buf: [32]u8 = undefined; @@ -1977,9 +1977,9 @@ test "terminal edits and undo survive partial history clearing and whole-screen pane.body.mode = .tty; if (action == .reset_alternate) p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b[?1049h" } }); - p.update(.{ .output = .{ .pane = 0, .bytes = "old row\r\n" ** 40 } }); + p.update(.{ .output = .{ .pane = 0, .bytes = std.mem.asBytes(&@as([40][9]u8, @splat("old row\r\n".*))) } }); const pages = &pane.terminal.?.vt.screens.active.pages; - pages.explicit_max_size = 64 * 1024; + pages.limits.set(.bytes, 64 * 1024); const row: i32 = @as(i32, @intCast(pages.total_rows - pane.rows)) + @as(i32, if (action == .partial_clear_history) -1 else 2); pane.body.mode = .normal; @@ -2005,7 +2005,7 @@ test "terminal edits and undo survive partial history clearing and whole-screen const bytes = switch (action) { .clear_history, .partial_clear_history => "\x1b[3J", .reset_primary, .reset_alternate => "\x1bc", - .evict_all, .hidden_undo => "new row\r\n" ** 4000, + .evict_all, .hidden_undo => std.mem.asBytes(&@as([4000][9]u8, @splat("new row\r\n".*))), }; p.update(.{ .output = .{ .pane = 0, .bytes = bytes } }); const expected: i32 = if (action == .clear_history) 2 else 0; @@ -2045,7 +2045,7 @@ test "terminal lower scroll regions do not move edits above them" { var setup: [64]u8 = undefined; const bytes = try std.fmt.bufPrint(&setup, "\x1b[4;{d}r\x1b[{d};1H", .{ pane.rows, pane.rows }); p.update(.{ .output = .{ .pane = 0, .bytes = bytes } }); - p.update(.{ .output = .{ .pane = 0, .bytes = "tail\r\n" ** 50 } }); + p.update(.{ .output = .{ .pane = 0, .bytes = std.mem.asBytes(&@as([50][6]u8, @splat("tail\r\n".*))) } }); try std.testing.expectEqual(total, panes.terminal.scrollbar(pane).total); try std.testing.expectEqual(@as(i32, 1), pane.ovl.?.row); try std.testing.expectEqual(@as(i32, 1), pane.body.cur_row); @@ -2064,7 +2064,7 @@ test "terminal eviction and lower-region scrolling in one read preserve a surviv const pane = p.panes[0].?; pane.body.mode = .tty; const pages = &pane.terminal.?.vt.screens.active.pages; - pages.explicit_max_size = 64 * 1024; + pages.limits.set(.bytes, 64 * 1024); var next: usize = 0; while (next < 3000) { var buf: [32]u8 = undefined; @@ -2229,7 +2229,7 @@ test "prompt cancellation restores the selection before regex previews" { } test "a prompt that cannot be opened leaves the open one as it was" { - const Request = @typeInfo(@TypeOf(Pardes.startPrompt)).@"fn".params[3].type.?; + const Request = @typeInfo(@TypeOf(Pardes.startPrompt)).@"fn".param_types[3].?; for ([_]Request{ .{ .search = config.search_marker }, .save, .{ .pipe = .replace }, .{ .pipe = .ignore }, .{ .pipe = .insert }, .{ .pipe = .append } }) |request| { var failing = std.testing.FailingAllocator.init(std.testing.allocator, .{}); const p = try Pardes.init(failing.allocator(), .{ .tty_only = true }); @@ -2268,7 +2268,7 @@ test "Save's prompt starts from the pane's directory" { } test "a prompt opens with one allocation" { - const Request = @typeInfo(@TypeOf(Pardes.startPrompt)).@"fn".params[3].type.?; + const Request = @typeInfo(@TypeOf(Pardes.startPrompt)).@"fn".param_types[3].?; for ([_]Request{ .{ .search = config.search_marker }, .save, .{ .pipe = .replace }, .{ .pipe = .ignore }, .{ .pipe = .insert }, .{ .pipe = .append } }) |request| { var failing = std.testing.FailingAllocator.init(std.testing.allocator, .{}); const p = try Pardes.init(failing.allocator(), .{ .tty_only = true }); @@ -3441,7 +3441,7 @@ const PdfTests = struct { defer probe.deinit(std.testing.allocator); try std.testing.expectEqual(@as(usize, 0), probe.page); try std.testing.expect(probe.quads.len > 0); - try std.testing.expect(std.ascii.indexOfIgnoreCase(probe.text, "Pardes") != null); + try std.testing.expect(std.ascii.findIgnoreCase(probe.text, "Pardes") != null); } test "PDF point mapping restores band origin and fractional placement" { @@ -4812,7 +4812,7 @@ test "growing a file pane colors every newly visible Zig keyword" { const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 8 }); defer p.deinit(); - const pane = try p.setTestFile("pub fn f() void { if (true) {} }\n" ** 100); + const pane = try p.setTestFile(std.mem.asBytes(&@as([100][33]u8, @splat("pub fn f() void { if (true) {} }\n".*)))); const file = &pane.file.?; gpa.free(file.path); file.path = try gpa.dupe(u8, "/resize.zig"); diff --git a/test/pdf.zig b/test/pdf.zig index a0eb8154..a51fd1a9 100644 --- a/test/pdf.zig +++ b/test/pdf.zig @@ -2080,14 +2080,14 @@ test "PDF native mouse selection, Look, and highlights share page geometry" { @as(i32, r.y + r.h - 1), )); if (!panes.Pdf.beginSelection(p, pane, col, row)) continue; - if (std.ascii.indexOfIgnoreCase(pv.selection_text, "Pardes") != null) { + if (std.ascii.findIgnoreCase(pv.selection_text, "Pardes") != null) { selected_col = col; selected_row = row; break :find_word; } }; const word_col = selected_col orelse return error.PdfMouseMappingMissedWord; - try std.testing.expect(std.ascii.indexOfIgnoreCase( + try std.testing.expect(std.ascii.findIgnoreCase( pardes.test_api.heldSelection(p, 0).?, "Pardes", ) != null); @@ -2142,7 +2142,7 @@ test "PDF native mouse selection, Look, and highlights share page geometry" { const hover = p.pdf_hover_preview orelse return error.MissingPdfHoverPreview; try std.testing.expectEqual(@as(usize, 0), hover.probe.page); try std.testing.expect(hover.probe.quads.len > 0); - try std.testing.expect(std.ascii.indexOfIgnoreCase(hover.probe.text, "Pardes") != null); + try std.testing.expect(std.ascii.findIgnoreCase(hover.probe.text, "Pardes") != null); try std.testing.expect(p.look_hover_preview == null); try std.testing.expect(p.look_hover_wait == null); @@ -2188,7 +2188,7 @@ test "PDF native mouse selection, Look, and highlights share page geometry" { // search highlights without carrying an old selection into the result. p.update(.{ .mouse = .{ .button = config.look_button, .kind = .press, .col = word_col, .row = selected_row } }); p.update(.{ .mouse = .{ .button = config.look_button, .kind = .release, .col = word_col, .row = selected_row } }); - try std.testing.expect(std.ascii.indexOfIgnoreCase(pv.search_query, "Pardes") != null); + try std.testing.expect(std.ascii.findIgnoreCase(pv.search_query, "Pardes") != null); pv.resolveSearch(p.pdf_gpa); const highlights = (try panes.Pdf.buildHighlights( pv, diff --git a/test/pdf_scroll_bench.zig b/test/pdf_scroll_bench.zig index 166fa809..fdc42660 100644 --- a/test/pdf_scroll_bench.zig +++ b/test/pdf_scroll_bench.zig @@ -597,7 +597,7 @@ fn reportText(config: Config, travel: Travel, results: []const Result) void { "total_us", "rasters", "kept", "peak_kib", "visual", "transport", }); - std.debug.print("{s}\n", .{"-" ** 160}); + std.debug.print("{s}\n", .{&@as([160]u8, @splat('-'))}); for (results) |result| std.debug.print( "{s:<16} {d:>6} {d:>7} {d:>10} {d:>10} {d:>10} {d:>10} {d:>10} {d:>11} {d:>7} {d:>5} {d:>9} {x:0>16} {x:0>16}\n", .{ diff --git a/test/pdf_sections_bench.zig b/test/pdf_sections_bench.zig index 92c9ef7c..ee26e83d 100644 --- a/test/pdf_sections_bench.zig +++ b/test/pdf_sections_bench.zig @@ -454,7 +454,7 @@ fn reportText(config: Config, results: []const Result) void { std.debug.print("{s:<42} {s:>10} {s:>10} {s:>10} {s:>10} {s:>8} {s:>8} {s}\n", .{ "scenario", "min", "median", "p90", "max", "items", "bytes", "checksum", }); - std.debug.print("{s}\n", .{"-" ** 124}); + std.debug.print("{s}\n", .{&@as([124]u8, @splat('-'))}); for (results) |result| std.debug.print( "{s:<42} {d:>10} {d:>10} {d:>10} {d:>10} {d:>8} {d:>8} {x:0>16}\n", .{ diff --git a/test/perf-baseline-gui-Debug.json b/test/perf-baseline-gui-Debug.json deleted file mode 100644 index 39f5913c..00000000 --- a/test/perf-baseline-gui-Debug.json +++ /dev/null @@ -1 +0,0 @@ -{"harness":"303736f83a625e87","build":{"compiler":"0.16.0","target":"x86_64-linux.5.10...6.19-gnu.2.38","cpu":"x86_64","driver_optimize":"ReleaseFast","core_optimize":"Debug","c_optimize":"ReleaseFast","terminal_optimize":"ReleaseSafe","platform":"gui","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"quic":false,"theme_animation":true,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400},{"name":"esp32p4","lines":12,"cols":240,"bytes":2892}],"cells":[{"op":"open","fixture":"medium","min_us":1818,"med_us":2104,"p90_us":2287,"max_us":2293},{"op":"render","fixture":"medium","min_us":78,"med_us":82,"p90_us":87,"max_us":87},{"op":"key-down","fixture":"medium","min_us":79,"med_us":81,"p90_us":89,"max_us":109},{"op":"key-right","fixture":"medium","min_us":79,"med_us":84,"p90_us":85,"max_us":89},{"op":"page-down","fixture":"medium","min_us":79,"med_us":81,"p90_us":84,"max_us":87},{"op":"wheel","fixture":"medium","min_us":77,"med_us":78,"p90_us":82,"max_us":82},{"op":"edit-char","fixture":"medium","min_us":1019,"med_us":1349,"p90_us":1597,"max_us":1632},{"op":"edit-twin","fixture":"medium","min_us":2029,"med_us":2353,"p90_us":2455,"max_us":2676},{"op":"body-2m","fixture":"medium","min_us":5978,"med_us":9708,"p90_us":11361,"max_us":11666},{"op":"body-appends","fixture":"medium","min_us":117933,"med_us":211247,"p90_us":268014,"max_us":275006},{"op":"deep-sel","fixture":"medium","min_us":73,"med_us":75,"p90_us":80,"max_us":84}]} diff --git a/test/perf-baseline-gui-debug.json b/test/perf-baseline-gui-debug.json new file mode 100644 index 00000000..4b60520b --- /dev/null +++ b/test/perf-baseline-gui-debug.json @@ -0,0 +1 @@ +{"harness":"6cf9f4b8943e7e29","build":{"compiler":"0.17.0","target":"x86_64-linux.5.10...7.2-gnu.2.38","cpu":"x86_64","driver_optimize":"fast","core_optimize":"debug","c_optimize":"fast","terminal_optimize":"safe","platform":"gui","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"quic":false,"theme_animation":true,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400},{"name":"esp32p4","lines":12,"cols":240,"bytes":2892}],"cells":[{"op":"open","fixture":"medium","min_us":1732,"med_us":1881,"p90_us":2035,"max_us":2072},{"op":"render","fixture":"medium","min_us":89,"med_us":92,"p90_us":101,"max_us":102},{"op":"key-down","fixture":"medium","min_us":92,"med_us":94,"p90_us":100,"max_us":100},{"op":"key-right","fixture":"medium","min_us":91,"med_us":93,"p90_us":105,"max_us":109},{"op":"page-down","fixture":"medium","min_us":91,"med_us":95,"p90_us":99,"max_us":106},{"op":"wheel","fixture":"medium","min_us":90,"med_us":95,"p90_us":101,"max_us":101},{"op":"edit-char","fixture":"medium","min_us":1226,"med_us":1678,"p90_us":2093,"max_us":2323},{"op":"edit-twin","fixture":"medium","min_us":2275,"med_us":2697,"p90_us":2868,"max_us":2920},{"op":"body-2m","fixture":"medium","min_us":5213,"med_us":11333,"p90_us":18974,"max_us":18999},{"op":"body-appends","fixture":"medium","min_us":175012,"med_us":260087,"p90_us":317184,"max_us":317469},{"op":"deep-sel","fixture":"medium","min_us":83,"med_us":85,"p90_us":86,"max_us":98}]} diff --git a/test/perf-baseline-tty-Debug.json b/test/perf-baseline-tty-Debug.json deleted file mode 100644 index 9110398c..00000000 --- a/test/perf-baseline-tty-Debug.json +++ /dev/null @@ -1 +0,0 @@ -{"harness":"303736f83a625e87","build":{"compiler":"0.16.0","target":"x86_64-linux.5.10...6.19-gnu.2.38","cpu":"x86_64","driver_optimize":"ReleaseFast","core_optimize":"Debug","c_optimize":"ReleaseFast","terminal_optimize":"ReleaseSafe","platform":"tty","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"quic":false,"theme_animation":true,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400},{"name":"esp32p4","lines":12,"cols":240,"bytes":2892}],"cells":[{"op":"open","fixture":"medium","min_us":1881,"med_us":2148,"p90_us":2324,"max_us":2644},{"op":"render","fixture":"medium","min_us":79,"med_us":87,"p90_us":90,"max_us":93},{"op":"key-down","fixture":"medium","min_us":81,"med_us":84,"p90_us":86,"max_us":90},{"op":"key-right","fixture":"medium","min_us":80,"med_us":85,"p90_us":89,"max_us":102},{"op":"page-down","fixture":"medium","min_us":85,"med_us":86,"p90_us":88,"max_us":88},{"op":"wheel","fixture":"medium","min_us":79,"med_us":85,"p90_us":90,"max_us":91},{"op":"edit-char","fixture":"medium","min_us":1037,"med_us":1300,"p90_us":1639,"max_us":1647},{"op":"edit-twin","fixture":"medium","min_us":2046,"med_us":2378,"p90_us":2529,"max_us":2585},{"op":"body-2m","fixture":"medium","min_us":5790,"med_us":9510,"p90_us":12226,"max_us":12462},{"op":"body-appends","fixture":"medium","min_us":132421,"med_us":224849,"p90_us":257368,"max_us":274890},{"op":"deep-sel","fixture":"medium","min_us":75,"med_us":80,"p90_us":84,"max_us":86}]} diff --git a/test/perf-baseline-tty-ReleaseFast.json b/test/perf-baseline-tty-ReleaseFast.json deleted file mode 100644 index 4cbc8b95..00000000 --- a/test/perf-baseline-tty-ReleaseFast.json +++ /dev/null @@ -1 +0,0 @@ -{"harness":"303736f83a625e87","build":{"compiler":"0.16.0","target":"x86_64-linux.5.10...6.19-gnu.2.38","cpu":"x86_64","driver_optimize":"ReleaseFast","core_optimize":"ReleaseFast","c_optimize":"ReleaseFast","terminal_optimize":"ReleaseFast","platform":"tty","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"quic":false,"theme_animation":true,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400},{"name":"esp32p4","lines":12,"cols":240,"bytes":2892}],"cells":[{"op":"open","fixture":"medium","min_us":1775,"med_us":1995,"p90_us":2092,"max_us":2094},{"op":"render","fixture":"medium","min_us":80,"med_us":86,"p90_us":89,"max_us":95},{"op":"key-down","fixture":"medium","min_us":81,"med_us":83,"p90_us":95,"max_us":101},{"op":"key-right","fixture":"medium","min_us":79,"med_us":84,"p90_us":85,"max_us":98},{"op":"page-down","fixture":"medium","min_us":80,"med_us":82,"p90_us":96,"max_us":97},{"op":"wheel","fixture":"medium","min_us":78,"med_us":80,"p90_us":87,"max_us":88},{"op":"edit-char","fixture":"medium","min_us":1036,"med_us":1377,"p90_us":1602,"max_us":1621},{"op":"edit-twin","fixture":"medium","min_us":2266,"med_us":2715,"p90_us":3695,"max_us":3927},{"op":"body-2m","fixture":"medium","min_us":4739,"med_us":8675,"p90_us":11518,"max_us":13657},{"op":"body-appends","fixture":"medium","min_us":111613,"med_us":214959,"p90_us":264859,"max_us":283506},{"op":"deep-sel","fixture":"medium","min_us":74,"med_us":76,"p90_us":89,"max_us":96}]} diff --git a/test/perf-baseline-tty-debug.json b/test/perf-baseline-tty-debug.json new file mode 100644 index 00000000..a01335bd --- /dev/null +++ b/test/perf-baseline-tty-debug.json @@ -0,0 +1 @@ +{"harness":"6cf9f4b8943e7e29","build":{"compiler":"0.17.0","target":"x86_64-linux.5.10...7.2-gnu.2.38","cpu":"x86_64","driver_optimize":"fast","core_optimize":"debug","c_optimize":"fast","terminal_optimize":"safe","platform":"tty","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"quic":false,"theme_animation":true,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400},{"name":"esp32p4","lines":12,"cols":240,"bytes":2892}],"cells":[{"op":"open","fixture":"medium","min_us":2169,"med_us":2697,"p90_us":3126,"max_us":3207},{"op":"render","fixture":"medium","min_us":89,"med_us":96,"p90_us":101,"max_us":115},{"op":"key-down","fixture":"medium","min_us":93,"med_us":98,"p90_us":104,"max_us":115},{"op":"key-right","fixture":"medium","min_us":96,"med_us":97,"p90_us":102,"max_us":108},{"op":"page-down","fixture":"medium","min_us":96,"med_us":98,"p90_us":102,"max_us":103},{"op":"wheel","fixture":"medium","min_us":89,"med_us":100,"p90_us":128,"max_us":168},{"op":"edit-char","fixture":"medium","min_us":1821,"med_us":2274,"p90_us":2404,"max_us":2610},{"op":"edit-twin","fixture":"medium","min_us":2710,"med_us":3180,"p90_us":3413,"max_us":3636},{"op":"body-2m","fixture":"medium","min_us":9090,"med_us":14438,"p90_us":18158,"max_us":22063},{"op":"body-appends","fixture":"medium","min_us":241367,"med_us":375874,"p90_us":470623,"max_us":528094},{"op":"deep-sel","fixture":"medium","min_us":88,"med_us":89,"p90_us":90,"max_us":90}]} diff --git a/test/perf-baseline-tty-fast.json b/test/perf-baseline-tty-fast.json new file mode 100644 index 00000000..04fc88d3 --- /dev/null +++ b/test/perf-baseline-tty-fast.json @@ -0,0 +1 @@ +{"harness":"6cf9f4b8943e7e29","build":{"compiler":"0.17.0","target":"x86_64-linux.5.10...7.2-gnu.2.38","cpu":"x86_64","driver_optimize":"fast","core_optimize":"fast","c_optimize":"fast","terminal_optimize":"fast","platform":"tty","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"quic":false,"theme_animation":true,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400},{"name":"esp32p4","lines":12,"cols":240,"bytes":2892}],"cells":[{"op":"open","fixture":"medium","min_us":1695,"med_us":2024,"p90_us":2180,"max_us":2292},{"op":"render","fixture":"medium","min_us":79,"med_us":82,"p90_us":92,"max_us":94},{"op":"key-down","fixture":"medium","min_us":81,"med_us":82,"p90_us":83,"max_us":84},{"op":"key-right","fixture":"medium","min_us":80,"med_us":82,"p90_us":91,"max_us":91},{"op":"page-down","fixture":"medium","min_us":81,"med_us":84,"p90_us":90,"max_us":171},{"op":"wheel","fixture":"medium","min_us":79,"med_us":80,"p90_us":90,"max_us":101},{"op":"edit-char","fixture":"medium","min_us":1332,"med_us":1691,"p90_us":1967,"max_us":1987},{"op":"edit-twin","fixture":"medium","min_us":2160,"med_us":2457,"p90_us":2718,"max_us":2757},{"op":"body-2m","fixture":"medium","min_us":5047,"med_us":13525,"p90_us":16257,"max_us":20323},{"op":"body-appends","fixture":"medium","min_us":155834,"med_us":261597,"p90_us":329936,"max_us":333538},{"op":"deep-sel","fixture":"medium","min_us":75,"med_us":76,"p90_us":84,"max_us":96}]} diff --git a/test/perf.zig b/test/perf.zig index c9235954..d01d1bb5 100644 --- a/test/perf.zig +++ b/test/perf.zig @@ -1054,7 +1054,7 @@ fn measureTerminalSession(io: std.Io, mib: usize, reps: usize, json: bool) !void .undo_output = undo_output, .history_rows = state.vt.screens.active.pages.scrollbar().total, .history_bytes = state.vt.screens.active.pages.page_size, - .history_limit_bytes = state.vt.screens.active.pages.maxSize(), + .history_limit_bytes = state.vt.screens.active.pages.limits.max(.bytes), .row_count_decreases = row_count_decreases, .allocator_calls = counter.calls, .allocator_live_after_output = live_after_output, @@ -1385,7 +1385,7 @@ fn reportText( for (fixtures) |fx| { if (base != null) o(" {s:>19}", .{fx.name}) else o(" {s:>12}", .{fx.name}); } - o("\n{s}\n", .{if (base != null) "-" ** (12 + fixtures.len * 20) else "-" ** (12 + fixtures.len * 13)}); + o("\n{s}\n", .{if (base != null) &@as([12 + fixtures.len * 20]u8, @splat('-')) else &@as([12 + fixtures.len * 13]u8, @splat('-'))}); var worst_jitter: f64 = 0; for (std.enums.values(Op), 0..) |op, oi| { o("{s:<12}", .{op.label()}); @@ -1412,7 +1412,7 @@ fn reportText( for (term_fixtures) |fx| { if (base != null) o(" {s:>19}", .{fx.name}) else o(" {s:>12}", .{fx.name}); } - o("\n{s}\n", .{if (base != null) "-" ** (12 + term_fixtures.len * 20) else "-" ** (12 + term_fixtures.len * 13)}); + o("\n{s}\n", .{if (base != null) &@as([12 + term_fixtures.len * 20]u8, @splat('-')) else &@as([12 + term_fixtures.len * 13]u8, @splat('-'))}); for (std.enums.values(TermOp), 0..) |op, oi| { o("{s:<12}", .{op.label()}); for (0..term_fixtures.len) |fi| { @@ -1524,10 +1524,11 @@ fn parseBase(src: []const u8, opts: Options, bytes: *const [fixtures.len]usize) defer parsed.deinit(); const report = parsed.value; if (!std.mem.eql(u8, report.harness, harness_id)) return error.BaselineHarnessMismatch; - inline for (std.meta.fields(BuildIdentity)) |field| { - const before = @field(report.build, field.name); - const after = @field(build_identity, field.name); - const same = if (field.type == []const u8) std.mem.eql(u8, before, after) else before == after; + const info = @typeInfo(BuildIdentity).@"struct"; + inline for (info.field_names, info.field_types) |name, T| { + const before = @field(report.build, name); + const after = @field(build_identity, name); + const same = if (T == []const u8) std.mem.eql(u8, before, after) else before == after; if (!same) return error.BaselineBuildMismatch; } if (report.cols != opts.cols or report.rows != opts.rows or report.reps != opts.reps or diff --git a/test/snapshot.zig b/test/snapshot.zig index 5522fbb9..2d8a8664 100644 --- a/test/snapshot.zig +++ b/test/snapshot.zig @@ -157,8 +157,8 @@ pub fn main(init: std.process.Init) !void { script_i += 1; } if (exe == null) fatal("usage: pardes-snap [scripts...] [--update] [--jobs=N]", .{}); - const exe_z = try arena.dupeZ(u8, exe.?); - lspmock_bin = if (lspmock) |p| try arena.dupeZ(u8, p) else null; + const exe_z = try arena.dupeSentinel(u8, exe.?, 0); + lspmock_bin = if (lspmock) |p| try arena.dupeSentinel(u8, p, 0) else null; if (scripts.len == 0) { scripts = try listSnaps(arena, try absPath(arena, orig_cwd, "test/snapshots")); @@ -443,7 +443,7 @@ fn runBatch( fn runOne(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const u8, update: bool) u8 { if (careful) beCareful(); const stem = std.fs.path.stem(script_path); - const report_z = arena.dupeZ(u8, reportPath(arena, script_path) catch return 1) catch return 1; + const report_z = arena.dupeSentinel(u8, reportPath(arena, script_path) catch return 1, 0) catch return 1; const fd = libc.open(report_z, .{ .ACCMODE = .WRONLY, .CREAT = true, .TRUNC = true }, @as(libc.mode_t, 0o644)); if (fd >= 0) { _ = libc.dup2(fd, 1); @@ -457,7 +457,7 @@ fn runOne(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const u8 // dirty to every manual `cmp` audit. Unlink only this script's exact path // before it starts; a new mismatch below writes it back. const actual_path = std.fmt.allocPrint(arena, "{s}.actual", .{base_path}) catch return 1; - const actual_path_z = arena.dupeZ(u8, actual_path) catch return 1; + const actual_path_z = arena.dupeSentinel(u8, actual_path, 0) catch return 1; if (record_dir == null) _ = libc.unlink(actual_path_z); const golden: ?[]u8 = if (record_dir == null) readFileAlloc(arena, golden_path) catch null else null; const started = eh.nowMs(); @@ -473,7 +473,7 @@ fn runOne(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const u8 return 0; } if (update) { - eh.writeFile(arena.dupeZ(u8, golden_path) catch return 1, out) catch return 1; + eh.writeFile(arena.dupeSentinel(u8, golden_path, 0) catch return 1, out) catch return 1; std.debug.print("UPDATED {s} ({d} bytes)\n", .{ stem, out.len }); return 0; } @@ -485,7 +485,7 @@ fn runOne(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const u8 std.debug.print("PASS {s} ({d}ms)\n", .{ stem, took }); return 0; } - eh.writeFile(arena.dupeZ(u8, actual_path) catch return 1, out) catch |err| { + eh.writeFile(arena.dupeSentinel(u8, actual_path, 0) catch return 1, out) catch |err| { std.debug.print("FAIL {s}: differs from golden; cannot write {s}: {s} ({d}ms)\n", .{ stem, actual_path, @errorName(err), took }); printFirstDiff(golden.?, out); return 1; @@ -557,7 +557,7 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const try mkdir(arena, work, false); // deterministic shell: fixed prompt, no history, no user rc leakage try eh.writeFile(try std.fmt.allocPrintSentinel(arena, "{s}/.bashrc", .{home}, 0), "PS1='$ '\nHISTFILE=\n"); - _ = setenv("HOME", try arena.dupeZ(u8, home), 1); + _ = setenv("HOME", try arena.dupeSentinel(u8, home, 0), 1); // Keep startup configuration hermetic even when the developer exports an // XDG directory that points outside this per-snapshot fake home. const config_home = try std.fmt.allocPrintSentinel(arena, "{s}/.config", .{home}, 0); @@ -602,8 +602,8 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const // take turns — which cost more wall clock than the other 51 scripts put // together. Scripts name it `$DUMP`. const dump_path = try std.fmt.allocPrint(arena, "{s}/dump.zon", .{base}); - _ = setenv("PARDES_DUMP", try arena.dupeZ(u8, dump_path), 1); - if (chdirRc(try arena.dupeZ(u8, work)) < 0) return error.ChdirFailed; + _ = setenv("PARDES_DUMP", try arena.dupeSentinel(u8, dump_path, 0), 1); + if (chdirRc(try arena.dupeSentinel(u8, work, 0)) < 0) return error.ChdirFailed; const chunks = try arena.alloc([]const u8, countCaptures(src)); var chunk_len: usize = 0; @@ -636,7 +636,7 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const try eh.appendFile(try std.fmt.allocPrintSentinel(arena, "{s}/pardes/init", .{config_home}, 0), setting); } else if (std.mem.eql(u8, cmd, "file")) { const name = tok.next() orelse return error.BadScript; - try eh.writeFile(try arena.dupeZ(u8, name), try unescape(arena, tok.rest())); + try eh.writeFile(try arena.dupeSentinel(u8, name, 0), try unescape(arena, tok.rest())); } else if (std.mem.eql(u8, cmd, "lines")) { const name = tok.next() orelse return error.BadScript; const n = try std.fmt.parseInt(usize, tok.next() orelse return error.BadScript, 10); @@ -646,7 +646,7 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const // scroll test needs and `file` can only give as one huge script line const tail = tok.rest(); const buf = try numberedLines(arena, n, tail); - try eh.writeFile(try arena.dupeZ(u8, name), buf); + try eh.writeFile(try arena.dupeSentinel(u8, name, 0), buf); } else if (std.mem.eql(u8, cmd, "ppmdiag")) { // The diagonal-split test PPM from the old e2e (white over blue), // grown to 512x512 with the white half filled by a fixed LCG @@ -658,7 +658,7 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const // down to flat color and a block always wins). const name = tok.next() orelse return error.BadScript; const ppm = try ppmDiag(arena); - try eh.writeFile(try arena.dupeZ(u8, name), ppm); + try eh.writeFile(try arena.dupeSentinel(u8, name, 0), ppm); } else if (std.mem.eql(u8, cmd, "dirmk")) { try mkdir(arena, tok.next() orelse return error.BadScript, false); } else if (std.mem.eql(u8, cmd, "run")) { @@ -668,7 +668,7 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const // different inotify event. This runs in the script's cwd, as a // child of the RUNNER, so nothing it does reaches the app's ptys: // whatever the app then shows, it woke up for by itself. - if (system(try arena.dupeZ(u8, tok.rest())) != 0) return error.RunFailed; + if (system(try arena.dupeSentinel(u8, tok.rest(), 0)) != 0) return error.RunFailed; } else if (std.mem.eql(u8, cmd, "start")) { const rows = try std.fmt.parseInt(u16, tok.next() orelse return error.BadScript, 10); const cols = try std.fmt.parseInt(u16, tok.next() orelse return error.BadScript, 10); @@ -676,7 +676,7 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const var nextra: usize = 0; while (tok.next()) |a| : (nextra += 1) { if (nextra >= extra.len) return error.BadScript; - extra[nextra] = (try arena.dupeZ(u8, a)).ptr; + extra[nextra] = (try arena.dupeSentinel(u8, a, 0)).ptr; } if (h) |*hp| hp.deinit(); // scripts may restart (e.g. dump then -l) // a new process is a new screen: capture it whole, or its first @@ -963,13 +963,13 @@ fn treeAsleep(root: libc.pid_t) bool { while (n > 0) { n -= 1; const pid = stack[n]; - const dir_path = std.fmt.bufPrintZ(&path_buf, "/proc/{d}/task", .{pid}) catch continue; + const dir_path = std.fmt.bufPrintSentinel(&path_buf, "/proc/{d}/task", .{pid}, 0) catch continue; const dir = libc.opendir(dir_path) orelse continue; // exited between steps defer _ = libc.closedir(dir); while (libc.readdir(dir)) |d| { const tid = std.mem.sliceTo(@as([*:0]const u8, @ptrCast(&d.name)), 0); if (tid[0] == '.') continue; - const stat = readProc(&buf, std.fmt.bufPrintZ(&path_buf, "/proc/{d}/task/{s}/stat", .{ pid, tid }) catch continue) orelse continue; + const stat = readProc(&buf, std.fmt.bufPrintSentinel(&path_buf, "/proc/{d}/task/{s}/stat", .{ pid, tid }, 0) catch continue) orelse continue; // "pid (comm) S ..." — comm can hold spaces and parens, so the // state is the char two past the LAST ')' const close = std.mem.lastIndexOfScalar(u8, stat, ')') orelse continue; @@ -983,7 +983,7 @@ fn treeAsleep(root: libc.pid_t) bool { 'R', 'D', 'Z' => return false, else => {}, } - const kids = readProc(&buf, std.fmt.bufPrintZ(&path_buf, "/proc/{d}/task/{s}/children", .{ pid, tid }) catch continue) orelse continue; + const kids = readProc(&buf, std.fmt.bufPrintSentinel(&path_buf, "/proc/{d}/task/{s}/children", .{ pid, tid }, 0) catch continue) orelse continue; var it = std.mem.tokenizeAny(u8, kids, " \n"); while (it.next()) |k| { if (n >= stack.len) return false; // deeper than we can walk: assume busy @@ -1554,7 +1554,7 @@ fn absPath(arena: std.mem.Allocator, cwd: []const u8, p: []const u8) ![]const u8 } fn listSnaps(arena: std.mem.Allocator, dir_path: []const u8) ![][]const u8 { - const dir_z = try arena.dupeZ(u8, dir_path); + const dir_z = try arena.dupeSentinel(u8, dir_path, 0); const count = countSnapEntries(dir_z, dir_path); const scripts = try arena.alloc([]const u8, count); const dir = libc.opendir(dir_z) orelse fatal("no snapshots/ dir at {s}", .{dir_path}); @@ -1583,7 +1583,7 @@ fn countSnapEntries(dir_z: [:0]const u8, dir_path: []const u8) usize { } fn readFileAlloc(arena: std.mem.Allocator, path: []const u8) ![]u8 { - const path_z = try arena.dupeZ(u8, path); + const path_z = try arena.dupeSentinel(u8, path, 0); const fd = libc.open(path_z, .{ .ACCMODE = .RDONLY }); if (fd < 0) return error.OpenFailed; defer _ = libc.close(fd); @@ -1611,7 +1611,7 @@ fn readFileAlloc(arena: std.mem.Allocator, path: []const u8) ![]u8 { } fn mkdir(arena: std.mem.Allocator, path: []const u8, exist_ok: bool) !void { - const path_z = try arena.dupeZ(u8, path); + const path_z = try arena.dupeSentinel(u8, path, 0); const rc = libc.mkdir(path_z, 0o755); if (rc != 0) { if (exist_ok and libc.errno(rc) == .EXIST) return; diff --git a/test/snapshots/exec.golden b/test/snapshots/exec.golden index df49336c..30473c9e 100644 --- a/test/snapshots/exec.golden +++ b/test/snapshots/exec.golden @@ -22,15 +22,17 @@ == snap kept grid=140x31 cursor=6,3 |3: ZZARG ls |4: ./c.sh e.txt +|8: |9: == snap chord grid=140x31 cursor=6,3 |3: ZZARG Exec ls -|9: CHORDARG:ZZARG +|5: ./c.sh ZZARG +|6: CHORDARG:ZZARG == snap deleted grid=140x31 cursor=4,5 |3: ls ls |4: e.txt e.txt -|8: -|9: +|5: +|6: |17: |18: |19: diff --git a/test/snapshots/tinywin.golden b/test/snapshots/tinywin.golden deleted file mode 100644 index 787a9d8f..00000000 --- a/test/snapshots/tinywin.golden +++ /dev/null @@ -1,83 +0,0 @@ -== snap stacked grid=100x31 cursor=14,3 -| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -|$ /tmp/pardes-snap/tinywin/cwd Tty+bash Save Mode Filter Collapse Del -| $ :^[n^[n^[n -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| /tmp/pardes-snap/tinywin/cwd/+New Save Tty Collapse Del -| 1 -== snap shrunk grid=60x4 cursor=59,3 -| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes -| New Tty Find Grep Joincol Delcol -|$ /tmp/pardes-snap/tinywin/cwd Tty+bash Save Mode Filter Col -| /tmp/pardes-snap/tinywin/cwd/+New Save Tty Collapse Del -== snap columns grid=100x31 cursor=23,3 -| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -|$ /tmp/pardes-snap/tinywin/cwd Tty+bash Save Mode Filter Collapse Del -| $ :^[n^[n^[n cn cn cn -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| /tmp/pardes-snap/tinywin/cwd/+New Save Tty Collapse Del -| 1 -== snap narrow grid=4x31 cursor=2,20 -| Ne -| Ne -|$ /t -| mp -| /p -| ar -| de -| s- -| sn -| ap -| $ -| ^[ -| n^ -| [n -| ^[ -| n -| cn -| c -| n -| cn -| -| /t -| mp -| /p -| ar -| de -| s- -| sn -| ap diff --git a/test/snapshots/tinywin.snap b/test/snapshots/tinywin.snap deleted file mode 100644 index 3d22d583..00000000 --- a/test/snapshots/tinywin.snap +++ /dev/null @@ -1,31 +0,0 @@ -# Shrinking the window past "one row per pane" used to panic: computeGeom gave -# every pane in a column at least one row, so `y` walked off the bottom and -# renderPane got a rect outside the surface (assert). Panes that no longer fit -# now get h = 0 and simply do not render until the window grows back. -start 31 100 -wait 8000 $ -key a-n -stable 400 8000 -key a-n -stable 400 8000 -key a-n -stable 400 8000 -key a-n -stable 700 15000 -snap stacked -resize 4 60 -stable 700 10000 -snap shrunk -# ...and the same sideways: more columns than the window is wide -resize 31 100 -stable 700 10000 -key space c n -stable 600 8000 -key space c n -stable 600 8000 -key space c n -stable 700 15000 -snap columns -resize 31 4 -stable 700 10000 -snap narrow diff --git a/test/unit_profile_test.zig b/test/unit_profile_test.zig index 721f1212..a4cdd09e 100644 --- a/test/unit_profile_test.zig +++ b/test/unit_profile_test.zig @@ -149,11 +149,8 @@ fn fixture(init: std.process.Init) !void { var write_buffer: [1024]u8 = undefined; var reader = std.Io.File.stdin().readerStreaming(io, &read_buffer); var writer = std.Io.File.stdout().writerStreaming(io, &write_buffer); - var server = try std.zig.Server.init(.{ - .in = &reader.interface, - .out = &writer.interface, - .zig_version = if (std.mem.eql(u8, mode, "version")) "wrong-version" else builtin.zig_version_string, - }); + var server: std.zig.Server = .{ .in = &reader.interface, .out = &writer.interface }; + try server.serveStringMessage(.zig_version, if (std.mem.eql(u8, mode, "version")) "wrong-version" else builtin.zig_version_string); while (true) { const request = try server.receiveMessage(); switch (request.tag) { diff --git a/tools/gen_themes.zig b/tools/gen_themes.zig index 65e85d1c..be5fde2f 100644 --- a/tools/gen_themes.zig +++ b/tools/gen_themes.zig @@ -152,13 +152,14 @@ fn byName(_: void, a: Theme, b: Theme) bool { fn emit(w: *std.Io.Writer, t: Theme) !void { try w.writeAll("// Generated by tools/gen_themes.zig. Do not edit.\npub const theme = .{\n"); try w.print(" .name = \"{s}\",\n", .{t.name}); - inline for (@typeInfo(Theme).@"struct".fields) |f| { - if (comptime std.mem.eql(u8, f.name, "name")) continue; - if (comptime std.mem.eql(u8, f.name, "palette")) continue; - try w.print(" .{s} = ", .{f.name}); - if (comptime @typeInfo(f.type) == .optional) { - if (@field(t, f.name)) |c| try rgb(w, c) else try w.writeAll("null"); - } else try rgb(w, @field(t, f.name)); + const info = @typeInfo(Theme).@"struct"; + inline for (info.field_names, info.field_types) |name, T| { + if (comptime std.mem.eql(u8, name, "name")) continue; + if (comptime std.mem.eql(u8, name, "palette")) continue; + try w.print(" .{s} = ", .{name}); + if (comptime @typeInfo(T) == .optional) { + if (@field(t, name)) |c| try rgb(w, c) else try w.writeAll("null"); + } else try rgb(w, @field(t, name)); try w.writeAll(",\n"); } if (t.palette) |p| { -- cgit v1.3 From b250eb6135475699a945324c005890e8e1b4dd0b Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 28 Oct 2026 21:03:48 -0300 Subject: kitty graphics conformance for terminal panes: a core suite (test/kitty.zig, `zig build kitty-test`, in unit-test) and an end-to-end harness (`zig build kitty-harness`, tty and gui); four gaps it found fixed, one left The core suite feeds a pane's output as pty reads do and checks what the program reads back, ghostty's image storage and the ImagePlaces a frame draws: queries and their errors, q=0/1/2, f=24/32/100 and o=z, chunked m=1 split at every read size, t=f/t=t/t=s, a=T and C=1 cursor movement, a=p by placement id with source rects and re-puts, image numbers, every d= delete (a/A i/I n/N c/C p/P q/Q x/X y/Y z/Z r/R) and a delete abandoning a chunked load, Unicode placeholders over two rows with implicit columns and a placement named in the underline colour, scroll/resize/reflow, the alternate screen, clear (ED 2 + ED 3), replies per pane and never in the cells, many replies from one read, kitty before DA, CAN/SUB, an oversized image, 300 images against the storage limit, animations and relative placements. The harness runs test/kitty_client.zig in a pane's bash (query, a 16-chunk 8x4-cell place, the three media, quiet levels, CAN, show then delete) and kitten icat (stream and detect) and chafa when installed. Outside, the tty arm is a kitty terminal (a ghostty-vt emulator): the image pardes re-emits lands at the cell after ANCHOR>, 8x4 cells a row at a time, the client's own commands and replies never pass through, and d=I frees what was sent. The gui arm reads the GPU capture. Fixed: kitty file, temporary-file and shared-memory media (libghostty defaults to direct only; now allWithTempDir like ghostty and kitty); replies past 256 bytes of one read were cut mid-sequence (4 KiB now, an answer that does not fit dropped whole and counted); animations never played (TerminalImages draws renderData(), ticks ImageStorage.animationTick on the core clock, nextWake wakes for the next frame); relative placements (P=/Q=/H=/V=) were not drawn (resolveChain, as ghostty's renderer). image.decode no longer jumps through stb_image's null allocator before image.start. Known gap (a knownGap test): no z-index; every image is drawn over the cells in storage order. Co-Authored-By: Claude Opus 5.5 --- build.zig | 56 ++++ docs/typ/building.typ | 4 + src/CHANGELOG.md | 10 + src/TerminalImages.zig | 35 ++- src/image.zig | 3 + src/pardes.zig | 10 + src/terminal.zig | 45 ++- test/kitty.zig | 778 +++++++++++++++++++++++++++++++++++++++++++++++++ test/kitty_client.zig | 150 ++++++++++ test/kitty_harness.zig | 463 +++++++++++++++++++++++++++++ 10 files changed, 1543 insertions(+), 11 deletions(-) create mode 100644 test/kitty.zig create mode 100644 test/kitty_client.zig create mode 100644 test/kitty_harness.zig (limited to 'src/TerminalImages.zig') diff --git a/build.zig b/build.zig index ca7b26af..93114103 100644 --- a/build.zig +++ b/build.zig @@ -1316,6 +1316,40 @@ pub fn build(b: *std.Build) void { run_image_harness.has_side_effects = true; b.step("image-harness", "exercise native Kitty/SDL image rendering end to end").dependOn(&run_image_harness.step); + // Kitty graphics through a terminal pane, end to end: a client in + // the pane's bash (and kitten icat, chafa when installed), a kitty + // terminal outside (tty) or the GPU capture (gui). test/kitty.zig + // is the same protocol at the core. + const kitty_client = b.addExecutable(.{ + .name = "pardes-kitty-client", + .root_module = b.createModule(.{ + .target = target, + .optimize = optimize, + .root_source_file = b.path("test/kitty_client.zig"), + .link_libc = true, + }), + }); + const kitty_harness = b.addExecutable(.{ + .name = "pardes-kitty-harness", + .root_module = b.createModule(.{ + .target = target, + .optimize = optimize, + .root_source_file = b.path("test/kitty_harness.zig"), + .link_libc = true, + }), + }); + if (ghostty_vt_for_snap) |vt| kitty_harness.root_module.addImport("ghostty-vt", vt); + switch (target.result.os.tag) { + .freebsd, .netbsd, .openbsd => kitty_harness.root_module.linkSystemLibrary("util", .{}), + else => {}, + } + const run_kitty_harness = b.addRunArtifact(kitty_harness); + run_kitty_harness.addArtifactArg(exe); + run_kitty_harness.addArtifactArg(kitty_client); + run_kitty_harness.addArg(if (platform == .gui) "gui" else "tty"); + run_kitty_harness.has_side_effects = true; + b.step("kitty-harness", "kitty graphics through a terminal pane end to end (a client inside, a kitty terminal or the GPU capture outside)").dependOn(&run_kitty_harness.step); + const pdf_harness_step = b.step("pdf-harness", "exercise continuous PDF rendering, search, and sections navigation end to end"); if (enable_mupdf) { const run_pdf_harness = b.addRunArtifact(image_harness); @@ -1694,6 +1728,28 @@ pub fn build(b: *std.Build) void { pane_test_step.dependOn(&run_pane_tests.step); if (testMatch(b, unit_profile, test_filters, pane_test_step)) |check| check.addArtifactArg(pane_tests); + // Kitty graphics conformance at the core: what a terminal pane's + // program sends, what it reads back, what ghostty stores and what a + // frame draws (test/kitty.zig). The end-to-end arm, through a real + // pty and the shell's output, is the kitty-harness step. + const kitty_module = b.createModule(.{ + .target = target, + .optimize = optimize, + .root_source_file = b.path("test/kitty.zig"), + .link_libc = true, + }); + kitty_module.addImport("pardes", core_module); + const kitty_tests = b.addTest(.{ .root_module = kitty_module, .filters = test_filters }); + if (test_nonce) |nonce| kitty_tests.root_module.addImport("test_rebuild_nonce", nonce); + test_build.dependOn(&kitty_tests.step); + const run_kitty_tests = b.addRunArtifact(kitty_tests); + run_kitty_tests.has_side_effects = true; + unit_step.dependOn(&run_kitty_tests.step); + if (unit_match) |check| check.addArtifactArg(kitty_tests); + const kitty_test_step = b.step("kitty-test", "run the kitty graphics conformance cases for terminal panes"); + kitty_test_step.dependOn(&run_kitty_tests.step); + if (testMatch(b, unit_profile, test_filters, kitty_test_step)) |check| check.addArtifactArg(kitty_tests); + // Keep native transport integration reachable even when the core's // anonymous test-import block is filtered out by Zig. const ninep_io_module = b.createModule(.{ diff --git a/docs/typ/building.typ b/docs/typ/building.typ index 8d7524f9..d551c251 100644 --- a/docs/typ/building.typ +++ b/docs/typ/building.typ @@ -72,6 +72,10 @@ zig build unit-test module and shell unit tests (the perf gate runs with zig build test-build compile the unit-test programs without running them zig build core-test core tests without native shell tests zig build pane-test pane, output, PDF and namespace integration tests +zig build kitty-test kitty graphics conformance of terminal panes, at the core +zig build kitty-harness kitty graphics through a pane end to end (a fake kitty + terminal outside on the tty, the GPU capture on the gui; + kitten icat and chafa too when installed) zig build syntax-test tree-sitter tests without building the editor zig build syntax deterministic per-byte highlighting snapshots zig build fs-test real sessions and mounts over 9P (with a short 9P monkey) diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index 2144f710..7aab597d 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -2,6 +2,16 @@ ## Unreleased +- Kitty graphics in a terminal pane take every medium kitty and ghostty + do: a file (`t=f`), a temporary file (`t=t`) and shared memory (`t=s`) + beside direct data, so `kitten icat` no longer falls back to base64 + through the pty. A program asking about many images in one write + hears every answer, where answers past 256 bytes of one read were cut + off mid-sequence (now 4 KiB, and an answer that does not fit is dropped + whole). Animations (`a=f`, `a=a`) play, frame by frame, where only the + first frame was drawn; and an image placed relative to another + (`P=`, `Q=`, `H=`, `V=`) is drawn beside it. `zig build kitty-test` and + `zig build kitty-harness` check the protocol through a terminal pane. - ghostty moves to its 1.4.0 release (from a main commit six days before it; libvaxis and uucode stay on the commits it pins). A terminal's `clear` (ED 3) now takes away the kitty images placed on the history it diff --git a/src/TerminalImages.zig b/src/TerminalImages.zig index 4140813f..f3333460 100644 --- a/src/TerminalImages.zig +++ b/src/TerminalImages.zig @@ -29,6 +29,9 @@ petscii: bool = false, converted: std.AutoHashMapUnmanaged(u32, Converted) = .empty, /// Glyph art for the fragments drawn as cells, kept while on screen. glyphs: std.AutoHashMapUnmanaged(GlyphKey, Glyphs) = .empty, +/// When the next frame of a playing animation (a=a) is due, in ms on the +/// core's clock (`Pardes.stepped_ns`): the core wakes for it (nextWake). +animation_due_ms: ?u64 = null, const Converted = struct { generation: u64, rgba: []u8, used: bool = true }; const Glyphs = struct { cells: []GlyphArt.Cell, used: bool = true }; @@ -147,6 +150,11 @@ pub fn draw( const screen = vt.screens.active; const storage = &screen.kitty_images; + // Animations step on the core's clock, as this frame shows them; the + // shown frame is `renderData()` (a new `generation` each step, which + // the caches key on). + const now_ms = p.stepped_ns / std.time.ns_per_ms; + ti.animation_due_ms = if (storage.animationTick(vt.io(), now_ms)) |delay| now_ms +| delay else null; const pages = &screen.pages; const top = pages.getTopLeft(.viewport); const bottom = pages.getBottomRight(.viewport) orelse return; @@ -187,10 +195,25 @@ pub fn draw( var it = storage.placements.iterator(); while (it.next()) |entry| { const placed = entry.value_ptr.*; + // A placement relative to another (P=/Q=) sits at its chain's root + // plus the chain's cell offsets (H=/V=), as ghostty's renderer puts it. + var dx: i64 = 0; + var dy: i64 = 0; const pin = switch (placed.location) { .pin => |pin| pin, - // ponytail: a placement relative to another (P=/Q=, new in ghostty) is not drawn; resolve its chain if a program needs it. - .virtual, .relative => continue, + .virtual => continue, + .relative => |rel| root: { + const chain = storage.resolveChain(rel) orelse continue; + dx = chain.horizontal_offset; + dy = chain.vertical_offset; + break :root switch (chain.root.location) { + .pin => |pin| pin, + // ponytail: a chain rooted on a virtual placement (shown + // through placeholders) is not drawn; ghostty anchors it at + // the placeholder run. + .virtual, .relative => continue, + }; + }, }; const img = storage.images.get(entry.key_ptr.image_id) orelse continue; const at = pages.pointFromPin(.screen, pin.*) orelse continue; @@ -201,8 +224,8 @@ pub fn draw( const sh = if (placed.source_height > 0) @min(placed.source_height, img.height - sy) else img.height - sy; if (size.width == 0 or size.height == 0 or sw == 0 or sh == 0) continue; ctx.place(img, .{ .x = sx, .y = sy, .w = sw, .h = sh }, .{ - .x = @as(i64, at.screen.x) * cw + placed.x_offset, - .y = (@as(i64, at.screen.y) - @as(i64, origin.screen.y)) * ch + placed.y_offset, + .x = (@as(i64, at.screen.x) + dx) * cw + placed.x_offset, + .y = (@as(i64, at.screen.y) - @as(i64, origin.screen.y) + dy) * ch + placed.y_offset, .w = size.width, .h = size.height, }); @@ -289,7 +312,7 @@ const Ctx = struct { fn pixelsOf(ti: *TerminalImages, gpa: std.mem.Allocator, img: gfx.Image) ?[]const u8 { const n = @as(usize, img.width) * img.height; if (n == 0) return null; - const data = img.data.bytes() orelse return null; + const data = img.renderData().bytes() orelse return null; if (img.format == .rgba) return if (data.len == n * 4) data else null; const gop = ti.converted.getOrPut(gpa, img.id) catch return null; if (gop.found_existing) { @@ -316,7 +339,7 @@ fn convert(gpa: std.mem.Allocator, img: gfx.Image, n: usize) ?[]u8 { .gray => 1, else => return null, }; - const data = img.data.bytes() orelse return null; + const data = img.renderData().bytes() orelse return null; if (data.len != n * depth) return null; const out = gpa.alloc(u8, n * 4) catch return null; for (0..n) |i| { diff --git a/src/image.zig b/src/image.zig index 19dbb9e4..5ceadd76 100644 --- a/src/image.zig +++ b/src/image.zig @@ -771,6 +771,9 @@ pub fn readable(bytes: []const u8) bool { const Decoded = struct { rgba: []u8, w: usize, h: usize }; pub fn decode(gpa: std.mem.Allocator, bytes: []const u8) ?Decoded { + // stb_image allocates through what `start` gave it: before that, a call + // jumps through a null pointer (a terminal's PNG in a core no shell set up). + if (!started) return null; if (bytes.len == 0 or bytes.len > std.math.maxInt(c_int)) return null; // Bounded before decoding: a few KB of PNG can name gigapixels. var iw: c_int = 0; diff --git a/src/pardes.zig b/src/pardes.zig index 3721cc32..c7ae6704 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -7813,6 +7813,16 @@ pub const Pardes = struct { const wait = @max(1, (pane.repl_enter_due_ns -| p.stepped_ns + animation.frame_ns - 1) / animation.frame_ns); frames = if (frames) |soonest| @min(soonest, wait) else wait; }; + // A terminal's kitty animation, at its next frame. Only a time still + // ahead counts: a pane not drawn keeps the last one it was given, + // and a past one would wake every frame for nothing. + if (comptime terminal_panes) for (p.panes) |slot| if (slot) |pane| if (panes.terminal.animationDueMs(pane)) |due_ms| { + const due = due_ms *| std.time.ns_per_ms; + if (due > p.stepped_ns) { + const wait = @max(1, (due - p.stepped_ns + animation.frame_ns - 1) / animation.frame_ns); + frames = if (frames) |soonest| @min(soonest, wait) else wait; + } + }; return if (frames) |n| p.stepped_ns + n * animation.frame_ns else null; } diff --git a/src/terminal.zig b/src/terminal.zig index 77ee9b44..ce41bd95 100644 --- a/src/terminal.zig +++ b/src/terminal.zig @@ -146,8 +146,14 @@ pub const MarkedHandler = if (enabled) struct { pub const State = struct { vt: VtSlot, stream: StreamSlot, - reply: [256]u8 = undefined, + /// The emulator's answers to its program (DSR, DA, kitty graphics, ...) + /// from one read of its output, written to its pty after it. Room for + /// a read's worth of kitty answers (yazi or `kitten icat` asking about + /// a batch of images in one write); an answer that does not fit whole + /// is dropped whole, never cut short (`reply_dropped` counts them). + reply: [4096]u8 = undefined, reply_len: u16 = 0, + reply_dropped: u32 = 0, /// The grid cell the program last heard the mouse at, so motion is /// reported once per cell. mouse_cell: if (enabled) ?ghostty_vt.Coordinate else void = if (enabled) null else {}, @@ -315,6 +321,16 @@ pub fn deinitPendingCommand(pane: *Pane) void { pane.pending_command = .{}; } +/// Where a kitty client puts its temporary files: `$TMPDIR`, else /tmp +/// (which ghostty accepts whatever this says). The environment block lives +/// as long as the process and pardes never edits it (ChildEnv.exportVar). +fn tempDir() []const u8 { + if (comptime !pardes.hosted) return "/tmp"; + const dir = std.c.getenv("TMPDIR") orelse return "/tmp"; + const path = std.mem.span(dir); + return if (path.len > 0 and path[0] == '/') path else "/tmp"; +} + pub fn terminalIo() std.Io { return if (comptime !pardes.hosted) std.Io.failing @@ -606,6 +622,13 @@ pub fn create(gpa: std.mem.Allocator, cols: u16, rows: u16) !*Pane { .rows = rows, .max_scrollback_bytes = 16 * 1024 * 1024, .kitty_image_storage_limit = if (images_enabled) TerminalImages.storage_limit else 0, + // Every kitty medium, as ghostty and kitty take them: a file (t=f), + // a temporary file it then deletes (t=t, in the temp directory and + // named as one) and shared memory (t=s), beside direct data. libghostty + // defaults to direct alone, which `kitten icat` and timg detect and + // fall back from, base64 through the pty. What the program can read + // it could send itself: it runs as the user, under pardes. + .kitty_image_loading_limits = if (images_enabled) .allWithTempDir(tempDir()) else .direct, }); state.stream = .init(.{ .handler = .{ .inner = state.vt.vtHandler() }, .allocator = gpa }); state.reply_len = 0; @@ -677,7 +700,6 @@ fn ingest(pane: *Pane, bytes: []const u8) void { pane.terminal.?.stream.nextSlice(bytes); } - test "replay ownership is terminal-only and construction rolls back on allocation failure" { const Case = struct { fn run(gpa: std.mem.Allocator, terminal: bool) !void { @@ -2808,9 +2830,14 @@ pub fn redo(p: *Pardes, pane: *Pane) void { pub fn ptyReport(handler: *ghostty_vt.TerminalStream.Handler, data: []const u8) void { const state: *State = @alignCast(@fieldParentPtr("vt", handler.terminal)); const room = state.reply.len - state.reply_len; - const n = @min(room, data.len); - @memcpy(state.reply[state.reply_len..][0..n], data[0..n]); - state.reply_len += @intCast(n); + // A cut answer is worse than none: the program would read the start of + // a sequence and wait, or misparse what follows. + if (data.len > room) { + state.reply_dropped +|= 1; + return; + } + @memcpy(state.reply[state.reply_len..][0..data.len], data); + state.reply_len += @intCast(data.len); } const DeviceAttrs = @typeInfo(@typeInfo(@typeInfo( @@ -2838,6 +2865,14 @@ fn syncPixels(p: *const Pardes, pane: *Pane) void { vt.height_px = @as(u32, vt.rows) * p.cell_pixels.h; } +/// When the pane's next kitty animation frame is due (ms on the core's +/// clock), as its last drawn frame left it; null when nothing plays. +pub fn animationDueMs(pane: *const Pane) ?u64 { + if (comptime !images_enabled) return null; + const state = pane.terminal orelse return null; + return state.images.animation_due_ms; +} + /// The Petscii builtin on a terminal: its kitty graphics as glyph art, /// or back to pixels where the shell draws pixels. pub fn togglePetscii(pane: *Pane) void { diff --git a/test/kitty.zig b/test/kitty.zig new file mode 100644 index 00000000..3f9776fa --- /dev/null +++ b/test/kitty.zig @@ -0,0 +1,778 @@ +//! Kitty graphics protocol conformance for terminal panes, at the core. +//! +//! zig build kitty-test -Dplatform=tty|gui these cases alone +//! zig build unit-test they run with the rest +//! +//! ghostty-vt implements the protocol; what pardes owns is the proxy around +//! it: a program's APC reaches the emulator whole however the pty splits it, +//! the emulator's replies go back to that program's pty (and nowhere else), +//! and what the emulator stores is drawn where the program put it. Each case +//! feeds a pane's output the way a pty read does and checks all three: the +//! bytes the program would read back, ghostty's image storage, and the +//! `ImagePlace`s a frame hands the shell (which a tty re-emits to the outer +//! terminal and the GUI draws; test/kitty_harness.zig follows them there). +//! +//! A case pardes does not pass yet is a `knownGap`: its check runs, the test +//! is skipped with the reason while it fails, and fails once it passes, so +//! the marker goes when the gap closes. +const std = @import("std"); +const pardes = @import("pardes"); +const Pardes = pardes.Pardes; +const config = pardes.config; +const terminal = pardes.panes.terminal; + +const gpa = std.testing.allocator; + +// 4x2 pixels, the left half red and the right half blue, in every encoding +// the protocol has (generated with Python's zlib and a hand-built PNG). +const rgb_b64 = "/wAA/wAAAAD/AAD//wAA/wAAAAD/AAD/"; +const rgba_b64 = "/wAA//8AAP8AAP//AAD///8AAP//AAD/AAD//wAA//8="; +const rgb_zlib_b64 = "eJz7z8Dwn4EBTPz/j8QGAGO0B/k="; +const png_b64 = "iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAIAAADwyuo0AAAAE0lEQVR4nGP4z8AARGDiPwMyBwBnsgf5Q2OaZwAAAABJRU5ErkJggg=="; +const rgb_raw = [_]u8{ 255, 0, 0, 255, 0, 0, 0, 0, 255, 0, 0, 255, 255, 0, 0, 255, 0, 0, 0, 0, 255, 0, 0, 255 }; +// 256x256 transparent RGBA, zlib: 256 KiB stored per copy for 373 bytes sent. +const blank_256_zlib_b64 = "eNrtwTEBAAAAwqD1T+1tB6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAN4AADwAAQ=="; + +const red = [4]u8{ 255, 0, 0, 255 }; +const blue = [4]u8{ 0, 0, 255, 255 }; + +/// `ESC _ G ; ESC \` +inline fn apc(comptime control: []const u8, comptime payload: []const u8) []const u8 { + return comptime "\x1b_G" ++ control ++ ";" ++ payload ++ "\x1b\\"; +} + +/// What the protocol answers: `ESC _ G ; ESC \` +inline fn reply(comptime keys: []const u8, comptime message: []const u8) []const u8 { + return comptime "\x1b_G" ++ keys ++ ";" ++ message ++ "\x1b\\"; +} + +fn knownGap(comptime reason: []const u8, passes: bool) !void { + if (passes) { + std.debug.print("kitty: a known gap passes now, drop its marker: {s}\n", .{reason}); + return error.KnownGapNowPasses; + } + std.debug.print("kitty: known gap: {s}\n", .{reason}); + return error.SkipZigTest; +} + +/// A session of `shells` (1, or up to 3) terminal panes with 10x20 pixel cells, under a +/// shell that draws pixels, every pane's keyboard at its pty. +const Rig = struct { + p: *Pardes, + frame: std.heap.ArenaAllocator, + /// What each pane's program has read back since `take`. + read: [pardes.MAX_PANES]std.ArrayList(u8) = @splat(.empty), + + fn init(shells: u8) !Rig { + // f=100 decodes through pardes's own decoder (stb_image), which the + // shells start at launch. + pardes.image.start(std.testing.io, gpa); + // ghostty warns of every refused command; the refusals are the point. + std.testing.log_level = .err; + // A core boots one shell or the classic three. + const p = try Pardes.init(gpa, .{ .cols = 120, .rows = 40, .shells = if (shells > 1) 3 else 1 }); + p.native_images = true; + p.update(.{ .resize = .{ .cols = 120, .rows = 40, .cell_pixels = .{ .w = 10, .h = 20 } } }); + for (p.panes) |slot| if (slot) |each| { + each.body.mode = .tty; + }; + var r: Rig = .{ .p = p, .frame = .init(gpa) }; + r.drain(); + for (&r.read) |*b| b.clearRetainingCapacity(); + return r; + } + + fn deinit(r: *Rig) void { + for (&r.read) |*b| b.deinit(gpa); + r.frame.deinit(); + r.p.deinit(); + pardes.image.stop(); + } + + fn drain(r: *Rig) void { + while (r.p.nextEffect()) |effect| { + if (effect == .write) r.read[effect.write.pane].appendSlice(gpa, effect.write.bytes.slice()) catch @panic("OOM"); + } + } + + /// One pty read of pane `id`'s output. + fn feed(r: *Rig, id: u8, bytes: []const u8) void { + r.p.update(.{ .output = .{ .pane = id, .bytes = bytes } }); + r.drain(); + } + + /// The same output, as reads of `step` bytes. + fn feedSplit(r: *Rig, id: u8, bytes: []const u8, step: usize) void { + var at: usize = 0; + while (at < bytes.len) : (at += step) r.feed(id, bytes[at..@min(bytes.len, at + step)]); + } + + /// What pane `id`'s program read back, since the last take. + fn take(r: *Rig, id: u8) ![]u8 { + defer r.read[id].clearRetainingCapacity(); + return r.frame.allocator().dupe(u8, r.read[id].items); + } + + fn pane(r: *Rig, id: u8) *pardes.Pane { + return r.p.panes[id].?; + } + + fn vt(r: *Rig, id: u8) @TypeOf(&r.pane(id).terminal.?.vt) { + return &r.pane(id).terminal.?.vt; + } + + fn storage(r: *Rig, id: u8) @TypeOf(&r.vt(id).screens.active.kitty_images) { + return &r.vt(id).screens.active.kitty_images; + } + + fn places(r: *Rig) ![]const ?pardes.ImagePlace { + _ = r.frame.reset(.retain_capacity); + const s = try r.p.render(r.frame.allocator()); + return s.images[0..s.nimages]; + } + + /// The top-left cell of pane `id`'s body, in screen cells. + fn origin(r: *Rig, id: u8) struct { x: u16, y: u16 } { + const rect = r.p.rects[id]; + return .{ .x = rect.x + config.GUTTER, .y = r.p.bodyTop(r.pane(id), rect) }; + } + + /// The places drawn for the image a program called `image_id`. + fn placesOf(r: *Rig, image_id: u32) ![]const pardes.ImagePlace { + var out: std.ArrayList(pardes.ImagePlace) = .empty; + for (try r.places()) |maybe| if (maybe) |place| if (place.native.page == image_id) + try out.append(r.frame.allocator(), place); + return out.items; + } + + fn placementCount(r: *Rig, id: u8) usize { + return r.storage(id).placements.count(); + } + + fn hasImage(r: *Rig, id: u8, image_id: u32) bool { + return r.storage(id).imageById(image_id) != null; + } +}; + +/// The pixel at `(x, y)` of a drawn place's whole image, as RGBA. +fn pixel(place: pardes.ImagePlace, x: usize, y: usize) [4]u8 { + return place.rgba[(y * place.iw + x) * 4 ..][0..4].*; +} + +test "kitty: a support query is answered on the asking pane's pty and stores nothing" { + var r = try Rig.init(2); + defer r.deinit(); + r.feed(1, apc("i=31,s=1,v=1,a=q,t=d,f=24", "AAAA")); + try std.testing.expectEqualStrings(reply("i=31", "OK"), try r.take(1)); + try std.testing.expectEqualStrings("", try r.take(0)); + try std.testing.expect(!r.hasImage(1, 31)); + try std.testing.expectEqual(@as(usize, 0), (try r.places()).len); +} + +test "kitty: a query that cannot load says why, with its keys" { + var r = try Rig.init(1); + defer r.deinit(); + // Too little data for a 2x2 RGB image. + r.feed(0, apc("i=32,s=2,v=2,a=q,t=d,f=24", "AAAA")); + const got = try r.take(0); + try std.testing.expect(std.mem.startsWith(u8, got, "\x1b_Gi=32;E")); + try std.testing.expect(std.mem.endsWith(u8, got, "\x1b\\")); + try std.testing.expectEqual(@as(usize, 1), std.mem.count(u8, got, "\x1b_G")); +} + +test "kitty: quiet levels: q=1 drops the OK, q=2 the errors too" { + const Case = struct { control: []const u8, payload: []const u8, answered: bool }; + const cases = [_]Case{ + .{ .control = "i=33,s=1,v=1,a=q,f=24,q=0", .payload = "AAAA", .answered = true }, + .{ .control = "i=33,s=1,v=1,a=q,f=24,q=1", .payload = "AAAA", .answered = false }, + .{ .control = "i=33,s=2,v=2,a=q,f=24,q=1", .payload = "AAAA", .answered = true }, + .{ .control = "i=33,s=2,v=2,a=q,f=24,q=2", .payload = "AAAA", .answered = false }, + .{ .control = "i=33,s=4,v=2,a=t,f=24,q=1", .payload = rgb_b64, .answered = false }, + .{ .control = "i=33,a=p,q=2", .payload = "", .answered = false }, + }; + for (cases) |c| { + var r = try Rig.init(1); + defer r.deinit(); + const bytes = try std.fmt.allocPrint(r.frame.allocator(), "\x1b_G{s};{s}\x1b\\", .{ c.control, c.payload }); + r.feed(0, bytes); + const got = try r.take(0); + std.testing.expectEqual(c.answered, got.len > 0) catch |err| { + std.debug.print("q case {s}: read back {f}\n", .{ c.control, std.ascii.hexEscape(got, .lower) }); + return err; + }; + } +} + +test "kitty: RGB, RGBA, PNG and zlib-compressed RGB all draw the same pixels" { + const Case = struct { control: []const u8, payload: []const u8 }; + const cases = [_]Case{ + .{ .control = "a=T,i=1,f=24,s=4,v=2,c=2,r=1", .payload = rgb_b64 }, + .{ .control = "a=T,i=1,f=32,s=4,v=2,c=2,r=1", .payload = rgba_b64 }, + .{ .control = "a=T,i=1,f=100,c=2,r=1", .payload = png_b64 }, + .{ .control = "a=T,i=1,f=24,o=z,s=4,v=2,c=2,r=1", .payload = rgb_zlib_b64 }, + }; + for (cases) |c| { + var r = try Rig.init(1); + defer r.deinit(); + r.feed(0, try std.fmt.allocPrint(r.frame.allocator(), "\x1b_G{s};{s}\x1b\\", .{ c.control, c.payload })); + try std.testing.expectEqualStrings(reply("i=1", "OK"), try r.take(0)); + const img = r.storage(0).imageById(1) orelse return error.NotStored; + try std.testing.expectEqual(@as(u32, 4), img.width); + try std.testing.expectEqual(@as(u32, 2), img.height); + const drawn = try r.placesOf(1); + try std.testing.expectEqual(@as(usize, 1), drawn.len); + try std.testing.expectEqual(@as(usize, 4), drawn[0].iw); + for ([_][2]usize{ .{ 0, 0 }, .{ 1, 1 } }) |at| try std.testing.expectEqual(red, pixel(drawn[0], at[0], at[1])); + for ([_][2]usize{ .{ 2, 0 }, .{ 3, 1 } }) |at| try std.testing.expectEqual(blue, pixel(drawn[0], at[0], at[1])); + } +} + +test "kitty: a chunked transmission arrives whole however the pty splits it, answered once" { + // Three chunks of base64 (each a multiple of four), the keys on the first. + const chunked = apc("a=T,i=2,f=24,s=4,v=2,c=2,r=1,m=1", rgb_b64[0..8]) ++ + apc("m=1", rgb_b64[8..20]) ++ apc("m=0", rgb_b64[20..]); + for ([_]usize{ 1, 2, 3, 5, 7, 16, 64, chunked.len }) |step| { + var r = try Rig.init(1); + defer r.deinit(); + r.feedSplit(0, chunked, step); + try std.testing.expectEqualStrings(reply("i=2", "OK"), try r.take(0)); + const img = r.storage(0).imageById(2) orelse return error.NotStored; + try std.testing.expectEqualSlices(u8, &rgb_raw, img.data.bytes().?); + try std.testing.expectEqual(@as(usize, 1), (try r.placesOf(2)).len); + } +} + +test "kitty: text around an APC prints, in the same read and split across reads" { + for ([_]usize{ 1, 4, 1024 }) |step| { + var r = try Rig.init(1); + defer r.deinit(); + r.feedSplit(0, "before" ++ apc("a=t,i=3,f=24,s=4,v=2,q=2", rgb_b64) ++ "after", step); + const text = try terminal.screenTextAlloc(r.pane(0), r.frame.allocator()); + try std.testing.expect(std.mem.indexOf(u8, text, "beforeafter") != null); + try std.testing.expect(r.hasImage(0, 3)); + } +} + +const shm = struct { + extern "c" fn shm_open(name: [*:0]const u8, flag: c_int, mode: std.c.mode_t) c_int; + extern "c" fn shm_unlink(name: [*:0]const u8) c_int; +}; + +fn writeTemp(path: [:0]const u8, bytes: []const u8) !void { + const fd = std.c.open(path, .{ .ACCMODE = .WRONLY, .CREAT = true, .TRUNC = true }, @as(std.c.mode_t, 0o600)); + if (fd < 0) return error.OpenFailed; + defer _ = std.c.close(fd); + if (std.c.write(fd, bytes.ptr, bytes.len) != @as(isize, @intCast(bytes.len))) return error.WriteFailed; +} + +fn exists(path: [:0]const u8) bool { + return std.c.access(path, std.c.F_OK) == 0; +} + +fn b64(arena: std.mem.Allocator, bytes: []const u8) ![]const u8 { + const enc = std.base64.standard.Encoder; + const out = try arena.alloc(u8, enc.calcSize(bytes.len)); + return enc.encode(out, bytes); +} + +test "kitty: file, temporary-file and shared-memory media load, and the terminal removes what it should" { + var r = try Rig.init(1); + defer r.deinit(); + const arena = r.frame.allocator(); + const pid = std.c.getpid(); + + // t=f: a file the program keeps. + const file = try std.fmt.allocPrintSentinel(arena, "/tmp/pardes-kitty-{d}-file.rgb", .{pid}, 0); + try writeTemp(file, &rgb_raw); + defer _ = std.c.unlink(file); + r.feed(0, try std.fmt.allocPrint(arena, "\x1b_Ga=t,t=f,i=41,f=24,s=4,v=2;{s}\x1b\\", .{try b64(arena, file)})); + const file_reply = try r.take(0); + // t=t: a temporary file, which the terminal deletes once read; its name + // must say it is one. + const temp = try std.fmt.allocPrintSentinel(arena, "/tmp/tty-graphics-protocol-pardes-{d}.rgb", .{pid}, 0); + try writeTemp(temp, &rgb_raw); + defer _ = std.c.unlink(temp); + r.feed(0, try std.fmt.allocPrint(arena, "\x1b_Ga=t,t=t,i=42,f=24,s=4,v=2;{s}\x1b\\", .{try b64(arena, temp)})); + const temp_reply = try r.take(0); + // t=s: a POSIX shared memory object, which the terminal unlinks. + const name = try std.fmt.allocPrintSentinel(arena, "/pardes-kitty-{d}", .{pid}, 0); + const fd = shm.shm_open(name, @bitCast(std.c.O{ .ACCMODE = .RDWR, .CREAT = true, .TRUNC = true }), 0o600); + if (fd < 0) return error.ShmOpenFailed; + defer _ = shm.shm_unlink(name); + if (std.c.write(fd, &rgb_raw, rgb_raw.len) != rgb_raw.len) return error.WriteFailed; + _ = std.c.close(fd); + r.feed(0, try std.fmt.allocPrint(arena, "\x1b_Ga=t,t=s,i=43,f=24,s=4,v=2,S={d};{s}\x1b\\", .{ rgb_raw.len, try b64(arena, name) })); + const shm_reply = try r.take(0); + + const passes = std.mem.eql(u8, file_reply, reply("i=41", "OK")) and + std.mem.eql(u8, temp_reply, reply("i=42", "OK")) and + std.mem.eql(u8, shm_reply, reply("i=43", "OK")); + if (!passes) { + std.debug.print("media replies: f {f} | t {f} | s {f}\n", .{ + std.ascii.hexEscape(file_reply, .lower), + std.ascii.hexEscape(temp_reply, .lower), + std.ascii.hexEscape(shm_reply, .lower), + }); + return error.MediumRefused; + } + for ([_]u32{ 41, 42, 43 }) |id| { + const img = r.storage(0).imageById(id) orelse return error.NotStored; + try std.testing.expectEqualSlices(u8, &rgb_raw, img.data.bytes().?); + } + try std.testing.expect(exists(file)); + try std.testing.expect(!exists(temp)); +} + +test "kitty: a temporary file outside the temp directory, or not named as one, is refused" { + var r = try Rig.init(1); + defer r.deinit(); + const arena = r.frame.allocator(); + const file = try std.fmt.allocPrintSentinel(arena, "/tmp/pardes-kitty-{d}-notemp.rgb", .{std.c.getpid()}, 0); + try writeTemp(file, &rgb_raw); + defer _ = std.c.unlink(file); + r.feed(0, try std.fmt.allocPrint(arena, "\x1b_Ga=t,t=t,i=44,f=24,s=4,v=2;{s}\x1b\\", .{try b64(arena, file)})); + const got = try r.take(0); + try std.testing.expect(std.mem.startsWith(u8, got, "\x1b_Gi=44;E")); + try std.testing.expect(!r.hasImage(0, 44)); + // Refused, it is left where it was. + try std.testing.expect(exists(file)); +} + +test "kitty: a=T draws at the cursor and moves the cursor past the image; C=1 leaves it" { + for ([_]bool{ false, true }) |still| { + var r = try Rig.init(1); + defer r.deinit(); + if (still) + r.feed(0, "\x1b[3;5H" ++ apc("a=T,i=4,f=24,s=4,v=2,c=2,r=2,C=1,q=2", rgb_b64)) + else + r.feed(0, "\x1b[3;5H" ++ apc("a=T,i=4,f=24,s=4,v=2,c=2,r=2,q=2", rgb_b64)); + const cursor = r.vt(0).screens.active.cursor; + if (still) { + try std.testing.expectEqual(@as(usize, 4), cursor.x); + try std.testing.expectEqual(@as(usize, 2), cursor.y); + } else { + // Kitty: one cell past the image's right edge, on its last row. + try std.testing.expectEqual(@as(usize, 6), cursor.x); + try std.testing.expectEqual(@as(usize, 3), cursor.y); + } + const drawn = try r.placesOf(4); + // A cell row at a time: two rows. + try std.testing.expectEqual(@as(usize, 2), drawn.len); + const o = r.origin(0); + try std.testing.expectEqual(o.x + 4, drawn[0].x); + try std.testing.expectEqual(o.y + 2, drawn[0].y); + try std.testing.expectEqual(o.y + 3, drawn[1].y); + for (drawn) |place| try std.testing.expectEqual(@as(u16, 2), place.w); + } +} + +test "kitty: a=p places one image twice by placement id, a source rect crops it, and a re-put moves it" { + var r = try Rig.init(1); + defer r.deinit(); + r.feed(0, apc("a=t,i=7,f=24,s=4,v=2", rgb_b64)); + try std.testing.expectEqualStrings(reply("i=7", "OK"), try r.take(0)); + try std.testing.expectEqual(@as(usize, 0), (try r.placesOf(7)).len); + r.feed(0, "\x1b[1;1H" ++ apc("a=p,i=7,p=1,c=2,r=1", "")); + try std.testing.expectEqualStrings(reply("i=7,p=1", "OK"), try r.take(0)); + // The right half only (x=2, w=2): blue, in one cell. + r.feed(0, "\x1b[6;10H" ++ apc("a=p,i=7,p=2,x=2,y=0,w=2,h=2,c=1,r=1", "")); + try std.testing.expectEqualStrings(reply("i=7,p=2", "OK"), try r.take(0)); + try std.testing.expectEqual(@as(usize, 2), r.placementCount(0)); + const o = r.origin(0); + var drawn = try r.placesOf(7); + try std.testing.expectEqual(@as(usize, 2), drawn.len); + var cropped: ?pardes.ImagePlace = null; + for (drawn) |place| if (place.y == o.y + 5) { + cropped = place; + }; + const crop = cropped orelse return error.CroppedPlacementMissing; + try std.testing.expectEqual(o.x + 9, crop.x); + try std.testing.expectEqual(@as(u16, 1), crop.w); + const g = crop.native.geometry.?; + try std.testing.expectEqual(@as(u32, 2), g.src.x); + try std.testing.expectEqual(@as(u32, 2), g.src.w); + // Put again under the same id, placement 1 moves; it is not doubled. + r.feed(0, "\x1b[10;1H" ++ apc("a=p,i=7,p=1,c=2,r=1,q=1", "")); + try std.testing.expectEqual(@as(usize, 2), r.placementCount(0)); + drawn = try r.placesOf(7); + var at_ten = false; + var at_one = false; + for (drawn) |place| { + if (place.y == o.y + 9) at_ten = true; + if (place.y == o.y) at_one = true; + } + try std.testing.expect(at_ten and !at_one); +} + +test "kitty: a=p of an image that is not there answers ENOENT" { + var r = try Rig.init(1); + defer r.deinit(); + r.feed(0, apc("a=p,i=99", "")); + const got = try r.take(0); + try std.testing.expect(std.mem.startsWith(u8, got, "\x1b_Gi=99;ENOENT")); +} + +test "kitty: an image number gets an id, which the reply carries" { + var r = try Rig.init(1); + defer r.deinit(); + r.feed(0, apc("a=t,I=5,f=24,s=4,v=2", rgb_b64)); + const got = try r.take(0); + // `i=,I=5;OK` + try std.testing.expect(std.mem.startsWith(u8, got, "\x1b_Gi=")); + try std.testing.expect(std.mem.endsWith(u8, got, ",I=5;OK\x1b\\")); + try std.testing.expect(r.storage(0).imageByNumber(5) != null); +} + +test "kitty: z-index orders images, and a negative one goes under the text" { + var r = try Rig.init(1); + defer r.deinit(); + r.feed(0, "\x1b[1;1H" ++ apc("a=T,i=8,f=24,s=4,v=2,c=2,r=1,z=-1,q=2", rgb_b64) ++ "\x1b[1;1Htext"); + try std.testing.expectEqual(@as(usize, 1), r.placementCount(0)); + var it = r.storage(0).placements.iterator(); + try std.testing.expectEqual(@as(i32, -1), it.next().?.value_ptr.z); + try knownGap("pardes draws every terminal image over the cells, in storage order: an ImagePlace has no z-index, so z<0 (under the text) and the order between overlapping images are lost", @hasField(pardes.ImagePlace, "z")); +} + +/// A screen with two images in known places, for the deletes: +/// image 1: placement 1 at (0,0) 2x1, placement 2 at (10,5) 2x1, z=5 +/// image 2: placement 1 at (20,8) 2x2, z=-3 +/// and the cursor parked at (20,8), on image 2. +fn deleteScene(r: *Rig) void { + r.feed(0, apc("a=t,i=1,f=24,s=4,v=2,q=2", rgb_b64) ++ apc("a=t,i=2,f=24,s=4,v=2,q=2", rgb_b64)); + r.feed(0, "\x1b[1;1H" ++ apc("a=p,i=1,p=1,c=2,r=1,C=1,q=2", "") ++ + "\x1b[6;11H" ++ apc("a=p,i=1,p=2,c=2,r=1,z=5,C=1,q=2", "") ++ + "\x1b[9;21H" ++ apc("a=p,i=2,p=1,c=2,r=2,z=-3,C=1,q=2", "")); +} + +test "kitty: every delete takes the placements it names, and the uppercase ones free the image" { + const Case = struct { + control: []const u8, + /// Placements left, and whether images 1 and 2 are still stored. + left: usize, + one: bool, + two: bool, + }; + const cases = [_]Case{ + .{ .control = "a=d", .left = 0, .one = true, .two = true }, // d=a is the default + .{ .control = "a=d,d=a", .left = 0, .one = true, .two = true }, + .{ .control = "a=d,d=A", .left = 0, .one = false, .two = false }, + .{ .control = "a=d,d=i,i=1", .left = 1, .one = true, .two = true }, + .{ .control = "a=d,d=I,i=1", .left = 1, .one = false, .two = true }, + .{ .control = "a=d,d=i,i=1,p=2", .left = 2, .one = true, .two = true }, + .{ .control = "a=d,d=c", .left = 2, .one = true, .two = true }, + .{ .control = "a=d,d=C", .left = 2, .one = true, .two = false }, + .{ .control = "a=d,d=p,x=11,y=6", .left = 2, .one = true, .two = true }, + .{ .control = "a=d,d=P,x=21,y=10", .left = 2, .one = true, .two = false }, + .{ .control = "a=d,d=q,x=11,y=6,z=5", .left = 2, .one = true, .two = true }, + .{ .control = "a=d,d=q,x=11,y=6,z=4", .left = 3, .one = true, .two = true }, + .{ .control = "a=d,d=x,x=2", .left = 2, .one = true, .two = true }, + .{ .control = "a=d,d=X,x=22", .left = 2, .one = true, .two = false }, + .{ .control = "a=d,d=y,y=6", .left = 2, .one = true, .two = true }, + .{ .control = "a=d,d=Y,y=10", .left = 2, .one = true, .two = false }, + .{ .control = "a=d,d=z,z=-3", .left = 2, .one = true, .two = true }, + .{ .control = "a=d,d=Z,z=-3", .left = 2, .one = true, .two = false }, + .{ .control = "a=d,d=r,x=1,y=1", .left = 1, .one = true, .two = true }, + .{ .control = "a=d,d=R,x=1,y=2", .left = 0, .one = false, .two = false }, + }; + for (cases) |c| { + var r = try Rig.init(1); + defer r.deinit(); + deleteScene(&r); + try std.testing.expectEqual(@as(usize, 3), r.placementCount(0)); + try std.testing.expectEqual(@as(usize, 4), (try r.places()).len); + r.feed(0, try std.fmt.allocPrint(r.frame.allocator(), "\x1b_G{s}\x1b\\", .{c.control})); + const drawn = (try r.places()).len; + const got = .{ r.placementCount(0), r.hasImage(0, 1), r.hasImage(0, 2) }; + std.testing.expectEqual(.{ c.left, c.one, c.two }, got) catch |err| { + std.debug.print("delete {s}: left {d}, image 1 {}, image 2 {}\n", .{ c.control, got[0], got[1], got[2] }); + return err; + }; + // Deletes never answer, and the frame draws what is left: a 2x1 + // placement is one place, the 2x2 one two. + try std.testing.expectEqualStrings("", try r.take(0)); + var rows: usize = 0; + var it = r.storage(0).placements.iterator(); + while (it.next()) |entry| rows += if (entry.key_ptr.image_id == 2) 2 else 1; + try std.testing.expectEqual(rows, drawn); + } +} + +test "kitty: deletes by image number take that image's placements, and N frees it" { + for ([_]bool{ false, true }) |free| { + var r = try Rig.init(1); + defer r.deinit(); + r.feed(0, "\x1b[1;1H" ++ apc("a=T,I=11,f=24,s=4,v=2,c=2,r=1,C=1,q=2", rgb_b64) ++ + "\x1b[5;1H" ++ apc("a=T,i=2,f=24,s=4,v=2,c=2,r=1,C=1,q=2", rgb_b64)); + try std.testing.expectEqual(@as(usize, 2), r.placementCount(0)); + if (free) r.feed(0, apc("a=d,d=N,I=11", "")) else r.feed(0, apc("a=d,d=n,I=11", "")); + try std.testing.expectEqual(@as(usize, 1), r.placementCount(0)); + try std.testing.expectEqual(!free, r.storage(0).imageByNumber(11) != null); + try std.testing.expect(r.hasImage(0, 2)); + try std.testing.expectEqual(@as(usize, 1), (try r.places()).len); + } +} + +test "kitty: a delete abandons a chunked load in progress" { + var r = try Rig.init(1); + defer r.deinit(); + r.feed(0, apc("a=t,i=9,f=24,s=4,v=2,m=1", rgb_b64[0..8])); + r.feed(0, apc("a=d,d=A", "")); + r.feed(0, apc("m=0", rgb_b64[8..])); + try std.testing.expect(!r.hasImage(0, 9)); +} + +test "kitty: Unicode placeholders draw a virtual placement over two rows, with implicit columns" { + var r = try Rig.init(1); + defer r.deinit(); + // Image 7 in the placeholders' foreground; row diacritics U+0305 (0) + // and U+030D (1); the first cell of each row names its column (U+0305 = + // 0) and the next one carries on from it with no diacritic of its own. + r.feed(0, apc("a=T,U=1,i=7,f=24,s=4,v=2,c=2,r=2,q=2", rgb_b64) ++ + "\x1b[2;3H\x1b[38;2;0;0;7m\u{10EEEE}\u{0305}\u{0305}\u{10EEEE}" ++ + "\x1b[3;3H\u{10EEEE}\u{030D}\u{0305}\u{10EEEE}\x1b[39mX"); + const drawn = try r.placesOf(7); + const o = r.origin(0); + try std.testing.expectEqual(@as(usize, 2), drawn.len); + try std.testing.expectEqual(o.x + 2, drawn[0].x); + try std.testing.expectEqual(o.y + 1, drawn[0].y); + try std.testing.expectEqual(o.y + 2, drawn[1].y); + for (drawn) |place| try std.testing.expectEqual(@as(u16, 2), place.w); + // The top row shows the image's top half, the bottom its bottom half. + try std.testing.expectEqual(@as(u32, 0), drawn[0].native.geometry.?.src.y); + try std.testing.expectEqual(@as(u32, 1), drawn[1].native.geometry.?.src.y); +} + +test "kitty: a placeholder naming its placement in the underline colour picks that placement" { + var r = try Rig.init(1); + defer r.deinit(); + // Two virtual placements of image 7: p=1 one cell, p=2 two cells wide. + r.feed(0, apc("a=t,i=7,f=24,s=4,v=2,q=2", rgb_b64) ++ + apc("a=p,U=1,i=7,p=1,c=1,r=1,q=2", "") ++ apc("a=p,U=1,i=7,p=2,c=2,r=1,q=2", "") ++ + "\x1b[1;1H\x1b[38;2;0;0;7m\x1b[58;2;0;0;2m\u{10EEEE}\u{0305}\u{0305}\u{10EEEE}\x1b[39;59m"); + const drawn = try r.placesOf(7); + try std.testing.expectEqual(@as(usize, 1), drawn.len); + // Placement 2 spans two cells, so each cell is half the image. + try std.testing.expectEqual(@as(u16, 2), drawn[0].w); +} + +test "kitty: an image follows its text when the shell scrolls, resizes and reflows" { + var r = try Rig.init(1); + defer r.deinit(); + r.feed(0, "\x1b[5;1Hmarker" ++ apc("a=T,i=10,f=24,s=4,v=2,c=2,r=1,q=2", rgb_b64)); + const o = r.origin(0); + try std.testing.expectEqual(o.y + 4, (try r.placesOf(10))[0].y); + // Two lines of output at the bottom scroll it up two rows. + r.feed(0, "\x1b[40;1H\n\n"); + try std.testing.expectEqual(o.y + 2, (try r.placesOf(10))[0].y); + // A narrower pane reflows the text; the image stays on its row. + const pane = r.pane(0); + terminal.resizeGrid(pane, gpa, 40, pane.rows); + const text = try terminal.screenTextAlloc(pane, r.frame.allocator()); + var row: usize = 0; + var lines = std.mem.splitScalar(u8, text, '\n'); + while (lines.next()) |line| : (row += 1) if (std.mem.startsWith(u8, line, "marker")) break; + const drawn = try r.placesOf(10); + try std.testing.expectEqual(@as(usize, 1), drawn.len); + const viewport_top: usize = @intCast(terminal.gridOffset(pane)); + try std.testing.expectEqual(o.y + @as(u16, @intCast(row - viewport_top)), drawn[0].y); +} + +test "kitty: the alternate screen has its own images, and the primary's come back after it" { + var r = try Rig.init(1); + defer r.deinit(); + r.feed(0, "\x1b[1;1H" ++ apc("a=T,i=11,f=24,s=4,v=2,c=2,r=1,q=2", rgb_b64)); + r.feed(0, "\x1b[?1049h"); + try std.testing.expectEqual(@as(usize, 0), (try r.placesOf(11)).len); + // yazi's way in: the image goes on the alternate screen. + r.feed(0, "\x1b[3;3H" ++ apc("a=T,i=12,f=24,s=4,v=2,c=2,r=1,q=2", rgb_b64)); + try std.testing.expectEqual(@as(usize, 1), (try r.placesOf(12)).len); + try std.testing.expect(!r.hasImage(0, 11)); // per screen + r.feed(0, "\x1b[?1049l"); + try std.testing.expectEqual(@as(usize, 0), (try r.placesOf(12)).len); + try std.testing.expectEqual(@as(usize, 1), (try r.placesOf(11)).len); +} + +test "kitty: clear (ED 2 + ED 3) takes the images away, and they stay away" { + var r = try Rig.init(1); + defer r.deinit(); + r.feed(0, "\x1b[1;1H" ++ apc("a=T,i=13,f=24,s=4,v=2,c=2,r=1,q=2", rgb_b64)); + var nl: [2 * 60]u8 = undefined; + for (0..60) |i| nl[2 * i ..][0..2].* = "\r\n".*; + r.feed(0, &nl); + r.feed(0, "\x1b[H\x1b[2J\x1b[3J"); + try std.testing.expectEqual(@as(usize, 0), r.placementCount(0)); + try std.testing.expectEqual(@as(usize, 0), (try r.places()).len); + r.feed(0, "after clear\r\n"); + try std.testing.expectEqual(@as(usize, 0), (try r.places()).len); +} + +test "kitty: replies go to the pane that asked, never another, and never into the drawn cells" { + var r = try Rig.init(3); + defer r.deinit(); + r.feed(1, apc("i=51,s=1,v=1,a=q,f=24", "AAAA")); + r.feed(2, apc("i=52,s=1,v=1,a=q,f=24", "AAAA")); + r.feed(1, apc("a=t,i=53,f=24,s=4,v=2", rgb_b64)); + r.feed(2, apc("a=p,i=53", "")); + try std.testing.expectEqualStrings(reply("i=51", "OK") ++ reply("i=53", "OK"), try r.take(1)); + try std.testing.expect(std.mem.startsWith(u8, try r.take(2), reply("i=52", "OK") ++ "\x1b_Gi=53;ENOENT")); + try std.testing.expectEqualStrings("", try r.take(0)); + // Images are per pane: pane 2 never sees pane 1's. + try std.testing.expect(r.hasImage(1, 53) and !r.hasImage(2, 53)); + _ = try r.places(); + const s = &r.p.surface; + for (0..s.rows) |y| for (0..s.cols) |x| { + const g = s.at(@intCast(x), @intCast(y)).grapheme(); + try std.testing.expect(std.mem.indexOfScalar(u8, g, 0x1b) == null); + try std.testing.expect(!std.mem.eql(u8, g, "_")); + }; +} + +test "kitty: many replies from one read all arrive, each whole, in order" { + var r = try Rig.init(1); + defer r.deinit(); + var batch: std.ArrayList(u8) = .empty; + defer batch.deinit(gpa); + var want: std.ArrayList(u8) = .empty; + defer want.deinit(gpa); + for (100..164) |id| { + try batch.print(gpa, "\x1b_Gi={d},s=1,v=1,a=q,f=24;AAAA\x1b\\", .{id}); + try want.print(gpa, "\x1b_Gi={d};OK\x1b\\", .{id}); + } + r.feed(0, batch.items); + try std.testing.expectEqualStrings(want.items, try r.take(0)); +} + +test "kitty: answers past what one read may hold are dropped whole, never cut" { + var r = try Rig.init(1); + defer r.deinit(); + var batch: std.ArrayList(u8) = .empty; + defer batch.deinit(gpa); + // Each fails with a long EINVAL: far more answer than the pane holds. + for (1..1001) |id| try batch.print(gpa, "\x1b_Gi={d},s=2,v=2,a=q,f=24;AAAA\x1b\\", .{id}); + r.feed(0, batch.items); + const got = try r.take(0); + try std.testing.expect(got.len > 0); + try std.testing.expect(r.pane(0).terminal.?.reply_dropped > 0); + // Whole sequences only, each its own `ESC _ G ... ESC \`. + var rest = got; + while (rest.len > 0) { + try std.testing.expect(std.mem.startsWith(u8, rest, "\x1b_Gi=")); + const end = std.mem.indexOf(u8, rest, "\x1b\\") orelse return error.CutAnswer; + try std.testing.expect(std.mem.indexOf(u8, rest[3..end], "\x1b") == null); + rest = rest[end + 2 ..]; + } + // The next read is answered again. + r.feed(0, apc("i=31,s=1,v=1,a=q,f=24", "AAAA")); + try std.testing.expectEqualStrings(reply("i=31", "OK"), try r.take(0)); +} + +test "kitty: the graphics answer comes before DA's, as a probe expects" { + var r = try Rig.init(1); + defer r.deinit(); + // yazi, chafa and kitten icat probe this way and wait for DA to end it. + r.feed(0, apc("i=31,s=1,v=1,a=q,t=d,f=24", "AAAA") ++ "\x1b[c"); + const got = try r.take(0); + const kitty = std.mem.indexOf(u8, got, reply("i=31", "OK")) orelse return error.NoKittyReply; + const da = std.mem.indexOf(u8, got, "\x1b[?") orelse return error.NoDaReply; + try std.testing.expect(kitty < da); +} + +test "kitty: a cancelled (CAN, SUB) APC runs nothing, answers nothing, and the text goes on" { + for ([_][]const u8{ "\x18", "\x1a" }) |cancel| { + var r = try Rig.init(1); + defer r.deinit(); + r.feed(0, "\x1b_Ga=T,i=60,f=24,s=4,v=2;" ++ rgb_b64); + r.feed(0, cancel); + r.feed(0, "after"); + try std.testing.expect(!r.hasImage(0, 60)); + try std.testing.expectEqualStrings("", try r.take(0)); + const text = try terminal.screenTextAlloc(r.pane(0), r.frame.allocator()); + try std.testing.expect(std.mem.indexOf(u8, text, "after") != null); + } +} + +test "kitty: an image too large to hold is refused with an error" { + var r = try Rig.init(1); + defer r.deinit(); + // Past ghostty's 10000-pixel side. + r.feed(0, apc("a=t,i=61,f=32,s=20000,v=2,o=z", blank_256_zlib_b64)); + const got = try r.take(0); + try std.testing.expect(std.mem.startsWith(u8, got, "\x1b_Gi=61;E")); + try std.testing.expect(!r.hasImage(0, 61)); +} + +test "kitty: many images stay inside the pane's storage limit, oldest out first, and go with the pane" { + var r = try Rig.init(1); + defer r.deinit(); + const storage = r.storage(0); + var buf: [600]u8 = undefined; + // 256 KiB each: 300 of them is past the 64 MiB a screen may hold. + for (1..301) |id| r.feed(0, try std.fmt.bufPrint(&buf, "\x1b_Ga=t,i={d},f=32,s=256,v=256,o=z,q=2;{s}\x1b\\", .{ id, blank_256_zlib_b64 })); + try std.testing.expect(storage.total_bytes <= storage.total_limit); + try std.testing.expect(storage.images.count() < 300); + try std.testing.expect(r.hasImage(0, 300)); + try std.testing.expect(!r.hasImage(0, 1)); + try std.testing.expectEqualStrings("", try r.take(0)); + // The testing allocator checks the pane gives all of it back (deinit). +} + +test "kitty: an animation's frames play" { + var r = try Rig.init(1); + defer r.deinit(); + // Root frame red, frame 2 blue (a whole-frame RGB replacement), then + // run it: s=3, looping. + const blue_frame = "AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/"; + r.feed(0, "\x1b[1;1H" ++ apc("a=T,i=70,f=24,s=4,v=2,c=2,r=1,q=2", rgb_b64) ++ + apc("a=f,i=70,f=24,s=4,v=2,z=40,q=2", blue_frame) ++ + // The root frame's gap is 0 (gapless, skipped) until it is given one. + apc("a=a,i=70,r=1,z=40,q=2", "") ++ + apc("a=a,i=70,s=3,v=1,q=2", "")); + const img = r.storage(0).imageById(70) orelse return error.NotStored; + try std.testing.expect(img.animation != null); + // On the core's clock: the first frame drawn starts it (red), the core + // asks to wake for the next, and a frame drawn after 40 ms shows blue. + const base: u64 = 10 * std.time.ns_per_s; + r.p.advance(base); + const first = try r.placesOf(70); + try std.testing.expectEqual(red, pixel(first[0], 0, 0)); + try std.testing.expect(r.p.nextWake() != null); + var shows_blue = false; + for (1..20) |k| { + r.p.advance(base + k * 50 * std.time.ns_per_ms); + const drawn = try r.placesOf(70); + if (drawn.len == 1 and std.mem.eql(u8, &pixel(drawn[0], 0, 0), &blue)) shows_blue = true; + } + try std.testing.expect(shows_blue); + // Stopped (s=1), nothing more to wake for. + r.feed(0, apc("a=a,i=70,s=1,q=2", "")); + _ = try r.places(); + try std.testing.expectEqual(@as(?u64, null), terminal.animationDueMs(r.pane(0))); +} + +test "kitty: a placement relative to another (P=, Q=) is drawn at its parent's cell plus H/V" { + var r = try Rig.init(1); + defer r.deinit(); + r.feed(0, apc("a=t,i=80,f=24,s=4,v=2,q=2", rgb_b64) ++ "\x1b[2;2H" ++ + apc("a=p,i=80,p=1,c=2,r=1,q=2", "") ++ + // Three cells right of placement 1, one row down; then one relative + // to that, a chain two deep. + apc("a=p,i=80,p=2,P=80,Q=1,H=3,V=1,c=2,r=1,q=2", "") ++ + apc("a=p,i=80,p=3,P=80,Q=2,H=3,c=2,r=1,q=2", "")); + try std.testing.expectEqual(@as(usize, 3), r.placementCount(0)); + const drawn = try r.placesOf(80); + try std.testing.expectEqual(@as(usize, 3), drawn.len); + const o = r.origin(0); + var cells: [3][2]u16 = undefined; + for (drawn, 0..) |place, i| cells[i] = .{ place.x - o.x, place.y - o.y }; + std.mem.sort([2]u16, &cells, {}, struct { + fn lt(_: void, a: [2]u16, b: [2]u16) bool { + return a[0] < b[0]; + } + }.lt); + try std.testing.expectEqual([2]u16{ 1, 1 }, cells[0]); + try std.testing.expectEqual([2]u16{ 4, 2 }, cells[1]); + try std.testing.expectEqual([2]u16{ 7, 2 }, cells[2]); + // Its parent deleted, a relative placement goes with it. + r.feed(0, apc("a=d,d=i,i=80,p=1", "")); + try std.testing.expectEqual(@as(usize, 0), (try r.placesOf(80)).len); +} diff --git a/test/kitty_client.zig b/test/kitty_client.zig new file mode 100644 index 00000000..23c7587f --- /dev/null +++ b/test/kitty_client.zig @@ -0,0 +1,150 @@ +//! A kitty graphics client for test/kitty_harness.zig: run in a pardes +//! terminal pane, it plays one case of the protocol the way yazi or +//! `kitten icat` do (raw mode, a batch of commands, then reads what comes +//! back) and records every byte its pty gave it. +//! +//! pardes-kitty-client +//! +//! After the case's commands it sends a sync query (`i=999`); replies come +//! in order, so all the case's are in before the sync's. `` gets the +//! bytes read, and `.done` is made last, which the harness waits for. +const std = @import("std"); +const c = std.c; + +// 64x64 RGB, one colour: the harness looks for it in the outer terminal's +// image store and in the GUI's capture. +pub const side = 64; +pub const colour = [3]u8{ 13, 77, 231 }; +const sync = "\x1b_Gi=999,s=1,v=1,a=q,t=d,f=24;AAAA\x1b\\"; + +pub fn main(init: std.process.Init) !void { + var arena_state: std.heap.ArenaAllocator = .init(std.heap.page_allocator); + defer arena_state.deinit(); + const arena = arena_state.allocator(); + const args = try init.minimal.args.toSlice(arena); + if (args.len != 3) return error.BadArgs; + const case = args[1]; + const out = try arena.dupeSentinel(u8, args[2], 0); + + var saved: c.termios = undefined; + if (c.tcgetattr(0, &saved) != 0) return error.NotATerminal; + var raw = saved; + raw.lflag.ICANON = false; + raw.lflag.ECHO = false; + raw.cc[@backingInt(c.V.MIN)] = 0; + raw.cc[@backingInt(c.V.TIME)] = 1; + _ = c.tcsetattr(0, .NOW, &raw); + defer _ = c.tcsetattr(0, .NOW, &saved); + + var cmds: std.ArrayList(u8) = .empty; + try play(arena, case, &cmds); + try cmds.appendSlice(arena, sync); + try writeAll(cmds.items); + + // Read until the sync's answer, or 5 s. + var got: std.ArrayList(u8) = .empty; + var buf: [4096]u8 = undefined; + var waited: usize = 0; + while (waited < 50 and std.mem.indexOf(u8, got.items, "\x1b_Gi=999;") == null) { + const n = c.read(0, &buf, buf.len); + if (n > 0) try got.appendSlice(arena, buf[0..@intCast(n)]) else waited += 1; + } + // A little longer, for anything that should not have come. + for (0..3) |_| { + const n = c.read(0, &buf, buf.len); + if (n > 0) try got.appendSlice(arena, buf[0..@intCast(n)]); + } + // t=f's file stays the client's to remove (a terminal deletes only t=t's). + _ = c.unlink(try std.fmt.allocPrintSentinel(arena, "/tmp/kc-{d}.rgb", .{c.getpid()}, 0)); + try writeFile(out, got.items); + try writeFile(try std.fmt.allocPrintSentinel(arena, "{s}.done", .{out}, 0), ""); +} + +fn play(arena: std.mem.Allocator, case: []const u8, cmds: *std.ArrayList(u8)) !void { + const pixels = try solid(arena); + const enc = std.base64.standard.Encoder; + const b64 = try arena.alloc(u8, enc.calcSize(pixels.len)); + _ = enc.encode(b64, pixels); + const pid = c.getpid(); + + if (std.mem.eql(u8, case, "query")) { + // yazi's and chafa's probe: a graphics query, then DA to end it. + try cmds.appendSlice(arena, "\x1b_Gi=31,s=1,v=1,a=q,t=d,f=24;AAAA\x1b\\\x1b[c"); + } else if (std.mem.eql(u8, case, "place")) { + // A line to find, then the image right after it: chunked in 1 KiB + // pieces, as kitten icat sends a big one, 8x4 cells. + try cmds.appendSlice(arena, "\r\nANCHOR>"); + var at: usize = 0; + var first = true; + while (at < b64.len) : (at += 1024) { + const end = @min(b64.len, at + 1024); + const more: u8 = if (end < b64.len) '1' else '0'; + if (first) + try cmds.print(arena, "\x1b_Ga=T,i=42,f=24,s={d},v={d},c=8,r=4,m={c};{s}\x1b\\", .{ side, side, more, b64[at..end] }) + else + try cmds.print(arena, "\x1b_Gm={c};{s}\x1b\\", .{ more, b64[at..end] }); + first = false; + } + try cmds.appendSlice(arena, "\r\n"); + } else if (std.mem.eql(u8, case, "media")) { + const file = try std.fmt.allocPrintSentinel(arena, "/tmp/kc-{d}.rgb", .{pid}, 0); + const temp = try std.fmt.allocPrintSentinel(arena, "/tmp/tty-graphics-protocol-kc-{d}.rgb", .{pid}, 0); + const shm_name = try std.fmt.allocPrintSentinel(arena, "/kc-{d}", .{pid}, 0); + try writeFile(file, pixels); + try writeFile(temp, pixels); + const fd = shm_open(shm_name, @bitCast(c.O{ .ACCMODE = .RDWR, .CREAT = true, .TRUNC = true }), 0o600); + if (fd < 0) return error.ShmOpenFailed; + if (c.write(fd, pixels.ptr, pixels.len) != @as(isize, @intCast(pixels.len))) return error.WriteFailed; + _ = c.close(fd); + for ([_]struct { u8, u32, []const u8 }{ .{ 'f', 51, file }, .{ 't', 52, temp }, .{ 's', 53, shm_name } }) |m| { + const path = try arena.alloc(u8, enc.calcSize(m[2].len)); + _ = enc.encode(path, m[2]); + try cmds.print(arena, "\x1b_Ga=t,t={c},i={d},f=24,s={d},v={d};{s}\x1b\\", .{ m[0], m[1], side, side, path }); + } + } else if (std.mem.eql(u8, case, "quiet")) { + // q=1 hides the OK, q=2 the error; q=0's error is heard. + try cmds.print(arena, "\x1b_Ga=t,i=61,f=24,s={d},v={d},q=1;{s}\x1b\\", .{ side, side, b64 }); + try cmds.appendSlice(arena, "\x1b_Ga=t,i=62,f=24,s=2,v=2,q=2;AAAA\x1b\\"); + try cmds.appendSlice(arena, "\x1b_Ga=t,i=63,f=24,s=2,v=2,q=0;AAAA\x1b\\"); + } else if (std.mem.eql(u8, case, "cancel")) { + // CAN in the middle of the payload: nothing runs, the text goes on. + try cmds.print(arena, "\x1b_Ga=T,i=64,f=24,s={d},v={d};{s}\x18CANCELLED-OK\r\n", .{ side, side, b64[0..512] }); + } else if (std.mem.eql(u8, case, "show")) { + try cmds.print(arena, "\x1b_Ga=T,i=65,f=24,s={d},v={d},c=8,r=4,q=2;{s}\x1b\\\r\n", .{ side, side, b64 }); + } else if (std.mem.eql(u8, case, "delete")) { + // Run after `show`, in the same pane: image 65 is still stored. + try cmds.appendSlice(arena, "\x1b_Ga=d,d=I,i=65\x1b\\"); + } else return error.UnknownCase; +} + +extern "c" fn shm_open(name: [*:0]const u8, flag: c_int, mode: c.mode_t) c_int; + +fn solid(arena: std.mem.Allocator) ![]u8 { + const px = try arena.alloc(u8, side * side * 3); + for (0..side * side) |i| px[i * 3 ..][0..3].* = colour; + return px; +} + +fn writeAll(bytes: []const u8) !void { + var at: usize = 0; + while (at < bytes.len) { + const n = c.write(1, bytes[at..].ptr, bytes.len - at); + if (n < 0) { + if (c.errno(n) == .INTR or c.errno(n) == .AGAIN) continue; + return error.WriteFailed; + } + at += @intCast(n); + } +} + +fn writeFile(path: [:0]const u8, bytes: []const u8) !void { + const fd = c.open(path, .{ .ACCMODE = .WRONLY, .CREAT = true, .TRUNC = true }, @as(c.mode_t, 0o644)); + if (fd < 0) return error.OpenFailed; + defer _ = c.close(fd); + var at: usize = 0; + while (at < bytes.len) { + const n = c.write(fd, bytes[at..].ptr, bytes.len - at); + if (n <= 0) return error.WriteFailed; + at += @intCast(n); + } +} diff --git a/test/kitty_harness.zig b/test/kitty_harness.zig new file mode 100644 index 00000000..ad864671 --- /dev/null +++ b/test/kitty_harness.zig @@ -0,0 +1,463 @@ +//! Kitty graphics end to end through a terminal pane. +//! +//! zig build kitty-harness -Dplatform=tty a fake kitty terminal outside +//! zig build kitty-harness -Dplatform=gui the SDL renderer's capture +//! +//! test/kitty.zig checks the proxy at the core; this checks it through the +//! real things on both sides of it. Inside: a bash in a pardes terminal pane +//! runs test/kitty_client.zig (each case as yazi or `kitten icat` would play +//! it, recording what its pty reads back), then `kitten icat` and `chafa` +//! themselves when they are installed. Outside, on the tty, the harness is a +//! kitty terminal: a ghostty-vt emulator that stores the images pardes +//! re-emits, so a check reads where they landed in cells; on the GUI, the +//! GPU readback (PARDES_TEST_CAPTURE_DIR) is where the pixels landed. +const std = @import("std"); +const libc = std.c; +const eh = @import("e2e_harness.zig"); +const client = @import("kitty_client.zig"); + +extern "c" fn setenv(name: [*:0]const u8, value: [*:0]const u8, overwrite: c_int) c_int; +extern "c" fn unsetenv(name: [*:0]const u8) c_int; +extern "c" fn chdir(path: [*:0]const u8) c_int; + +pub const std_options: std.Options = .{ .log_level = .err }; + +const gpa = std.heap.page_allocator; +const rows = 40; +const cols = 120; +const sync_reply = "\x1b_Gi=999;OK\x1b\\"; + +var failures: usize = 0; +var skipped: usize = 0; + +fn check(ok: bool, comptime what: []const u8, args: anytype) void { + if (ok) { + std.debug.print(" ok " ++ what ++ "\n", args); + } else { + failures += 1; + std.debug.print(" FAIL " ++ what ++ "\n", args); + } +} + +fn skip(comptime what: []const u8, args: anytype) void { + skipped += 1; + std.debug.print(" skip " ++ what ++ "\n", args); +} + +pub fn main(init: std.process.Init) !void { + var arena_state: std.heap.ArenaAllocator = .init(gpa); + defer arena_state.deinit(); + const arena = arena_state.allocator(); + const args = try init.minimal.args.toSlice(arena); + if (args.len != 4) return error.BadArgs; + // Run steps pass artifacts relative to the build root; the harness + // works from its own directory. + const exe = try absolute(arena, args[1]); + const kc = try absolute(arena, args[2]); + const gui = std.mem.eql(u8, args[3], "gui"); + + const base = try std.fmt.allocPrintSentinel(arena, "/tmp/pardes-kitty-harness-{d}", .{libc.getpid()}, 0); + if (libc.mkdir(base, 0o755) != 0) return error.MkdirFailed; + defer removeTree(arena, base); + try hermetic(arena, base, gui); + + var h = try eh.Harness.initArgv(gpa, exe, rows, cols, &.{}); + defer h.deinit(); + var run: Run = .{ .arena = arena, .h = &h, .base = base, .kc = kc, .gui = gui }; + try run.start(); + + std.debug.print("kitty harness ({s}):\n", .{if (gui) "gui" else "tty"}); + try run.query(); + try run.place(); + try run.media(); + try run.quiet(); + try run.cancel(); + if (!gui) try run.delete(); + try run.icat(); + try run.chafa(); + + std.debug.print("kitty harness: {d} failed, {d} skipped\n", .{ failures, skipped }); + if (failures > 0) return error.KittyHarnessFailed; +} + +fn hermetic(arena: std.mem.Allocator, base: [:0]const u8, gui: bool) !void { + for ([_][*:0]const u8{ "PARDES_PID", "PARDES_9P", "PARDES_PANE", "PARDES_MOUNT", "PARDES_TEST", "PARDES_TEST_CAPTURE_DIR", "PARDES_TEST_COLS", "PARDES_TEST_ROWS", "PARDES_DUMP" }) |name| + _ = unsetenv(name); + _ = setenv("HOME", base, 1); + const config_home = try std.fmt.allocPrintSentinel(arena, "{s}/.config", .{base}, 0); + _ = setenv("XDG_CONFIG_HOME", config_home, 1); + const state_home = try std.fmt.allocPrintSentinel(arena, "{s}/.state", .{base}, 0); + _ = setenv("XDG_STATE_HOME", state_home, 1); + if (libc.mkdir(config_home, 0o755) != 0) return error.MkdirFailed; + const config_dir = try std.fmt.allocPrintSentinel(arena, "{s}/pardes", .{config_home}, 0); + if (libc.mkdir(config_dir, 0o755) != 0) return error.MkdirFailed; + try eh.writeFile(try std.fmt.allocPrintSentinel(arena, "{s}/init", .{config_dir}, 0), "Shell bash\nTheme helix\nMessageAnimation off\nMessageLinger 0\n"); + try eh.writeFile(try std.fmt.allocPrintSentinel(arena, "{s}/.bashrc", .{base}, 0), "PS1='$ '\nHISTFILE=\n"); + _ = setenv("HISTFILE", "/dev/null", 1); + _ = setenv("TERM", "xterm-256color", 1); + _ = setenv("LC_ALL", "C", 1); + _ = setenv("PARDES_NOTIME", "1", 1); + if (gui) { + _ = setenv("PARDES_TEST", "1", 1); + _ = setenv("PARDES_TEST_CAPTURE_DIR", base, 1); + _ = setenv("PARDES_TEST_COLS", "120", 1); + _ = setenv("PARDES_TEST_ROWS", "40", 1); + } + if (chdir(base) != 0) return error.ChdirFailed; + try writePng(arena, try std.fmt.allocPrintSentinel(arena, "{s}/solid.png", .{base}, 0)); +} + +const Run = struct { + arena: std.mem.Allocator, + h: *eh.Harness, + base: [:0]const u8, + kc: []const u8, + gui: bool, + + fn capturePath(r: *Run) ![:0]const u8 { + return std.fmt.allocPrintSentinel(r.arena, "{s}/latest.ppm", .{r.base}, 0); + } + + fn start(r: *Run) !void { + if (r.gui) { + // Up once the first frame is captured. + const path = try r.capturePath(); + const deadline = eh.nowMs() + 10_000; + while (eh.nowMs() < deadline and libc.access(path, libc.F_OK) != 0) _ = try r.h.pumpOnce(50); + if (libc.access(path, libc.F_OK) != 0) return error.GuiNeverDrew; + try r.h.pump(1500); + } else { + // A kitty terminal: graphics, then DA to close the probe. + try r.h.expectRawWaitFor("\x1b_Gi=1,a=q\x1b\\", 8000, "pardes did not probe for kitty graphics"); + try r.h.send("\x1b_Gi=1;OK\x1b\\\x1b[?1;2c"); + try r.h.expectWaitFor("$ ", 10_000, "the shell's prompt did not show"); + } + // A fresh shell pane has the keyboard, at its pty (tty mode). + try r.h.pump(400); + } + + /// Type `line` into the pane's bash and wait for `.out.done`. + fn shell(r: *Run, name: []const u8, line: []const u8) ![]const u8 { + const out = try std.fmt.allocPrintSentinel(r.arena, "{s}/{s}.out", .{ r.base, name }, 0); + const done = try std.fmt.allocPrintSentinel(r.arena, "{s}.done", .{out}, 0); + try r.h.send(line); + try r.h.send("\r"); + const deadline = eh.nowMs() + 15_000; + while (eh.nowMs() < deadline and libc.access(done, libc.F_OK) != 0) _ = try r.h.pumpOnce(50); + if (libc.access(done, libc.F_OK) != 0) { + r.h.dump(name); + return error.CaseTimedOut; + } + // Its frame drawn and shown. + try r.h.pump(600); + return readFile(r.arena, out) catch ""; + } + + fn case(r: *Run, name: []const u8) ![]const u8 { + return r.shell(name, try std.fmt.allocPrint(r.arena, "clear; {s} {s} {s}/{s}.out", .{ r.kc, name, r.base, name })); + } + + fn query(r: *Run) !void { + const got = try r.case("query"); + const kitty = std.mem.indexOf(u8, got, "\x1b_Gi=31;OK\x1b\\"); + const da = std.mem.indexOf(u8, got, "\x1b[?"); + check(kitty != null and da != null and kitty.? < da.?, "query: OK on the client's pty, ahead of DA ({f})", .{std.ascii.hexEscape(got, .lower)}); + check(std.mem.indexOf(u8, r.h.raw.items, "\x1b_Gi=31;OK") == null, "query: the answer never reaches the outer terminal", .{}); + } + + fn place(r: *Run) !void { + const raw_from = r.h.raw.items.len; + const got = try r.case("place"); + check(std.mem.eql(u8, got, "\x1b_Gi=42;OK\x1b\\" ++ sync_reply), "place: one OK for 16 chunks, then sync ({f})", .{std.ascii.hexEscape(got, .lower)}); + const raw = r.h.raw.items[raw_from..]; + // Its RGB payload (13,77,231 is "DU3n" in base64) would show whole + // were it passed through; pardes sends RGBA it decoded. + check(std.mem.indexOf(u8, raw, "\x1b_Ga=T,i=42") == null and std.mem.indexOf(u8, raw, "DU3nDU3nDU3n") == null, "place: the client's own commands are not passed through", .{}); + if (r.gui) return r.placedOnCapture(); + // Outside, pardes's own transmission of the 64x64 and its per-row + // placements, from the cell after `ANCHOR>`. + const anchor = try r.find("ANCHOR>") orelse { + check(false, "place: ANCHOR> on the outer screen", .{}); + return; + }; + const cells = try r.outerPlacements(client.side, client.side); + check(cells.count > 0, "place: pardes placed a 64x64 image in the outer terminal ({d} placements)", .{cells.count}); + if (cells.count == 0) return; + check(cells.min_x == anchor.x + 7 and cells.min_y == anchor.y, "place: at the cell after ANCHOR> (outer {d},{d}; anchor {d},{d})", .{ cells.min_x, cells.min_y, anchor.x, anchor.y }); + check(cells.rows == 4 and cells.width == 8, "place: 8x4 cells, one placement a row ({d} rows, {d} wide)", .{ cells.rows, cells.width }); + } + + fn placedOnCapture(r: *Run) !void { + const path = try r.capturePath(); + const deadline = eh.nowMs() + 5000; + var bounds: ?ColorBounds = null; + var ppm_w: usize = 0; + var ppm_h: usize = 0; + while (eh.nowMs() < deadline) { + if (captureColour(path, 0)) |seen| { + ppm_w = seen.width; + ppm_h = seen.height; + bounds = seen.bounds; + if (bounds) |b| if (b.count > 200) break; + } + _ = try r.h.pumpOnce(50); + } + const b = bounds orelse { + check(false, "place: the image's colour in the GUI capture", .{}); + return; + }; + // 8x4 cells of the capture's own cell size. + const cw = ppm_w / cols; + const ch = ppm_h / rows; + const w = b.max_x - b.min_x + 1; + const ht = b.max_y - b.min_y + 1; + check(w + 2 >= 8 * cw and w <= 8 * cw + 2 and ht + 2 >= 4 * ch and ht <= 4 * ch + 2, "place: 8x4 cells in the GUI ({d}x{d} px, cell {d}x{d})", .{ w, ht, cw, ch }); + check(b.count * 10 >= w * ht * 9, "place: solid where drawn ({d} of {d} px)", .{ b.count, w * ht }); + } + + fn media(r: *Run) !void { + const got = try r.case("media"); + for ([_][]const u8{ "\x1b_Gi=51;OK", "\x1b_Gi=52;OK", "\x1b_Gi=53;OK" }, [_][]const u8{ "t=f", "t=t", "t=s" }) |want, medium| { + check(std.mem.indexOf(u8, got, want) != null, "media: {s} loads ({f})", .{ medium, std.ascii.hexEscape(got, .lower) }); + } + } + + fn quiet(r: *Run) !void { + const got = try r.case("quiet"); + check(std.mem.indexOf(u8, got, "i=61") == null and std.mem.indexOf(u8, got, "i=62") == null and + std.mem.startsWith(u8, got, "\x1b_Gi=63;E"), "quiet: q=1's OK and q=2's error unsaid, q=0's error heard ({f})", .{std.ascii.hexEscape(got, .lower)}); + } + + fn cancel(r: *Run) !void { + const got = try r.case("cancel"); + check(std.mem.eql(u8, got, sync_reply), "cancel: a CAN'd command answers nothing ({f})", .{std.ascii.hexEscape(got, .lower)}); + if (!r.gui) check(try r.find("CANCELLED-OK") != null, "cancel: the text after it prints", .{}); + } + + fn delete(r: *Run) !void { + // Shown first (pardes transmits it outside), then deleted by a + // second run of the client in the same pane. + const raw_from = r.h.raw.items.len; + _ = try r.case("show"); + const shown = r.h.raw.items[raw_from..]; + const transmit = "\x1b_Gf=32,s=64,v=64,i="; + const i = std.mem.indexOf(u8, shown, transmit) orelse { + check(false, "delete: the image to delete was drawn outside", .{}); + return; + }; + const id_at = i + transmit.len; + const id_end = std.mem.indexOfAnyPos(u8, shown, id_at, ",;") orelse return error.BadTransmit; + const free = try std.fmt.allocPrint(r.arena, "\x1b_Ga=d,d=I,i={s}", .{shown[id_at..id_end]}); + const before = r.h.raw.items.len; + _ = try r.shell("delete", try std.fmt.allocPrint(r.arena, "{s} delete {s}/delete.out", .{ r.kc, r.base })); + try r.h.pump(400); + check(std.mem.indexOf(u8, r.h.raw.items[before..], free) != null, "delete: d=I in the pane frees what pardes sent outside ({s})", .{free[3..]}); + const cells = try r.outerPlacements(client.side, client.side); + check(cells.count == 0, "delete: no placement of it left outside ({d})", .{cells.count}); + } + + fn haveTool(r: *Run, name: []const u8) bool { + const which = std.fmt.allocPrintSentinel(r.arena, "command -v {s} >/dev/null 2>&1", .{name}, 0) catch return false; + return system(which) == 0; + } + + fn icat(r: *Run) !void { + if (!r.haveTool("kitten")) return skip("kitten icat: not installed", .{}); + for ([_][]const u8{ "stream", "detect" }) |mode| { + const raw_from = r.h.raw.items.len; + const name = try std.fmt.allocPrint(r.arena, "icat-{s}", .{mode}); + const line = try std.fmt.allocPrint(r.arena, "clear; kitten icat --transfer-mode={s} --align=left {s}/solid.png 2>{s}/{s}.out; touch {s}/{s}.out.done", .{ mode, r.base, r.base, name, r.base, name }); + const err = try r.shell(name, line); + if (r.gui) { + try r.placedNear(name); + continue; + } + const raw = r.h.raw.items[raw_from..]; + const sent = std.mem.indexOf(u8, raw, "\x1b_Gf=32,s=64,v=64,i=") != null; + check(sent and err.len == 0, "kitten icat --transfer-mode={s}: drawn outside ({s})", .{ mode, std.mem.trim(u8, err, " \r\n") }); + } + } + + fn chafa(r: *Run) !void { + if (!r.haveTool("chafa")) return skip("chafa: not installed", .{}); + const raw_from = r.h.raw.items.len; + const err = try r.shell("chafa", try std.fmt.allocPrint(r.arena, "clear; chafa -f kitty -s 8x4 {s}/solid.png 2>{s}/chafa.out; touch {s}/chafa.out.done", .{ r.base, r.base, r.base })); + if (r.gui) return r.placedNear("chafa"); + const raw = r.h.raw.items[raw_from..]; + // chafa scales to the cells it asked for: any image transmitted. + check(std.mem.indexOf(u8, raw, "\x1b_Gf=32,s=") != null and err.len == 0, "chafa -f kitty: drawn outside ({s})", .{std.mem.trim(u8, err, " \r\n")}); + } + + fn placedNear(r: *Run, name: []const u8) !void { + const path = try r.capturePath(); + const deadline = eh.nowMs() + 4000; + var count: usize = 0; + while (eh.nowMs() < deadline) { + if (captureColour(path, 4)) |seen| { + count = if (seen.bounds) |b| b.count else 0; + if (count > 200) break; + } + _ = try r.h.pumpOnce(50); + } + check(count > 200, "{s}: drawn in the GUI ({d} px of its colour)", .{ name, count }); + } + + /// Where `needle` is on the outer screen, in cells. + fn find(r: *Run, needle: []const u8) !?struct { x: usize, y: usize } { + const text = try r.h.screenText(); + defer gpa.free(text); + var y: usize = 0; + var lines = std.mem.splitScalar(u8, text, '\n'); + while (lines.next()) |line| : (y += 1) { + if (std.mem.indexOf(u8, line, needle)) |x| return .{ .x = try std.unicode.utf8CountCodepoints(line[0..x]), .y = y }; + } + return null; + } + + const Cells = struct { count: usize = 0, min_x: usize = std.math.maxInt(usize), min_y: usize = std.math.maxInt(usize), rows: usize = 0, width: usize = 0 }; + + /// The outer terminal's placements of its `w`x`h` images, in viewport cells. + fn outerPlacements(r: *Run, w: u32, h: u32) !Cells { + const screen = r.h.term.screens.active; + const storage = &screen.kitty_images; + var out: Cells = .{}; + var row_seen: [rows]bool = @splat(false); + var it = storage.placements.iterator(); + while (it.next()) |entry| { + const img = storage.imageById(entry.key_ptr.image_id) orelse continue; + if (img.width != w or img.height != h) continue; + const pin = switch (entry.value_ptr.location) { + .pin => |pin| pin, + else => continue, + }; + const at = screen.pages.pointFromPin(.viewport, pin.*) orelse continue; + out.count += 1; + out.min_x = @min(out.min_x, at.viewport.x); + out.min_y = @min(out.min_y, at.viewport.y); + if (at.viewport.y < rows and !row_seen[at.viewport.y]) { + row_seen[at.viewport.y] = true; + out.rows += 1; + } + out.width = @max(out.width, entry.value_ptr.columns); + } + return out; + } +}; + +extern "c" fn system(command: [*:0]const u8) c_int; +extern "c" fn realpath(path: [*:0]const u8, resolved: ?[*]u8) ?[*:0]u8; + +fn absolute(arena: std.mem.Allocator, path: []const u8) ![:0]const u8 { + var buf: [4096]u8 = undefined; + const z = try arena.dupeSentinel(u8, path, 0); + const got = realpath(z, &buf) orelse return error.NoSuchArtifact; + return arena.dupeSentinel(u8, std.mem.span(got), 0); +} + +/// The GUI's latest capture: its size and where the client's colour is. +fn captureColour(path: [:0]const u8, tolerance: u8) ?struct { width: usize, height: usize, bounds: ?ColorBounds } { + var scratch: std.heap.ArenaAllocator = .init(gpa); + defer scratch.deinit(); + const bytes = readFile(scratch.allocator(), path) catch return null; + const ppm = ppmView(bytes) orelse return null; + return .{ .width = ppm.width, .height = ppm.height, .bounds = colorBounds(ppm, client.colour, tolerance) }; +} + +const ColorBounds = struct { count: usize, min_x: usize, min_y: usize, max_x: usize, max_y: usize }; +const PpmView = struct { width: usize, height: usize, pixels: []const u8 }; + +/// Where `colour` is in the capture, each channel within `tolerance` +/// (chafa hands back its pixels a step off the source's). +fn colorBounds(ppm: PpmView, colour: [3]u8, tolerance: u8) ?ColorBounds { + var b: ColorBounds = .{ .count = 0, .min_x = std.math.maxInt(usize), .min_y = std.math.maxInt(usize), .max_x = 0, .max_y = 0 }; + for (0..ppm.width * ppm.height) |i| { + const px = ppm.pixels[i * 3 ..][0..3]; + const near = for (px, colour) |got, want| { + if (@max(got, want) - @min(got, want) > tolerance) break false; + } else true; + if (!near) continue; + const x = i % ppm.width; + const y = i / ppm.width; + b.count += 1; + b.min_x = @min(b.min_x, x); + b.min_y = @min(b.min_y, y); + b.max_x = @max(b.max_x, x); + b.max_y = @max(b.max_y, y); + } + return if (b.count == 0) null else b; +} + +fn ppmView(bytes: []const u8) ?PpmView { + if (!std.mem.startsWith(u8, bytes, "P6\n")) return null; + const dims_end = std.mem.indexOfScalarPos(u8, bytes, 3, '\n') orelse return null; + var dims = std.mem.splitScalar(u8, bytes[3..dims_end], ' '); + const width = std.fmt.parseUnsigned(usize, dims.next() orelse return null, 10) catch return null; + const height = std.fmt.parseUnsigned(usize, dims.next() orelse return null, 10) catch return null; + const max_end = std.mem.indexOfScalarPos(u8, bytes, dims_end + 1, '\n') orelse return null; + const len = width * height * 3; + if (bytes.len -| (max_end + 1) < len) return null; + return .{ .width = width, .height = height, .pixels = bytes[max_end + 1 ..][0..len] }; +} + +fn readFile(arena: std.mem.Allocator, path: [:0]const u8) ![]u8 { + const fd = libc.open(path, .{ .ACCMODE = .RDONLY }, @as(libc.mode_t, 0)); + if (fd < 0) return error.OpenFailed; + defer _ = libc.close(fd); + var out: std.ArrayList(u8) = .empty; + var buf: [1 << 16]u8 = undefined; + while (true) { + const n = libc.read(fd, &buf, buf.len); + if (n < 0) return error.ReadFailed; + if (n == 0) break; + try out.appendSlice(arena, buf[0..@intCast(n)]); + } + return out.items; +} + +/// A 64x64 PNG of the client's colour, stored (uncompressed) deflate. +fn writePng(arena: std.mem.Allocator, path: [:0]const u8) !void { + const side = client.side; + var raw: std.ArrayList(u8) = .empty; + for (0..side) |_| { + try raw.append(arena, 0); + for (0..side) |_| try raw.appendSlice(arena, &client.colour); + } + var z: std.ArrayList(u8) = .empty; + try z.appendSlice(arena, &.{ 0x78, 0x01 }); + var at: usize = 0; + while (at < raw.items.len) { + const n: u16 = @intCast(@min(65535, raw.items.len - at)); + const final: u8 = if (at + n == raw.items.len) 1 else 0; + try z.append(arena, final); + try z.appendSlice(arena, &std.mem.toBytes(std.mem.nativeToLittle(u16, n))); + try z.appendSlice(arena, &std.mem.toBytes(std.mem.nativeToLittle(u16, ~n))); + try z.appendSlice(arena, raw.items[at..][0..n]); + at += n; + } + try z.appendSlice(arena, &std.mem.toBytes(std.mem.nativeToBig(u32, std.hash.Adler32.hash(raw.items)))); + var png: std.ArrayList(u8) = .empty; + try png.appendSlice(arena, "\x89PNG\r\n\x1a\n"); + var ihdr: [13]u8 = undefined; + std.mem.writeInt(u32, ihdr[0..4], side, .big); + std.mem.writeInt(u32, ihdr[4..8], side, .big); + ihdr[8..13].* = .{ 8, 2, 0, 0, 0 }; + try chunk(arena, &png, "IHDR", &ihdr); + try chunk(arena, &png, "IDAT", z.items); + try chunk(arena, &png, "IEND", ""); + try eh.writeFile(path, png.items); +} + +fn chunk(arena: std.mem.Allocator, png: *std.ArrayList(u8), kind: *const [4]u8, data: []const u8) !void { + try png.appendSlice(arena, &std.mem.toBytes(std.mem.nativeToBig(u32, @intCast(data.len)))); + try png.appendSlice(arena, kind); + try png.appendSlice(arena, data); + var crc = std.hash.Crc32.init(); + crc.update(kind); + crc.update(data); + try png.appendSlice(arena, &std.mem.toBytes(std.mem.nativeToBig(u32, crc.final()))); +} + +fn removeTree(arena: std.mem.Allocator, base: [:0]const u8) void { + const cmd = std.fmt.allocPrintSentinel(arena, "rm -rf '{s}'", .{base}, 0) catch return; + _ = system(cmd); +} -- cgit v1.3 From caffd9c1f8742a17431f7de0a2824d3fc02bfd72 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 28 Oct 2026 21:59:19 -0300 Subject: kitty z-index: a terminal image's z= goes with it, images go to the shell lowest first, and the tty hands z on to the outer terminal (under the text below 0); real clients recorded, replayed and run live z-index was lost: an ImagePlace had none, so every image went over the cells in hash-map order, a z<0 picture (a background under text) over the text and overlapping images in any order. ImagePlace.z now carries the placement's z (a virtual placement's from its placeholder target), TerminalImages sorts what it appends lowest z first (stable), and the tty's exactKittyPlacement sets vaxis's z_index, so a kitty terminal outside stacks them and puts z<0 under the text. The GUI draws them in that order but still over the cells: under the text there needs a glyph pass after the images (ui.frag's clear_bg_bit) in gui.zig's vertex buffer. Real clients: test/kitty_harness.zig's PARDES_KITTY_EXPLORE runs commands in the pane under script(1) and prints what pardes placed outside; kitten icat 0.49.2 (--align left/center/right, --place, --scale-up, --unicode-placeholder, --clear, file/memory/stream/detect), chafa 1.18.3, viu and yazi 26.9.1 all landed where they should. Their recorded traffic (test/kitty-fixtures/*.vt) replays through the core (test/kitty.zig) to the cells they drew live. The harness now also runs yazi live (shared memory, a virtual placement, placeholders), checks z=-1 outside, and runs a second pardes under a terminal without kitty graphics: no graphics command reaches it and the image is glyph art in all 32 cells. The harness empties NO_COLOR (zig build sets it, and vaxis drew no colour at all under the harness) by setenv, not unsetenv, which compacts the environment std captured. Also: tests that a pane's image follows pardes's own scrollback, an edited copy taller than its rows, a narrow pane's edge, Collapse and a cell-size change; and a knownGap: images do not survive a dump (Dump, Handover, a pane reopened from the Store), whose VT text has none. Co-Authored-By: Claude Opus 5.5 --- src/TerminalImages.zig | 15 ++- src/surface.zig | 6 + src/tty/tty.zig | 2 + test/kitty-fixtures/chafa.vt | 2 + test/kitty-fixtures/icat-center.vt | 1 + test/kitty-fixtures/icat-clear.vt | 1 + test/kitty-fixtures/icat-left.vt | 1 + test/kitty-fixtures/icat-place.vt | 1 + test/kitty-fixtures/icat-placeholder.vt | 4 + test/kitty-fixtures/icat-right.vt | 1 + test/kitty.zig | 225 +++++++++++++++++++++++++++++++- test/kitty_client.zig | 3 + test/kitty_harness.zig | 116 ++++++++++++++++ 13 files changed, 369 insertions(+), 9 deletions(-) create mode 100644 test/kitty-fixtures/chafa.vt create mode 100644 test/kitty-fixtures/icat-center.vt create mode 100644 test/kitty-fixtures/icat-clear.vt create mode 100644 test/kitty-fixtures/icat-left.vt create mode 100644 test/kitty-fixtures/icat-place.vt create mode 100644 test/kitty-fixtures/icat-placeholder.vt create mode 100644 test/kitty-fixtures/icat-right.vt (limited to 'src/TerminalImages.zig') diff --git a/src/TerminalImages.zig b/src/TerminalImages.zig index f3333460..f26b5852 100644 --- a/src/TerminalImages.zig +++ b/src/TerminalImages.zig @@ -162,6 +162,14 @@ pub fn draw( const ch: u32 = @max(1, p.cell_pixels.h); const pixels = p.native_images and !ti.petscii; const ctx: Ctx = .{ .ti = ti, .p = p, .s = s, .pane = pane_id, .serial = serial, .tx = tx, .body_y = body_y, .cols = cols, .rows_of = rows_of, .cw = cw, .ch = ch, .pixels = pixels }; + // Handed on lowest z first (the storage's order is a hash map's), the + // order a shell draws them in; equal z keeps the order they came in. + const first = s.nimages; + defer std.sort.insertion(?pardes.ImagePlace, s.images[first..s.nimages], {}, struct { + fn lessThan(_: void, a: ?pardes.ImagePlace, b: ?pardes.ImagePlace) bool { + return (if (a) |x| x.z else 0) < (if (b) |y| y.z else 0); + } + }.lessThan); // Virtual placements: shown through the placeholder cells, one run of // them on a row at a time. The placeholders themselves are not text. @@ -181,7 +189,7 @@ pub fn draw( const target = storage.placeholderTarget(run.image_id, run.placement_id) orelse continue; const rp = run.renderPlacement(&target.placement, &img, cw, ch) catch continue; if (rp.dest_width == 0 or rp.dest_height == 0 or rp.source_width == 0 or rp.source_height == 0) continue; - ctx.place(img, .{ .x = rp.source_x, .y = rp.source_y, .w = rp.source_width, .h = rp.source_height }, .{ + ctx.place(img, target.placement.z, .{ .x = rp.source_x, .y = rp.source_y, .w = rp.source_width, .h = rp.source_height }, .{ .x = @as(i64, at.viewport.x) * cw + rp.offset_x, .y = @as(i64, v) * ch + rp.offset_y, .w = rp.dest_width, @@ -223,7 +231,7 @@ pub fn draw( const sw = if (placed.source_width > 0) @min(placed.source_width, img.width - sx) else img.width - sx; const sh = if (placed.source_height > 0) @min(placed.source_height, img.height - sy) else img.height - sy; if (size.width == 0 or size.height == 0 or sw == 0 or sh == 0) continue; - ctx.place(img, .{ .x = sx, .y = sy, .w = sw, .h = sh }, .{ + ctx.place(img, placed.z, .{ .x = sx, .y = sy, .w = sw, .h = sh }, .{ .x = (@as(i64, at.screen.x) + dx) * cw + placed.x_offset, .y = (@as(i64, at.screen.y) - @as(i64, origin.screen.y) + dy) * ch + placed.y_offset, .w = size.width, @@ -248,7 +256,7 @@ const Ctx = struct { /// Draw `src` of `img` over `dst`, one cell row of it at a time: a row /// is shown, or not, or shown elsewhere, as the body lays it out. - fn place(ctx: Ctx, img: gfx.Image, src: PixelRect, dst: Rect) void { + fn place(ctx: Ctx, img: gfx.Image, z: i32, src: PixelRect, dst: Rect) void { const cw: i64 = ctx.cw; const ch: i64 = ctx.ch; const x0 = @max(dst.x, 0); @@ -294,6 +302,7 @@ const Ctx = struct { .rgba = rgba, .iw = img.width, .ih = img.height, + .z = z, }); continue; } diff --git a/src/surface.zig b/src/surface.zig index 8ed4074c..aa0068e3 100644 --- a/src/surface.zig +++ b/src/surface.zig @@ -257,6 +257,12 @@ pub const ImagePlace = struct { rgba: []const u8, iw: usize, ih: usize, + /// A terminal's kitty graphics stacking order (`z=`): the surface lists + /// a pane's images lowest first, so a shell drawing them in order puts + /// a higher one over a lower; below 0 the program means it under the + /// text, which the tty passes on to the outer terminal (the GUI draws + /// every image over the cells still). 0 for every other image. + z: i32 = 0, /// Rows [y, y+h) of `rgba` are the only ones that differ from the /// same pane page at revision `from`: a shell still holding that one may /// update just these rows instead of taking the whole image again. diff --git a/src/tty/tty.zig b/src/tty/tty.zig index 5ad02c28..a358051e 100644 --- a/src/tty/tty.zig +++ b/src/tty/tty.zig @@ -847,6 +847,8 @@ fn exactKittyPlacement( .height = std.math.cast(u16, src_h) orelse return null, }, .pixel_offset = if (pixel_x != 0 or pixel_y != 0) .{ .x = @intCast(pixel_x), .y = @intCast(pixel_y) } else null, + // The outer terminal stacks them, under the text below 0. + .z_index = if (place.z != 0) place.z else null, .size = if (full) .{ .cols = std.math.cast(u16, cols) orelse return null, .rows = 1 } else diff --git a/test/kitty-fixtures/chafa.vt b/test/kitty-fixtures/chafa.vt new file mode 100644 index 00000000..5a882361 --- /dev/null +++ b/test/kitty-fixtures/chafa.vt @@ -0,0 +1,2 @@ +]10;?\]11;?\[?25l_Ga=T,f=32,s=64,v=64,c=8,r=4,m=1,q=2\_Gm=1;DU3n/w1N5/8NTef/DU3n/w1N5/8NTef/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Tef/DU3n/w1N5/8NTef/DU3n/w1N5/8NTef/DU3n/w1N5/8NTef/DU3n/w1N5/8NTef/DU3n/w1N5/8NTef/DU3n/w1N5/8NTef/DU3n/w1N5/8NTef/DU3n/w1N5/8NTef/DU3n/w1N5/8NTef/\_Gm=1;DU3n/w1N5/8NTef/DU3n/w1N5/8NTef/DU3n/w1N5/8NTef/DU3n/w1N5/8NTef/DU3n/w1N5/8NTef/DU3n/w==\_Gm=0\ +[?25h \ No newline at end of file diff --git a/test/kitty-fixtures/icat-center.vt b/test/kitty-fixtures/icat-center.vt new file mode 100644 index 00000000..de47d4cd --- /dev/null +++ b/test/kitty-fixtures/icat-center.vt @@ -0,0 +1 @@ +[?s[*x[?1l[?5l[?2004l[?1000l[?1002l[?1003l[?1005l[?1006l[?8h[?7h[?25h_Ga=q,f=24,s=1,v=1,S=3,i=1;MTIz\_Ga=q,f=24,t=t,s=1,v=1,S=47,i=2;L2Rldi9zaG0va2l0dHktdHR5LWdyYXBoaWNzLXByb3RvY29sLTIyMDEyODU0MjQ\_Ga=q,f=24,t=s,s=1,v=1,S=19,i=3;L2ljYXQtRVRKSEZYWEpPVkxBUw\7[?r8 _Ga=T,q=2,f=100,s=64,v=64;iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAwS0lEQVR4AQFAML/PAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3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ecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nD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N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3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w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTec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N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNT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TecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3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w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5+0wES1gqxrAAAAAAElFTkSuQmCC\ diff --git a/test/kitty-fixtures/icat-clear.vt b/test/kitty-fixtures/icat-clear.vt new file mode 100644 index 00000000..ba7cd735 --- /dev/null +++ b/test/kitty-fixtures/icat-clear.vt @@ -0,0 +1 @@ +_Ga=d,d=A\_Ga=d,d=A\[?s[*x[?1l[?5l[?2004l[?1000l[?1002l[?1003l[?1005l[?1006l[?8h[?7h[?25h_Ga=q,f=24,s=1,v=1,S=3,i=1;MTIz\_Ga=q,f=24,t=t,s=1,v=1,S=47,i=2;L2Rldi9zaG0va2l0dHktdHR5LWdyYXBoaWNzLXByb3RvY29sLTM0Mjk2MDk4NzM\_Ga=q,f=24,t=s,s=1,v=1,S=19,i=3;L2ljYXQtM1ozWTZQSVpSTVpDRQ\7[?r8 \ No newline at end of file diff --git a/test/kitty-fixtures/icat-left.vt b/test/kitty-fixtures/icat-left.vt new file mode 100644 index 00000000..4c913e2f --- /dev/null +++ b/test/kitty-fixtures/icat-left.vt @@ -0,0 +1 @@ +[?s[*x[?1l[?5l[?2004l[?1000l[?1002l[?1003l[?1005l[?1006l[?8h[?7h[?25h_Ga=q,f=24,s=1,v=1,S=3,i=1;MTIz\_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1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNT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TecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU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NTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3n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1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU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5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecN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1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTec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at-place.vt b/test/kitty-fixtures/icat-place.vt new file mode 100644 index 00000000..3f59865f --- /dev/null +++ b/test/kitty-fixtures/icat-place.vt @@ -0,0 +1 @@ +[?s[*x[?1l[?5l[?2004l[?1000l[?1002l[?1003l[?1005l[?1006l[?8h[?7h[?25h_Ga=q,f=24,s=1,v=1,S=3,i=1;MTIz\_Ga=q,f=24,t=t,s=1,v=1,S=47,i=2;L2Rldi9zaG0va2l0dHktdHR5LWdyYXBoaWNzLXByb3RvY29sLTM5ODY5NDMyNTM\_Ga=q,f=24,t=s,s=1,v=1,S=19,i=3;L2ljYXQtVkVPN0VHWFpTVzdMVw\7[?r8 _Ga=T,q=2,f=100,C=1,s=64,v=64;iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAwS0lEQVR4AQFAML/PAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3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w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nD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N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3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w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNT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TecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nD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N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3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w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nD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N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5+0wES1gqxrAAAAAAElFTkSuQmCC\ \ No newline at end of file diff --git a/test/kitty-fixtures/icat-placeholder.vt b/test/kitty-fixtures/icat-placeholder.vt new file mode 100644 index 00000000..87692a51 --- /dev/null +++ b/test/kitty-fixtures/icat-placeholder.vt @@ -0,0 +1,4 @@ +[?s[*x[?1l[?5l[?2004l[?1000l[?1002l[?1003l[?1005l[?1006l[?8h[?7h[?25h_Ga=q,f=24,s=1,v=1,S=3,i=1;MTIz\_Ga=q,f=24,t=t,s=1,v=1,S=47,i=2;L2Rldi9zaG0va2l0dHktdHR5LWdyYXBoaWNzLXByb3RvY29sLTM0Mzc4NzgyNzA\_Ga=q,f=24,t=s,s=1,v=1,S=19,i=3;L2ljYXQtNVNMTlg2UjQ3VFBOSw\7[?r8 _Ga=T,q=2,f=100,U=1,s=64,v=64,c=8,r=4,i=159064709;iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAAlC+aJAAAwS0lEQVR4AQFAML/PAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecN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NTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3n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1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU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5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3n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1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTec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TecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5+0wES1gqxrAAAAAAElFTkSuQmCC\[38:2:123:34:133m􎻮̅̅͊􎻮̅̍͊􎻮̅̎͊􎻮̅̐͊􎻮̅̒͊􎻮̅̽͊􎻮̅̾͊􎻮̅̿͊ + 􎻮̍̅͊􎻮̍̍͊􎻮̍̎͊􎻮̍̐͊􎻮̍̒͊􎻮̍̽͊􎻮̍̾͊􎻮̍̿͊ + 􎻮̎̅͊􎻮̎̍͊􎻮̎̎͊􎻮̎̐͊􎻮̎̒͊􎻮̎̽͊􎻮̎̾͊􎻮̎̿͊ + 􎻮̐̅͊􎻮̐̍͊􎻮̐̎͊􎻮̐̐͊􎻮̐̒͊􎻮̐̽͊􎻮̐̾͊􎻮̐̿͊ diff --git a/test/kitty-fixtures/icat-right.vt b/test/kitty-fixtures/icat-right.vt new file mode 100644 index 00000000..d1470d7f --- /dev/null +++ b/test/kitty-fixtures/icat-right.vt @@ -0,0 +1 @@ +[?s[*x[?1l[?5l[?2004l[?1000l[?1002l[?1003l[?1005l[?1006l[?8h[?7h[?25h_Ga=q,f=24,s=1,v=1,S=3,i=1;MTIz\_Ga=q,f=24,t=t,s=1,v=1,S=47,i=2;L2Rldi9zaG0va2l0dHktdHR5LWdyYXBoaWNzLXByb3RvY29sLTM3MjQwMjUzNzE\_Ga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5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3n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1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecN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ecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3n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1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU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5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3n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1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5wANTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecNTecADU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nDU3nAA1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5w1N5+0wES1gqxrAAAAAAElFTkSuQmCC\ diff --git a/test/kitty.zig b/test/kitty.zig index a100e7a6..de4dd605 100644 --- a/test/kitty.zig +++ b/test/kitty.zig @@ -423,14 +423,26 @@ test "kitty: an image number gets an id, which the reply carries" { try std.testing.expect(r.storage(0).imageByNumber(5) != null); } -test "kitty: z-index orders images, and a negative one goes under the text" { +test "kitty: z-index travels with the image, and images are handed on lowest z first" { var r = try Rig.init(1); defer r.deinit(); - r.feed(0, "\x1b[1;1H" ++ apc("a=T,i=8,f=24,s=4,v=2,c=2,r=1,z=-1,q=2", rgb_b64) ++ "\x1b[1;1Htext"); - try std.testing.expectEqual(@as(usize, 1), r.placementCount(0)); - var it = r.storage(0).placements.iterator(); - try std.testing.expectEqual(@as(i32, -1), it.next().?.value_ptr.z); - try knownGap("pardes draws every terminal image over the cells, in storage order: an ImagePlace has no z-index, so z<0 (under the text) and the order between overlapping images are lost", @hasField(pardes.ImagePlace, "z")); + // Three overlapping at (0,0), given out of order; the virtual one's z + // is its placement's. + r.feed(0, "\x1b[1;1H" ++ apc("a=T,i=8,f=24,s=4,v=2,c=2,r=1,z=5,C=1,q=2", rgb_b64) ++ + apc("a=T,i=9,f=24,s=4,v=2,c=2,r=1,z=-7,C=1,q=2", rgb_b64) ++ + apc("a=T,i=10,f=24,s=4,v=2,c=2,r=1,C=1,q=2", rgb_b64) ++ + apc("a=T,U=1,i=11,f=24,s=4,v=2,c=1,r=1,z=3,q=2", rgb_b64) ++ + "\x1b[1;1H\x1b[38;2;0;0;11m\u{10EEEE}\u{0305}\u{0305}\x1b[39m"); + const drawn = try r.places(); + try std.testing.expectEqual(@as(usize, 4), drawn.len); + var zs: [4]i32 = undefined; + var ids: [4]u32 = undefined; + for (drawn, 0..) |place, i| { + zs[i] = place.?.z; + ids[i] = place.?.native.page; + } + try std.testing.expectEqualSlices(i32, &.{ -7, 0, 3, 5 }, &zs); + try std.testing.expectEqualSlices(u32, &.{ 9, 10, 11, 8 }, &ids); } /// A screen with two images in known places, for the deletes: @@ -1134,3 +1146,204 @@ test "kitty: fuzzed traffic neither crashes nor leaks, and every answer parses" } if (seeds != 24) std.debug.print("kitty fuzz: {d} seeds of {d} steps ok\n", .{ seeds, steps }); } + +// ---- An image's pane, as it lives ---- + +test "kitty: scrolled back by pardes, an image shows on its row; scrolled forward, it goes" { + var r = try Rig.init(1); + defer r.deinit(); + const pane = r.pane(0); + r.feed(0, "\x1b[1;1Hmarker" ++ apc("a=T,i=20,f=24,s=4,v=2,c=2,r=1,q=2", rgb_b64)); + var nl: [2 * 60]u8 = undefined; + for (0..60) |i| nl[2 * i ..][0..2].* = "\r\n".*; + r.feed(0, &nl); + try std.testing.expectEqual(@as(usize, 0), (try r.placesOf(20)).len); + // Back to the top of the history: the marker row is the body's first. + terminal.scrollGrid(pane, -1000); + const o = r.origin(0); + const drawn = try r.placesOf(20); + try std.testing.expectEqual(@as(usize, 1), drawn.len); + try std.testing.expectEqual(o.y, drawn[0].y); + try std.testing.expectEqual(o.x + 6, drawn[0].x); + terminal.followOutput(pane); + try std.testing.expectEqual(@as(usize, 0), (try r.placesOf(20)).len); +} + +test "kitty: an edited copy taller than the rows it covers pushes the images below it down" { + var r = try Rig.init(1); + defer r.deinit(); + const pane = r.pane(0); + r.feed(0, "\x1b[1;1Hone\r\ntwo\r\n\x1b[6;1H" ++ apc("a=T,i=21,f=24,s=4,v=2,c=2,r=1,q=2", rgb_b64)); + const o = r.origin(0); + try std.testing.expectEqual(o.y + 5, (try r.placesOf(21))[0].y); + // Row 1 ("two") edited into three lines. + pane.body.mode = .normal; + pane.ovl = .{ .row = 1, .rows = 1, .text = try gpa.dupe(u8, "two\nthree\nfour") }; + const drawn = try r.placesOf(21); + try std.testing.expectEqual(@as(usize, 1), drawn.len); + try std.testing.expectEqual(o.y + 7, drawn[0].y); +} + +test "kitty: an image wider than its pane is cut at the pane's edge, never drawn over the next one" { + var r = try Rig.init(3); + defer r.deinit(); + // The classic boot: two columns. Pane 0 is in the left one. + const rect = r.p.rects[0]; + const o = r.origin(0); + const right = rect.x + rect.w; + // 2x1 cells at its last-but-one column: one cell is the pane's. + const at = try std.fmt.allocPrint(r.frame.allocator(), "\x1b[1;{d}H", .{r.pane(0).cols}); + r.feed(0, at); + r.feed(0, apc("a=T,i=22,f=24,s=4,v=2,c=4,r=1,q=2", rgb_b64)); + const drawn = try r.placesOf(22); + try std.testing.expectEqual(@as(usize, 1), drawn.len); + try std.testing.expect(drawn[0].x + drawn[0].w <= o.x + r.pane(0).cols); + try std.testing.expect(drawn[0].x + drawn[0].w <= right); + // And the pixels it takes are only that cell's. + const g = drawn[0].native.geometry.?; + try std.testing.expect(g.dst.w <= @as(u32, drawn[0].w) * 10); +} + +test "kitty: a collapsed pane draws no image" { + var r = try Rig.init(3); + defer r.deinit(); + r.feed(1, "\x1b[1;1H" ++ apc("a=T,i=23,f=24,s=4,v=2,c=2,r=1,q=2", rgb_b64)); + try std.testing.expectEqual(@as(usize, 1), (try r.placesOf(23)).len); + try std.testing.expect(r.p.executeBuiltinLine(1, "Collapse")); + try std.testing.expectEqual(@as(usize, 0), (try r.placesOf(23)).len); + try std.testing.expect(r.p.executeBuiltinLine(1, "Collapse")); + try std.testing.expectEqual(@as(usize, 1), (try r.placesOf(23)).len); +} + +test "kitty: a new cell size (font zoom) redraws an image at the same cells, scaled to the new size" { + var r = try Rig.init(1); + defer r.deinit(); + r.feed(0, "\x1b[2;3H" ++ apc("a=T,i=24,f=24,s=4,v=2,c=2,r=1,q=2", rgb_b64)); + var drawn = try r.placesOf(24); + try std.testing.expectEqual(@as(u32, 20), drawn[0].native.geometry.?.dst.w); + r.p.update(.{ .resize = .{ .cols = 120, .rows = 40, .cell_pixels = .{ .w = 15, .h = 30 } } }); + r.drain(); + drawn = try r.placesOf(24); + const o = r.origin(0); + try std.testing.expectEqual(@as(usize, 1), drawn.len); + try std.testing.expectEqual(o.x + 2, drawn[0].x); + try std.testing.expectEqual(o.y + 1, drawn[0].y); + try std.testing.expectEqual(@as(u32, 30), drawn[0].native.geometry.?.dst.w); + try std.testing.expectEqual(@as(u32, 30), drawn[0].native.geometry.?.dst.h); +} + +test "kitty: a dumped and restored terminal keeps its images" { + var r = try Rig.init(1); + defer r.deinit(); + r.feed(0, "\x1b[1;1Hpicture" ++ apc("a=T,i=25,f=24,s=4,v=2,c=2,r=1,q=2", rgb_b64)); + try pardes.dump.dumpState(r.p); + const restored = try pardes.dump.restore(r.p, r.p.dump_out.?, "/tmp/pardes-kitty.dump.zon"); + defer restored.deinit(); + const pane = restored.panes[0].?; + const kept = pane.terminal != null and pane.terminal.?.vt.screens.active.kitty_images.placements.count() > 0; + try knownGap("a terminal's kitty images do not survive a dump (Dump/Load, Handover, a closed pane reopened from the Store): dumpPane writes the screen as VT text (ScreenFormatter), which has no images; ghostty's snapshot format carries them but is unstable (v1)", kept); +} + +// ---- Real clients' traffic ---- +// +// What kitten icat 0.49.2 and chafa 1.18.3 wrote to a pardes pane, recorded +// with script(1) between them and the pane (`PARDES_KITTY_EXPLORE` in +// test/kitty_harness.zig), a 64x64 PNG on a 118-column pane with 8x16 cells: +// their probes, then the image streamed. Replayed in 4 KiB reads, each must +// answer whole and draw its first row where it drew live. + +const Recorded = struct { + name: []const u8, + bytes: []const u8, + /// The pane cell its top-left landed on, live; null: draws nothing. + at: ?[2]u16, +}; + +const recorded = [_]Recorded{ + .{ .name = "icat --align=left", .bytes = @embedFile("kitty-fixtures/icat-left.vt"), .at = .{ 0, 0 } }, + .{ .name = "icat --align=center", .bytes = @embedFile("kitty-fixtures/icat-center.vt"), .at = .{ 55, 0 } }, + .{ .name = "icat --align=right", .bytes = @embedFile("kitty-fixtures/icat-right.vt"), .at = .{ 110, 0 } }, + .{ .name = "icat --place 10x5@20x3", .bytes = @embedFile("kitty-fixtures/icat-place.vt"), .at = .{ 21, 3 } }, + .{ .name = "icat --unicode-placeholder", .bytes = @embedFile("kitty-fixtures/icat-placeholder.vt"), .at = .{ 0, 0 } }, + .{ .name = "chafa -f kitty -s 8x4", .bytes = @embedFile("kitty-fixtures/chafa.vt"), .at = .{ 0, 0 } }, + .{ .name = "icat --clear", .bytes = @embedFile("kitty-fixtures/icat-clear.vt"), .at = null }, +}; + +test "kitty: recorded kitten icat and chafa traffic replays: answers whole, images where they were drawn" { + for (recorded) |rec| { + var r = try Rig.init(1); + defer r.deinit(); + r.p.update(.{ .resize = .{ .cols = 120, .rows = 40, .cell_pixels = .{ .w = 8, .h = 16 } } }); + r.drain(); + _ = try r.take(0); + r.feedSplit(0, rec.bytes, 4096); + const got = try r.take(0); + std.testing.expect(answersParse(got)) catch |err| { + std.debug.print("{s}: unparsable answer {f}\n", .{ rec.name, std.ascii.hexEscape(got, .lower) }); + return err; + }; + const drawn = try r.places(); + const want = rec.at orelse { + try std.testing.expectEqual(@as(usize, 0), drawn.len); + continue; + }; + const o = r.origin(0); + var top: ?pardes.ImagePlace = null; + for (drawn) |maybe| if (maybe) |place| { + if (top == null or place.y < top.?.y or (place.y == top.?.y and place.x < top.?.x)) top = place; + }; + const first = top orelse { + std.debug.print("{s}: nothing drawn\n", .{rec.name}); + return error.NothingDrawn; + }; + std.testing.expectEqual([2]u16{ o.x + want[0], o.y + want[1] }, [2]u16{ first.x, first.y }) catch |err| { + std.debug.print("{s}: drawn at {d},{d}, live at {d},{d}\n", .{ rec.name, first.x - o.x, first.y - o.y, want[0], want[1] }); + return err; + }; + } +} + +test "kitty: under a shell that draws no pixels, a 64x64 image over 8x4 cells is glyph art in every cell" { + var r = try Rig.init(1); + defer r.deinit(); + r.p.native_images = false; + r.p.update(.{ .resize = .{ .cols = 120, .rows = 40, .cell_pixels = .{ .w = 8, .h = 16 } } }); + r.drain(); + // Not the frame's arena: each frame resets that. + var data: std.heap.ArenaAllocator = .init(gpa); + defer data.deinit(); + const arena = data.allocator(); + const px = try arena.alloc(u8, 64 * 64 * 3); + for (0..64 * 64) |i| px[i * 3 ..][0..3].* = .{ 13, 77, 231 }; + const enc = try b64(arena, px); + for ([_]bool{ false, true }) |helix| { + if (helix) try std.testing.expect(r.p.executeBuiltinLine(0, "Theme helix")); + // As test/kitty_client.zig's `place` sends it: after text, in + // 1 KiB chunks. + var cmds: std.ArrayList(u8) = .empty; + try cmds.appendSlice(arena, "\x1b[H\x1b[2J\r\nANCHOR>"); + var at: usize = 0; + while (at < enc.len) : (at += 1024) { + const end = @min(enc.len, at + 1024); + const more: u8 = if (end < enc.len) '1' else '0'; + if (at == 0) + try cmds.print(arena, "\x1b_Ga=T,i=42,f=24,s=64,v=64,c=8,r=4,m={c};{s}\x1b\\", .{ more, enc[at..end] }) + else + try cmds.print(arena, "\x1b_Gm={c};{s}\x1b\\", .{ more, enc[at..end] }); + } + try cmds.appendSlice(arena, "\r\n"); + r.feed(0, cmds.items); + _ = try r.places(); + const s = &r.p.surface; + const o = r.origin(0); + var painted: usize = 0; + for (0..4) |dy| for (0..8) |dx| { + const cell = s.at(o.x + 7 + @as(u16, @intCast(dx)), o.y + 1 + @as(u16, @intCast(dy))); + if (cell.style.bg == .rgb and !cell.default) painted += 1; + }; + std.testing.expectEqual(@as(usize, 32), painted) catch |err| { + std.debug.print("helix theme {}: {d} cells painted\n", .{ helix, painted }); + return err; + }; + } +} diff --git a/test/kitty_client.zig b/test/kitty_client.zig index 23c7587f..753727df 100644 --- a/test/kitty_client.zig +++ b/test/kitty_client.zig @@ -109,6 +109,9 @@ fn play(arena: std.mem.Allocator, case: []const u8, cmds: *std.ArrayList(u8)) !v } else if (std.mem.eql(u8, case, "cancel")) { // CAN in the middle of the payload: nothing runs, the text goes on. try cmds.print(arena, "\x1b_Ga=T,i=64,f=24,s={d},v={d};{s}\x18CANCELLED-OK\r\n", .{ side, side, b64[0..512] }); + } else if (std.mem.eql(u8, case, "under")) { + // Under the text (z < 0), as a background picture is put. + try cmds.print(arena, "\x1b_Ga=T,i=66,f=24,s={d},v={d},c=8,r=4,z=-1,q=2;{s}\x1b\\\r\n", .{ side, side, b64 }); } else if (std.mem.eql(u8, case, "show")) { try cmds.print(arena, "\x1b_Ga=T,i=65,f=24,s={d},v={d},c=8,r=4,q=2;{s}\x1b\\\r\n", .{ side, side, b64 }); } else if (std.mem.eql(u8, case, "delete")) { diff --git a/test/kitty_harness.zig b/test/kitty_harness.zig index ad864671..652395b8 100644 --- a/test/kitty_harness.zig +++ b/test/kitty_harness.zig @@ -66,6 +66,7 @@ pub fn main(init: std.process.Init) !void { var run: Run = .{ .arena = arena, .h = &h, .base = base, .kc = kc, .gui = gui }; try run.start(); + if (std.c.getenv("PARDES_KITTY_EXPLORE")) |list| return run.explore(std.mem.span(list)); std.debug.print("kitty harness ({s}):\n", .{if (gui) "gui" else "tty"}); try run.query(); try run.place(); @@ -73,14 +74,53 @@ pub fn main(init: std.process.Init) !void { try run.quiet(); try run.cancel(); if (!gui) try run.delete(); + if (!gui) try run.under(); try run.icat(); try run.chafa(); + try run.yazi(); + + if (!gui) try plainOuter(arena, exe, kc, base); std.debug.print("kitty harness: {d} failed, {d} skipped\n", .{ failures, skipped }); if (failures > 0) return error.KittyHarnessFailed; } +/// Outside, a terminal without kitty graphics (it answers DA, not the +/// graphics query): pardes must send it no graphics command, and draws the +/// pane's image as glyph art; the program in the pane is answered as ever. +fn plainOuter(arena: std.mem.Allocator, exe: [:0]const u8, kc: []const u8, base: [:0]const u8) !void { + var h = try eh.Harness.initArgv(gpa, exe, rows, cols, &.{}); + defer h.deinit(); + try h.expectRawWaitFor("\x1b_Gi=1,a=q\x1b\\", 8000, "pardes did not probe for kitty graphics"); + try h.send("\x1b[?62;22c"); + try h.expectWaitFor("$ ", 10_000, "the shell's prompt did not show"); + try h.pump(400); + var run: Run = .{ .arena = arena, .h = &h, .base = base, .kc = kc, .gui = false }; + const probe_end = h.raw.items.len; + const got = try run.case("place"); + check(std.mem.eql(u8, got, "\x1b_Gi=42;OK\x1b\\" ++ sync_reply), "plain outer: the pane's program is answered as ever ({f})", .{std.ascii.hexEscape(got, .lower)}); + const raw = h.raw.items[probe_end..]; + const sent = std.mem.count(u8, raw, "\x1b_G"); + check(sent == 0, "plain outer: no graphics command reaches a terminal without them ({d})", .{sent}); + // Glyph art fills the 8x4 cells after ANCHOR>: a solid picture is all + // background colour (C64's nearest blue), no glyph. + const anchor = try run.find("ANCHOR>") orelse { + check(false, "plain outer: ANCHOR> on the screen", .{}); + return; + }; + var art: usize = 0; + for (0..4) |dy| for (0..8) |dx| { + const cell = h.term.screens.active.pages.getCell(.{ .viewport = .{ .x = @intCast(anchor.x + 7 + dx), .y = @intCast(anchor.y + dy) } }) orelse continue; + if (cell.style().bg_color != .none) art += 1; + }; + check(art == 32, "plain outer: the image is glyph art in its cells ({d} of 32 coloured)", .{art}); +} + fn hermetic(arena: std.mem.Allocator, base: [:0]const u8, gui: bool) !void { + // zig build hands its children NO_COLOR, and vaxis honours it: pardes + // would draw no colour at all, glyph art included. Emptied, not unset: + // unsetenv compacts the environment block std captured (a null later). + _ = setenv("NO_COLOR", "", 1); for ([_][*:0]const u8{ "PARDES_PID", "PARDES_9P", "PARDES_PANE", "PARDES_MOUNT", "PARDES_TEST", "PARDES_TEST_CAPTURE_DIR", "PARDES_TEST_COLS", "PARDES_TEST_ROWS", "PARDES_DUMP" }) |name| _ = unsetenv(name); _ = setenv("HOME", base, 1); @@ -256,6 +296,69 @@ const Run = struct { check(cells.count == 0, "delete: no placement of it left outside ({d})", .{cells.count}); } + /// PARDES_KITTY_EXPLORE=: each line `namecommand` runs in + /// the pane under `script`, whose log (the client's own bytes, as it + /// ran under pardes) goes to $PARDES_KITTY_RECORD/.log; then the + /// outer screen and pardes's placements there are printed. + fn explore(r: *Run, list_path: []const u8) !void { + const list = try readFile(r.arena, try r.arena.dupeSentinel(u8, list_path, 0)); + const record = if (std.c.getenv("PARDES_KITTY_RECORD")) |d| std.mem.span(d) else r.base; + var lines = std.mem.splitScalar(u8, list, '\n'); + while (lines.next()) |line| { + const tab = std.mem.indexOfScalar(u8, line, '\t') orelse continue; + const name = line[0..tab]; + const cmd = std.mem.replaceOwned(u8, r.arena, line[tab + 1 ..], "$BASE", r.base) catch line[tab + 1 ..]; + const raw_from = r.h.raw.items.len; + const shell_line = try std.fmt.allocPrint(r.arena, "clear; script -q -O {s}/{s}.log -c '{s}' 2>{s}/{s}.err; touch {s}/{s}.out.done", .{ record, name, cmd, r.base, name, r.base, name }); + _ = try r.shell(name, shell_line); + try r.h.pump(800); + std.debug.print("=== {s}: {s}\n", .{ name, cmd }); + const err = readFile(r.arena, try std.fmt.allocPrintSentinel(r.arena, "{s}/{s}.err", .{ r.base, name }, 0)) catch ""; + if (err.len > 0) std.debug.print("stderr: {s}\n", .{err}); + const raw = r.h.raw.items[raw_from..]; + std.debug.print("outer: {d} transmits, {d} puts, {d} deletes\n", .{ std.mem.count(u8, raw, "\x1b_Gf="), std.mem.count(u8, raw, "\x1b_Ga=p"), std.mem.count(u8, raw, "\x1b_Ga=d") }); + var kinds: std.array_hash_map.String(usize) = .empty; + var from: usize = 0; + while (std.mem.indexOfPos(u8, raw, from, "\x1b_Ga=")) |i| : (from = i + 1) { + const end = std.mem.indexOfAnyPos(u8, raw, i + 1, ";\x1b") orelse continue; + var key = raw[i + 3 .. @min(end, i + 3 + 40)]; + // Ids and geometry vary; the command's shape is the point. + if (std.mem.indexOf(u8, key, ",i=")) |cut| key = key[0..cut]; + const gop = try kinds.getOrPut(r.arena, key); + gop.value_ptr.* = if (gop.found_existing) gop.value_ptr.* + 1 else 1; + } + for (kinds.keys(), kinds.values()) |k, n| std.debug.print(" {d}x {s}\n", .{ n, k }); + const screen = r.h.term.screens.active; + const storage = &screen.kitty_images; + var it = storage.placements.iterator(); + while (it.next()) |entry| { + const img = storage.imageById(entry.key_ptr.image_id) orelse continue; + const where: []const u8 = switch (entry.value_ptr.location) { + .pin => |pin| if (screen.pages.pointFromPin(.viewport, pin.*)) |at| try std.fmt.allocPrint(r.arena, "{d},{d}", .{ at.viewport.x, at.viewport.y }) else "off-viewport", + .virtual => "virtual", + .relative => "relative", + }; + std.debug.print(" image {d} {d}x{d}px at {s} {d}x{d} cells src {d},{d} {d}x{d}\n", .{ entry.key_ptr.image_id, img.width, img.height, where, entry.value_ptr.columns, entry.value_ptr.rows, entry.value_ptr.source_x, entry.value_ptr.source_y, entry.value_ptr.source_width, entry.value_ptr.source_height }); + } + r.h.dump(name); + } + } + + fn under(r: *Run) !void { + _ = try r.case("under"); + const storage = &r.h.term.screens.active.kitty_images; + var it = storage.placements.iterator(); + var seen: usize = 0; + var below: usize = 0; + while (it.next()) |entry| { + const img = storage.imageById(entry.key_ptr.image_id) orelse continue; + if (img.width != client.side or img.height != client.side) continue; + seen += 1; + if (entry.value_ptr.z == -1) below += 1; + } + check(seen > 0 and below == seen, "under: z=-1 reaches the outer terminal on every row ({d} of {d})", .{ below, seen }); + } + fn haveTool(r: *Run, name: []const u8) bool { const which = std.fmt.allocPrintSentinel(r.arena, "command -v {s} >/dev/null 2>&1", .{name}, 0) catch return false; return system(which) == 0; @@ -288,6 +391,19 @@ const Run = struct { check(std.mem.indexOf(u8, raw, "\x1b_Gf=32,s=") != null and err.len == 0, "chafa -f kitty: drawn outside ({s})", .{std.mem.trim(u8, err, " \r\n")}); } + /// yazi previews the PNG (its first entry) through shared memory and a + /// virtual placement shown by placeholders, in its right-hand column. + /// Killed after 6 s, it leaves the preview up. + fn yazi(r: *Run) !void { + if (!r.haveTool("yazi")) return skip("yazi: not installed", .{}); + const raw_from = r.h.raw.items.len; + _ = try r.shell("yazi", try std.fmt.allocPrint(r.arena, "clear; mkdir -p {s}/yz; cp {s}/solid.png {s}/yz/; timeout --foreground -s KILL 6 yazi {s}/yz 2>{s}/yazi.out; touch {s}/yazi.out.done", .{ r.base, r.base, r.base, r.base, r.base, r.base })); + if (r.gui) return r.placedNear("yazi"); + const raw = r.h.raw.items[raw_from..]; + const cells = try r.outerPlacements(client.side, client.side); + check(std.mem.indexOf(u8, raw, "\x1b_Gf=32,s=64,v=64,i=") != null and cells.count == 4 and cells.min_x > cols / 2, "yazi: its preview drawn outside, in its right half ({d} rows at {d},{d})", .{ cells.count, cells.min_x, cells.min_y }); + } + fn placedNear(r: *Run, name: []const u8) !void { const path = try r.capturePath(); const deadline = eh.nowMs() + 4000; -- cgit v1.3