diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 00:25:48 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | 9c2fc736b9ccd7b7eea11e7f544ed540d2d2a6c2 (patch) | |
| tree | ac4270b4e90867228534c01647e8a0e755b58d4a /test/kitty.zig | |
| parent | 5354090b6122faf0d18e246a55e8a4ead0955394 (diff) | |
| download | pardes-9c2fc736b9ccd7b7eea11e7f544ed540d2d2a6c2.tar.gz pardes-9c2fc736b9ccd7b7eea11e7f544ed540d2d2a6c2.zip | |
Term: input through the interface: Term.key writes a key's bytes as its program's keyboard protocol and modes ask, Term.mouse and Term.wheel a mouse event's and a wheel turn's, Term.paste a paste as xterm makes one, Term.modes is the plain record of the modes the core decides by (mouse, all motion, the wheel, focus, bracketed paste, the alternate screen) and Term.promptMoves how far a click on the prompt line moves the shell's cursor; the mouse's records (MouseMods, MouseButton, MouseAction) are the interface's; keys.forwardKey (the bytes queued, an error reported) and keys.enterTty (raw mode, the cursor handed to the shell) are the core's, in keys.zig, pardes.keys for the tests; bracketedPaste, reportsMouse, reportsFocus, ownsWheel, tracksAllMotion and onAlternateScreen go into the record; the tests that called them follow; nothing else changes
Diffstat (limited to 'test/kitty.zig')
| -rw-r--r-- | test/kitty.zig | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test/kitty.zig b/test/kitty.zig index 7b5347e0..4341677e 100644 --- a/test/kitty.zig +++ b/test/kitty.zig @@ -66,7 +66,7 @@ const Rig = struct { fn init(shells: u8) !Rig { // f=100 decodes through wuffs, its resize through stb_image_resize, // which the shells start at launch. - pardes.TerminalImages.start(gpa); + pardes.Term.start(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. @@ -86,7 +86,7 @@ const Rig = struct { for (&r.read) |*b| b.deinit(gpa); r.frame.deinit(); r.p.deinit(); - pardes.TerminalImages.stop(); + pardes.Term.stop(); } fn drain(r: *Rig) void { @@ -642,14 +642,14 @@ test "kitty: an image follows its text when the shell scrolls, resizes and reflo try std.testing.expectEqual(o.y + 2, (try r.placesOf(10))[0].dst.y); // A narrower pane reflows the text; the image stays on its row. const pane = r.pane(0); - terminal.resizeGrid(pane, 40, pane.rows); + pane.resizeGrid(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)); + const viewport_top: usize = pardes.Term.grid(pane.terminal).offset; try std.testing.expectEqual(o.y + @as(u16, @intCast(row - viewport_top)), drawn[0].dst.y); } @@ -822,7 +822,7 @@ test "kitty: an animation's frames play" { // 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))); + try std.testing.expectEqual(@as(?u64, null), pardes.Term.due(r.pane(0).terminal.?)); } test "kitty: a placement relative to another (P=, Q=) is drawn at its parent's cell plus H/V" { @@ -1168,7 +1168,7 @@ fn fuzzRun(seed: u64, steps: usize, trace: bool) !bool { r.p.update(.{ .resize = .{ .cols = cols, .rows = rows, .cell_pixels = .{ .w = 1 + rng.uintLessThan(u16, 30), .h = 1 + rng.uintLessThan(u16, 60) } } }); r.drain(); }, - 1 => terminal.resizeGrid(r.pane(0), 1 + rng.uintLessThan(u16, 120), 1 + rng.uintLessThan(u16, 40)), + 1 => r.pane(0).resizeGrid(1 + rng.uintLessThan(u16, 120), 1 + rng.uintLessThan(u16, 40)), 2, 3 => { const drawn = try r.places(); if (trace) std.debug.print(" {d} places, {d} placements, {d} images\n", .{ drawn.len, r.placementCount(0), r.storage(0).images.count() }); @@ -1225,13 +1225,13 @@ test "kitty: scrolled back by pardes, an image shows on its row; scrolled forwar 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); + pardes.Term.scroll(pane.terminal.?, -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].dst.y); try std.testing.expectEqual(o.x + 6, drawn[0].dst.x); - terminal.followOutput(pane); + pane.followOutput(); try std.testing.expectEqual(@as(usize, 0), (try r.placesOf(20)).len); } |
