summaryrefslogtreecommitdiff
path: root/src/ninep
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-28 01:05:11 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:14 -0300
commitfb72c2402fa1b1ae99be64fe7b2947ea5dd42623 (patch)
tree2ddaa866f23bf8ce44cc2d2dc315ede7e4b8a263 /src/ninep
parent9d2e07e997de155c7dbb894a79e5c11839eab39e (diff)
downloadpardes-fb72c2402fa1b1ae99be64fe7b2947ea5dd42623.tar.gz
pardes-fb72c2402fa1b1ae99be64fe7b2947ea5dd42623.zip
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 <[email protected]>
Diffstat (limited to 'src/ninep')
-rw-r--r--src/ninep/pane.zig13
1 files changed, 13 insertions, 0 deletions
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" {