diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-28 01:05:11 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:14 -0300 |
| commit | fb72c2402fa1b1ae99be64fe7b2947ea5dd42623 (patch) | |
| tree | 2ddaa866f23bf8ce44cc2d2dc315ede7e4b8a263 /src/ninep/pane.zig | |
| parent | 9d2e07e997de155c7dbb894a79e5c11839eab39e (diff) | |
| download | pardes-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/pane.zig')
| -rw-r--r-- | src/ninep/pane.zig | 13 |
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" { |
