summaryrefslogtreecommitdiff
path: root/src/ninep/pane.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep/pane.zig')
-rw-r--r--src/ninep/pane.zig7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig
index ae4dcd71..3b70d62f 100644
--- a/src/ninep/pane.zig
+++ b/src/ninep/pane.zig
@@ -751,7 +751,7 @@ pub fn applyTagTruncation(p: *Pardes, pane: *Pane) void {
pane.tag.own = empty;
// what is left is the prefix; the cursor goes after it
pane.tag.cur_row = 0;
- pane.tag.cur_col = if (tagline.pathPrefix(p.scratch.allocator(), pane)) |prefix| @intCast(prefix.len) else |_| 0;
+ pane.tag.cur_col = if (tagline.pathPrefix(p, p.scratch.allocator(), pane)) |prefix| @intCast(prefix.len) else |_| 0;
pane.tag.vsel.active = false;
pane.tag.nsel = 0;
pf.tag_rewrite = true;
@@ -982,7 +982,8 @@ pub fn nameBuffer(p: *Pardes, id: usize, full: []const u8, preserve_tag: bool) !
if (std.mem.indexOfAny(u8, full, "\x00\n") != null) return error.InvalidName;
if (std.mem.eql(u8, f.path, full)) return;
const copy = try p.gpa.dupe(u8, full);
- p.gpa.free(f.path);
+ // The name it ends is kept for an undo back across this rename.
+ panes.File.noteRenamed(p.gpa, f.history, f.path);
f.path = copy;
if (panes.Output.fileTraits(f.output).saves) {
f.output = null;
@@ -1014,7 +1015,7 @@ pub fn appendErrors(p: *Pardes, id: usize, text: []const u8) ?usize {
if (text.len == 0) return 0;
const pane = p.panes[id] orelse return null;
const cwd = pane.cwdSlice();
- const dir = if (pane.file) |*f| std.fs.path.dirname(f.path) orelse "/" else if (cwd.len > 0) cwd else "/";
+ const dir = if (pane.file) |*f| panes.Dir.ofName(f.path) else if (cwd.len > 0) cwd else "/";
for (p.panes) |slot| {
const q = slot orelse continue;
const qf = fileOf(q) orelse continue;