summaryrefslogtreecommitdiff
path: root/src/Core.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-09 23:15:39 -0300
committerGabriel Schneider <[email protected]>2026-11-09 23:15:53 -0300
commit0b4cfd4b416d03ef64ccd908dfee810c6a498569 (patch)
tree83da4851e30b4dd0e788b66f0024d5b55eaee421 /src/Core.zig
parent7e6fc8c9f62bc3dc08e24856cc647fa0adefb32c (diff)
downloadpardes-0b4cfd4b416d03ef64ccd908dfee810c6a498569.tar.gz
pardes-0b4cfd4b416d03ef64ccd908dfee810c6a498569.zip
a session's end leaves a slim dump and History lists them, the tags gain Follow, History and the window's Fonts: every way out (Exit, the last pane's Del, the host's quit) runs Pardes.endSession, which puts a dump of the session in the state file under the usual label before quitting, slim by the dump's own means (dumpJoin's slim_terminals, and Store's slim-file swap now a Slim struct: no undo, a clean file's text read from its file again by revivePane, a terminal a size for a new shell), none for a session of shells alone; the dump's image carries the panes' names, which /dumps rows end with; the History builtin (SPC f h) lists the state file's dumps in a +History pane and a look at a row is a Restore of its label; the default tags: Follow after Collapse on text panes, History before Debug on the workspace row, Fonts after Themes in a window's view alone (tagline.topbarDefault picks the row per view; both rows are known defaults to the docs and tutor tests); the tty goldens re-recorded (the new words; a narrow pane's tag wraps to a second row, so its body rows shift), builtins JSON regenerated
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/Core.zig')
-rw-r--r--src/Core.zig25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/Core.zig b/src/Core.zig
index 6c5f5470..2e17b495 100644
--- a/src/Core.zig
+++ b/src/Core.zig
@@ -177,7 +177,6 @@ pub const View = struct {
clip_pending: ?edit.ClipRequest = null,
};
-
gpa: std.mem.Allocator,
image_gpa: std.mem.Allocator,
/// Its kinds of pane (Kind.zig): the compiled-in ones, then what addons
@@ -402,18 +401,19 @@ diff_output: pardes.panes.File.DiffOutput = .{},
pub const replica = .{
.local = .{
// A frame, and the timings that make it.
- "surface", "frames", "chrome",
- "frame_arena", "scratch",
- "needs_frame", "present_skipped",
- "echo",
+ "surface", "frames", "chrome",
+ "frame_arena", "scratch", "needs_frame",
+ "present_skipped", "echo",
// Drained by every pump before its digest; a replica's queues
// are its own.
- "effects", "effects_head", "effects_len", "in_q", "in_head", "in_len",
+ "effects",
+ "effects_head", "effects_len", "in_q",
+ "in_head", "in_len",
// The views no frontend here draws (views.zig).
- "undrawn",
+ "undrawn",
// How this process was started, and the last dump it made for
// its host to write: a session loaded elsewhere has its own.
- "opts", "dump_out", "dump_export",
+ "opts", "dump_out", "dump_export",
},
.derived = .{ "shell_rows", "diff_output", "locations_cache", "retired_panes", "tty_filter_palette", "body_chrome" },
// The host's handles, the 9P server's fids and log, the state file
@@ -801,6 +801,15 @@ pub fn deinit(p: *Pardes) void {
gpa.destroy(p);
}
+/// The session ends: what it was goes to the state file (dump.dumpExit),
+/// then the host's loop sees `quit`. Every way out comes here: Exit, the
+/// last pane's Del, the host's own end (its terminal hung up, its window
+/// closed). A dump that fails is said as Exit's, in the log.
+pub fn endSession(p: *Pardes) void {
+ pardes.dump.dumpExit(p) catch |err| p.reportError(p.view().active, "Exit", err);
+ p.quit = true;
+}
+
/// shell feedback after write_dump: remember where the dump landed (the
/// topbar grows a `Restore <path>` word pointing at it)
pub fn setLastDump(p: *Pardes, path: []const u8) void {