summaryrefslogtreecommitdiff
path: root/src/Core.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-17 03:44:57 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:01 -0300
commita22b579ad2df8d1811f0e194fa1bbc06e2282cf8 (patch)
tree9dcaaa6d17c6c67048b58456dcd9dbdb74b9fc9a /src/Core.zig
parenta3509e4df5efc94b0deee3b06dd72f85b0d96647 (diff)
downloadpardes-a22b579ad2df8d1811f0e194fa1bbc06e2282cf8.tar.gz
pardes-a22b579ad2df8d1811f0e194fa1bbc06e2282cf8.zip
term: the terminal a module of its own (docs/next-terminal.md, Phase 1): src/term/term.zig roots it, importing std, ghostty-vt, wuffs, zstbi and plain, never the core, and gives the core one table, `ops` (plain.term.Ops: about 60 entries, the records they take and give and the opaque handles State, Encoder, Track and Replica, in src/plain/term.zig), its own functions put in it through a cast refused at compile time unless each parameter and result matches the table's but for the handles and every error is one the table names; src/Term.zig, the core's side, takes `ops` from the term module when the build's term_options say the core has one (every core module but core-test's), null otherwise, and Term.State is a handle with the walk's hooks, so a dump keeps a terminal as it did (its Parts by name through walk.save, then ghostty's snapshot) and the digest is the emulator's; echo.zig comes back to the core (src/echo.zig: predicted echo is the replica's presentation, its five reads of the emulator through Term.grid, modes, prompt and Term.echoCell); screen_state's Peer is a plain record both sides name (its noteSent a function of screen_state's), its Encoder, Track and Replica handles made and freed through the table (replica.Screens makes its encoder at the first encode); a prompt's cut is told in columns and measured in its row's text by the core (Term.promptPrefix, File.rawAtDisplay); TerminalImages' decode bound moves from memory.limits to the decoder it bounds; build.zig: core_lean, the core module without the terminal, is core-test's, and wireCore no longer gives any core module ghostty-vt, wuffs or zstbi (the term module has them), so core-test's compile names none of ghostty, wuffs, zstbi, simdutf, highway or -lc++ (from --verbose); term-test runs the module's own tests (the pager's, screen_state's, the luminance table's); the tests of a terminal through a core move as they were to test/terminal.zig, in pane-test, which imports both (`of` reads the emulator behind a handle; the dump round trip frees through State.dumpFree), and tests elsewhere that read the emulator do it through Term.emulatorOf, a test in core-test skipping first; core-test skips a test whose terminal Term.open refuses; Authority.init releases its tape when the core it boots fails (it leaked); tests: core-test (no terminal) 409 of 941, 532 skipped, shell-test (the same tests with the terminal) 984 of 984, pane-test 180 of 181 (1 skipped, as before), term-test 15 of 15, kitty-test 45 of 45, replicas checked/wrong 0, hxdiff 658 cases 0 mismatches, behaviour-test 268 of 272 (the base's four addon ABI tests), lib-test
Diffstat (limited to 'src/Core.zig')
-rw-r--r--src/Core.zig10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Core.zig b/src/Core.zig
index 7d8cfb0e..070c4272 100644
--- a/src/Core.zig
+++ b/src/Core.zig
@@ -371,7 +371,7 @@ surface: Surface = .{},
/// A replica's predicted echo (src/term/echo.zig), drawn over its terminals:
/// presentation, its own, in no digest and no rollback copy. Null on a
/// session's own core.
-echo: ?*pardes.Term.Echo = null,
+echo: ?*pardes.Echo = null,
/// The live view, `views[live]` (`view()`): whose input the session
/// takes now, and whose share of the panes is in their own fields
/// (views.zig). `views_open` says which views there are, one a window
@@ -2486,6 +2486,7 @@ test "TreeContext command and custom tag survive a workspace round trip" {
test "Filter is ordered after Del and toggles only its terminal or +Pager pane" {
const testing = std.testing;
+ if (pardes.Term.ops == null) return error.SkipZigTest; // it reads the emulator
const del = std.meta.stringToEnum(Builtin, "Del") orelse return error.MissingDelBuiltin;
const filter = std.meta.stringToEnum(Builtin, "Filter") orelse return error.MissingFilterBuiltin;
try testing.expectEqual(@backingInt(del) + 1, @backingInt(filter));
@@ -2494,12 +2495,12 @@ test "Filter is ordered after Del and toggles only its terminal or +Pager pane"
defer p.deinit();
while (p.nextEffect()) |_| {}
const first = p.panes[0].?;
- const palette_before = first.terminal.?.vt.colorForXterm(.{ .palette = 1 }).?;
+ const palette_before = pardes.Term.emulatorOf(first.terminal.?).vt.colorForXterm(.{ .palette = 1 }).?;
try testing.expect(first.tty_filter);
try testing.expect(p.executeBuiltinLine(0, "Filter"));
try testing.expect(!first.tty_filter);
- try testing.expect(palette_before.eql(first.terminal.?.vt.colorForXterm(.{ .palette = 1 }).?));
+ try testing.expect(palette_before.eql(pardes.Term.emulatorOf(first.terminal.?).vt.colorForXterm(.{ .palette = 1 }).?));
const second_id = p.freeSlot().?;
const second = try p.newShell(second_id, "");
@@ -3762,6 +3763,7 @@ test "the bare tty startup opens a text pane under the shell, unfocused" {
}
test "tty output follows only from the bottom" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a shell, opened by a key
const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 24, .file = "mise.toml" });
defer p.deinit();
p.update(.{ .resize = .{ .cols = 80, .rows = 24 } });
@@ -3921,6 +3923,7 @@ test "pasted bytes still queued at shutdown are freed, not leaked" {
}
test "leaving tty hides the prompt and keeps the command typed at it" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a shell, opened by a key
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .cols = 80, .rows = 24, .file = "mise.toml" });
defer p.deinit();
@@ -3986,6 +3989,7 @@ test "leaving tty hides the prompt and keeps the command typed at it" {
}
test "entering tty walks the shell cursor to the column clicked past the prompt" {
+ if (pardes.Term.ops == null) return error.SkipZigTest; // a shell, opened by a key
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .cols = 80, .rows = 24, .file = "mise.toml" });
defer p.deinit();