From 98f84f99e79cccc2344aff2efe10823540d0c7b7 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 17 Nov 2026 03:06:49 -0300 Subject: plain: the records the core and the terminal both name, a leaf module (docs/next-terminal.md, Phase 1, its first step): src/plain/plain.zig takes Color, FontRole, CellStyle, Cell, RectPx, RectCell, Raster and Placement from surface.zig and Key from Event.zig, moved as they are, and imports std alone; surface.zig and Event.zig re-export them under their old names, so no caller changes; src/term/'s files name them through `plain` (pager.zig and TerminalImages.zig no longer reach surface.zig); build.zig's wireCore gives every core module the `plain` import; locations.Row stays (it names look.Spot and walk's digest: not free); core-test 985 of 985, lib-test --- src/term/TerminalImages.zig | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/term/TerminalImages.zig') diff --git a/src/term/TerminalImages.zig b/src/term/TerminalImages.zig index 6894945c..ab7aca25 100644 --- a/src/term/TerminalImages.zig +++ b/src/term/TerminalImages.zig @@ -8,6 +8,7 @@ //! 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 plain = @import("plain"); const ghostty_vt = @import("ghostty-vt"); const pardes = @import("../pardes.zig"); const zstbi = @import("zstbi"); @@ -15,7 +16,7 @@ const wuffs = @import("wuffs"); const TerminalImages = @This(); const gfx = ghostty_vt.kitty.graphics; -const PixelRect = @import("../surface.zig").RectPx; +const PixelRect = plain.RectPx; /// 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. @@ -190,8 +191,8 @@ pub fn draw( // 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.placements.items.len; - defer std.sort.insertion(pardes.Placement, s.placements.items[first..], {}, struct { - fn lessThan(_: void, a: pardes.Placement, b: pardes.Placement) bool { + defer std.sort.insertion(plain.Placement, s.placements.items[first..], {}, struct { + fn lessThan(_: void, a: plain.Placement, b: plain.Placement) bool { return a.z < b.z; } }.lessThan); @@ -314,7 +315,7 @@ const Ctx = struct { .w = @intCast(x1 - x0), .h = @intCast(y1 - y0), }, - .key = pardes.Placement.keyOf(ctx.serial, img.id, @truncate(img.generation)), + .key = plain.Placement.keyOf(ctx.serial, img.id, @truncate(img.generation)), .z = z, .art = .{ .glyph = ctx.ti.petscii }, }); -- cgit v1.3