diff options
Diffstat (limited to 'src/dump.zig')
| -rw-r--r-- | src/dump.zig | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/dump.zig b/src/dump.zig index 19ba25ce..075bb8cc 100644 --- a/src/dump.zig +++ b/src/dump.zig @@ -1002,12 +1002,13 @@ test "a loaded terminal's history stays above its banner, the cursor where it wa const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 40, .rows = 12 }); defer p.deinit(); while (p.nextEffect()) |_| {} - term.feedOutput(p, p.panes[0].?, "one\r\ntwo\r\n$ "); - const before = term.gridCursor(p.panes[0].?); + p.panes[0].?.feedOutput(p, "one\r\ntwo\r\n$ "); + const before = pardes.Term.grid(p.panes[0].?.terminal); try dumpState(p); const loaded = try load(gpa, .{ .tty_only = true, .cols = 40, .rows = 12 }, p.dump_out.?, null); defer loaded.deinit(); - try std.testing.expectEqual(before, term.gridCursor(loaded.panes[0].?)); + const after = pardes.Term.grid(loaded.panes[0].?.terminal); + try std.testing.expectEqual([2]u16{ before.cursor_x, before.cursor_y }, [2]u16{ after.cursor_x, after.cursor_y }); const q = try initFromDump(gpa, .{ .tty_only = true, .cols = 40, .rows = 12 }, p.dump_out.?); defer q.deinit(); const text = try term.screenTextAlloc(q.panes[0].?, gpa); @@ -1019,11 +1020,10 @@ test "a loaded terminal's history stays above its banner, the cursor where it wa test "an upgraded session's dump keeps its views and its running terminal as they were, and settings the startup config would change" { if (comptime isolated) return error.SkipZigTest; const gpa = std.testing.allocator; - const term = pardes.panes.terminal; const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 40, .rows = 12, .startup_config = "Verbose off\n" }); defer p.deinit(); while (p.nextEffect()) |_| {} - term.feedOutput(p, p.panes[0].?, "one\r\n\x1b[?1049h$ vim"); + p.panes[0].?.feedOutput(p, "one\r\n\x1b[?1049h$ vim"); try std.testing.expect(p.executeBuiltinLine(p.view().active, "Verbose on")); _ = p.openView().?; const bytes = try dumpBytes(p); @@ -1035,7 +1035,9 @@ test "an upgraded session's dump keeps its views and its running terminal as the try std.testing.expectEqual(@as(usize, 2), views.count(q)); try std.testing.expect(q.settings.verbose); // The program's own screen, no banner, and no shell asked for. - try std.testing.expectEqual(term.gridCursor(p.panes[0].?), term.gridCursor(q.panes[0].?)); + const was = pardes.Term.grid(p.panes[0].?.terminal); + const is = pardes.Term.grid(q.panes[0].?.terminal); + try std.testing.expectEqual([2]u16{ was.cursor_x, was.cursor_y }, [2]u16{ is.cursor_x, is.cursor_y }); try std.testing.expect(q.panes[0].?.terminal.?.vt.screens.active_key == .alternate); while (q.nextEffect()) |e| try std.testing.expect(e != .spawn); // Not kept, the same terminal is a new shell's under its history. |
