From c742d19d4bacbd9a91627c4859ca8cb0d11bdba7 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 17 Nov 2026 00:06:42 -0300 Subject: Term: the terminal as the core calls it, src/Term.zig, its lifecycle first (docs/next-terminal.md, Phase 0): Term.open makes an emulator and Term.close frees it, Term.due says when its next kitty frame is due, Term.revive resets a restored terminal's modes under its banner, Term.start and Term.stop run the PNG resize workers; the pane half of each is the core's: panes.createDoc and panes.createTerminal make the pane (the speculation guard there), emulatorGpa and emulator_gpa are the core's choice of allocator, teardownPane closes the emulator, dump.zig's revivePane resets what the old shell was and ensureKind opens an emulator straight into the pane; tape.authorityOnly is the one guard Kind.zig and the terminal both had a copy of; nothing else changes --- src/tape.zig | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/tape.zig') diff --git a/src/tape.zig b/src/tape.zig index 68413315..608ad6ff 100644 --- a/src/tape.zig +++ b/src/tape.zig @@ -1062,6 +1062,14 @@ pub fn poison(why: []const u8) void { }; } +/// A replica's speculation leaves what is the authority's be (a terminal's +/// emulator, a kind's state): true, and the input waits for its order. +pub fn authorityOnly(comptime why: []const u8) bool { + if (!speculating()) return false; + poison(why); + return true; +} + /// A speculation read a terminal's rows or moved its view (`Tape.touched`). pub fn touchTerminal() void { if (on) |t| if (t.speculating) { @@ -1247,7 +1255,7 @@ pub fn startFromEnv() void { pub fn replayMain(path: []const u8) u8 { const gpa = std.heap.c_allocator; // What a shell starts before its core (tui.zig's localSession). - pardes.TerminalImages.start(gpa); + pardes.Term.start(gpa); pardes.syntax.start(gpa); const bytes = std.Io.Dir.cwd().readFileAlloc(std.Io.Threaded.global_single_threaded.io(), path, gpa, .unlimited) catch |err| { std.debug.print("replay: cannot read {s}: {t}\n", .{ path, err }); -- cgit v1.3