diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 00:06:42 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | c742d19d4bacbd9a91627c4859ca8cb0d11bdba7 (patch) | |
| tree | 810036d05946b51dfadef508ee75f677303ba7c8 /src/dump.zig | |
| parent | e4fbb97a506ca2a4b469b6e2e13ecba6e516272c (diff) | |
| download | pardes-c742d19d4bacbd9a91627c4859ca8cb0d11bdba7.tar.gz pardes-c742d19d4bacbd9a91627c4859ca8cb0d11bdba7.zip | |
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
Diffstat (limited to 'src/dump.zig')
| -rw-r--r-- | src/dump.zig | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/dump.zig b/src/dump.zig index a880c7e1..19ba25ce 100644 --- a/src/dump.zig +++ b/src/dump.zig @@ -490,10 +490,8 @@ fn loadImage(gpa: std.mem.Allocator, opts: Options, bytes: []const u8, notes: ?* /// build's dump could not give): a terminal, a new emulator for its shell. fn ensureKind(p: *Pardes, pane: *pardes.panes.Pane) !void { if (pane.terminal != null or pane.file != null or pane.addon != null or pane.pdf != null) return; - const fresh = try pardes.panes.terminal.create(p.gpa, @max(1, pane.cols), @max(1, pane.rows)); - pane.terminal = fresh.terminal; - fresh.terminal = null; - p.gpa.destroy(fresh); + if (pardes.tape.authorityOnly("open a terminal")) return error.OutOfMemory; + pane.terminal = try pardes.Term.open(pardes.panes.emulatorGpa(p.gpa), @max(1, pane.cols), @max(1, pane.rows)); } /// The panes a column lists that are not there (another build's dump left @@ -660,7 +658,18 @@ fn revivePane(p: *Pardes, id: usize, pane: *pardes.panes.Pane, was_on_disk: bool } if (comptime isolated) return; if (pane.cwdSlice().len > effect_path_cap) return; - pardes.panes.terminal.reviveShell(pane); + // Its shell not there, made ready for a new one: what the old + // shell was, ran and said is gone with it (the REPL it ran, the + // Term+ word naming it), and the pane waits for the new one like + // any new terminal (a line queued for the old one goes to it). + pardes.Term.revive(pane.terminal.?); + pane.shell_spoke = false; + pane.had_shell = false; + pane.shell_failed = false; + pane.shell_tail_len = 0; + pane.repl = null; + pane.sent_command = null; + pane.pending_command.wait = .spawn; p.emitSpawn(id, pane.serial, pane.cwdSlice()); return; } @@ -719,7 +728,7 @@ pub fn savePane(gpa: std.mem.Allocator, pane: *pardes.panes.Pane, slim: bool) ![ pub fn loadPane(p: *Pardes, id: usize, bytes: []const u8) !*pardes.panes.Pane { var l = try walk.Load(&.{pardes.panes.Pane}).init(p.gpa, bytes); defer l.deinit(); - l.allocs = .{ .image = p.image_gpa, .terminal = pardes.panes.terminal.emulatorGpa(p.gpa) }; + l.allocs = .{ .image = p.image_gpa, .terminal = pardes.panes.emulatorGpa(p.gpa) }; const pane = try p.gpa.create(pardes.panes.Pane); errdefer { l.rollback(); |
