From fb72c2402fa1b1ae99be64fe7b2947ea5dd42623 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 28 Sep 2026 01:05:11 -0300 Subject: Let a tag's computed prefix bring its own separating space The space between a pane's path and its commands belongs to the tag's own text, so deleting it, or truncating the 9P tag and writing `Get`, ran the path and the word together for Look and Exec. The prefix now adds a space whenever the text does not start with one; every default text does, so the default tags read and render as before. Co-Authored-By: Claude Opus 5.5 --- src/ninep/pane.zig | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/ninep/pane.zig') diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig index 8e827fba..245e0bb4 100644 --- a/src/ninep/pane.zig +++ b/src/ninep/pane.zig @@ -893,6 +893,19 @@ test "truncating the tag clears its editable tail" { try testing.expectEqual(Status.ok, cleared.reply.status); try testing.expectEqualStrings("", pane.tag.own.?); try testing.expect(std.mem.indexOf(u8, rd(p, tag, 0, 4096).bytes, " Mine") == null); + + // Written back without a leading space, the text still stands apart + // from the path: the computed prefix brings the separator, so Look and + // Exec find `Get`, not `test.txtGet`. + _ = wr(p, tag, "Get"); + try testing.expectEqualStrings("Get", pane.tag.own.?); + const whole = rd(p, tag, 0, 4096).bytes; + 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 + const at = tagline.tagOffsetAt(p, pane, 0, "/test.txt ".len).?; + try testing.expectEqual(@as(usize, 0), at.col); } test "name reads the file name and writing it promotes a scratch without touching its body" { -- cgit v1.3