diff options
Diffstat (limited to 'src/pardes.zig')
| -rw-r--r-- | src/pardes.zig | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/pardes.zig b/src/pardes.zig index 7fddf19f..eb9aa11f 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -1112,6 +1112,16 @@ test "first document fallback splits like Tty from the originating pane" { }; } +test "the Tutor pane is named +Tutor in the session's directory, never a bare path at the root" { + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true }); + defer p.deinit(); + const session = "/project/src"; + @memcpy(p.session_dir[0..session.len], session); + p.session_dir_len = session.len; + const tutor = try p.openTutorView(1); + try std.testing.expectEqualStrings("/project/src/+Tutor", tutor.file.?.path); +} + test "first document keeps its originating shell and only opens a column when it fits" { for ([_]u16{ 199, 200 }) |width| { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = width, .rows = 32 }); @@ -6573,7 +6583,9 @@ pub const Pardes = struct { pub fn openTutorView(p: *Pardes, id: usize) !*Pane { const content = try p.gpa.dupe(u8, tutor_text); errdefer p.gpa.free(content); - const path = try p.gpa.dupe(u8, "/Tutor"); + // A generated pane, named as every one is: `+` in the session's + // directory, never a bare path Save could write at the root. + const path = try std.fs.path.join(p.gpa, &.{ p.sessionDir(), "+Tutor" }); errdefer p.gpa.free(path); const history = try panes.File.History.create(p.gpa); errdefer p.gpa.destroy(history); |
