diff options
Diffstat (limited to 'src/dump.zig')
| -rw-r--r-- | src/dump.zig | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/src/dump.zig b/src/dump.zig index 73d4e4ed..78c2bd7a 100644 --- a/src/dump.zig +++ b/src/dump.zig @@ -848,23 +848,7 @@ const OldSerials = struct { }; fn initDump(gpa: std.mem.Allocator, opts: Options, zon_bytes: []const u8, previous: ?*const Pardes, old_serials: ?*OldSerials) !*Pardes { - const image_gpa = opts.image_allocator orelse gpa; - const pdf_gpa = opts.pdf_allocator orelse gpa; - const tree_sitter_gpa = opts.tree_sitter_allocator orelse gpa; - const p = try gpa.create(Pardes); - p.* = .{ - .gpa = gpa, - .image_gpa = image_gpa, - .pdf_gpa = pdf_gpa, - .tree_sitter_gpa = tree_sitter_gpa, - .opts = opts, - .fs = .{}, - .screen_w = opts.cols, - .screen_h = opts.rows, - .scratch = .init(gpa), - .frame_arena = .init(opts.frame_allocator orelse gpa), - .fallback = .{ .gpa = gpa }, - }; + const p = try Pardes.create(gpa, opts); errdefer p.deinit(); if (previous) |old| { p.next_serial = old.next_serial; @@ -879,8 +863,6 @@ fn initDump(gpa: std.mem.Allocator, opts: Options, zon_bytes: []const u8, previo p.recent = old.recent.clone(p.recentGpa()); p.recent_loaded = old.recent_loaded; } else p.loadRecent(); - for (opts.mounts) |mount| try p.fs.mount(gpa, mount.name, mount.dial); - p.opts.mounts = &.{}; var parsed = try readZon(gpa, zon_bytes, "load"); defer parsed.deinit(); const st = parsed.value; @@ -1027,6 +1009,21 @@ test "a session with every column it may hold dumps and restores them all" { try std.testing.expectEqual(@as(usize, MAX_COLS), restored.ncol); } +test "a restored session's column and workspace tags take more than one selection, and its 9P files have a time" { + const th = @import("ninep/testing.zig"); + const gpa = std.testing.allocator; + const p = try Pardes.init(gpa, .{ .tty_only = true }); + defer p.deinit(); + try dumpState(p); + const restored = try initFromDump(gpa, .{ .tty_only = true }, p.dump_out.?); + defer restored.deinit(); + try std.testing.expect(restored.col_tags[0].reserveSels()); + try std.testing.expect(restored.global_tag.reserveSels()); + try std.testing.expect(restored.fs.started != 0); + const stat = th.call(restored, .{ .tag = 1, .op = .getattr, .node = @intFromEnum(pardes.ctlfs.TopFile.index) }); + try std.testing.expect(stat.reply.attr.mtime != 0); +} + test "a restored pane keeps its dot, as acme's dump keeps a window's" { const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true }); |
