diff options
Diffstat (limited to 'src/ninep')
| -rw-r--r-- | src/ninep/pane.zig | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig index 80dd97cd..64355e0e 100644 --- a/src/ninep/pane.zig +++ b/src/ninep/pane.zig @@ -613,8 +613,9 @@ pub fn truncate(p: *Pardes, pane: *Pane, file: PaneFile) tree.Status { pane.tag.remember(p.gpa, if (pane.tag.own) |own| .{ .text = own } else null); if (pane.tag.own) |own| p.gpa.free(own); pane.tag.own = empty; + // what is left is the prefix; the cursor goes after it pane.tag.cur_row = 0; - pane.tag.cur_col = 0; + pane.tag.cur_col = if (tagline.pathPrefix(p.scratch.allocator(), pane)) |prefix| @intCast(prefix.len) else |_| 0; pane.tag.vsel.active = false; pane.tag.nsel = 0; }, @@ -910,9 +911,9 @@ test "truncating the tag clears its editable tail" { try testing.expectEqualStrings("/test.txt Get", whole); const word = config.wordBounds(whole, whole.len - "Get".len); try testing.expectEqualStrings("Get", whole[word.lo..word.hi]); - // and the keyboard's first column of the text is the G + // and a click on the G puts the tag's cursor on it const at = tagline.tagOffsetAt(p, pane, 0, "/test.txt ".len).?; - try testing.expectEqual(@as(usize, 0), at.col); + try testing.expectEqualStrings("Get", whole[at.col..]); } test "name reads the file name and writing it promotes a scratch without touching its body" { |
