diff options
Diffstat (limited to 'src/dump.zig')
| -rw-r--r-- | src/dump.zig | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/dump.zig b/src/dump.zig index 1b3bcb5c..3ded45ca 100644 --- a/src/dump.zig +++ b/src/dump.zig @@ -385,7 +385,7 @@ pub fn upgradePath(buf: *[1024:0]u8, dir_setting: []const u8) ?[:0]const u8 { return std.fmt.bufPrintSentinel(buf, "{s}/pardes-upgrade-{d}.dump", .{ dir, std.c.getpid() }, 0) catch null; } -fn loadAndRevive(gpa: std.mem.Allocator, opts: Options, bytes: []const u8, previous: ?*const Pardes, kept: ?*const [MAX_PANES]bool) !*Pardes { +fn loadAndRevive(gpa: std.mem.Allocator, opts: Options, bytes: []const u8, previous: ?*Pardes, kept: ?*const [MAX_PANES]bool) !*Pardes { var notes: std.ArrayList(u8) = .empty; defer notes.deinit(gpa); var on_disk: OnDisk = @splat(false); @@ -408,9 +408,10 @@ fn loadAndRevive(gpa: std.mem.Allocator, opts: Options, bytes: []const u8, previ /// A loaded core given to this host (with `revivePane` for each of its /// panes): the store and Recent read (a Restore's carried from the session -/// it replaces) and its ThemeFile asked for again. An upgrade's (`resumed`) -/// keeps its views, whose clients come back with it, and its settings. -fn reviveSession(p: *Pardes, previous: ?*const Pardes, resumed: bool) !void { +/// it replaces, with its state file) and its ThemeFile asked for again. An +/// upgrade's (`resumed`) keeps its views, whose clients come back with it, +/// and its settings. +fn reviveSession(p: *Pardes, previous: ?*Pardes, resumed: bool) !void { // ponytail: one client loads it, so it is one view, the live one's; a // replica joining (phase 5) takes `load`'s, every view. if (!resumed) views.only(p); @@ -424,9 +425,13 @@ fn reviveSession(p: *Pardes, previous: ?*const Pardes, resumed: bool) !void { p.cell_pixels = old.cell_pixels; p.row_metrics = old.row_metrics; p.native_images = old.native_images; + // Its panes close here, each noted where it was, as at its end. + for (old.panes) |slot| if (slot) |pane| old.noteClosed(pane); p.recent = old.recent.clone(p.recentGpa()); p.store = old.store.clone(p.recentGpa()); - } else p.loadRecent(); + p.db = old.db; + old.db = .{}; + } config.tab_now = p.settings.tab; // A ThemeFile is a request the host answers by reading the file again; // until it has (and for good if it fails) the theme the dump had shows. @@ -443,6 +448,8 @@ fn reviveSession(p: *Pardes, previous: ?*const Pardes, resumed: bool) !void { // reflows would lose where a terminal's view was. p.sync(); if (!resumed) exec.applyStartupConfig(p); + // After the startup config, whose DumpDir says where the state file is. + if (previous == null) p.loadRecent(); colors.finishThemeInitialization(p); p.sync(); _ = p.takeHaptic(); // see init: a restored session is not a gesture |
