summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 14:10:55 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commitb14f7102620bbaa999472e48a9771052749e96e8 (patch)
tree4157c08dee5c51ba430310de2a2a0e836d5eb9f2
parent5be1afe7eaff67b43e897f3e1e5d3a48c8eb39f9 (diff)
downloadpardes-b14f7102620bbaa999472e48a9771052749e96e8.tar.gz
pardes-b14f7102620bbaa999472e48a9771052749e96e8.zip
A name refused for a leading blank says a blank at its start
Both ends said a blank at its end. Co-Authored-By: Claude Opus 5.5 <[email protected]>
-rw-r--r--docs/fs.md2
-rw-r--r--src/ninep/pane.zig5
2 files changed, 4 insertions, 3 deletions
diff --git a/docs/fs.md b/docs/fs.md
index ca24034d..6084b834 100644
--- a/docs/fs.md
+++ b/docs/fs.md
@@ -565,7 +565,7 @@ in one write or as a second line on the same open (bash's `printf
'a\nb\n' > name` writes a line at a time: the first names it). A blank inside a name is taken
(`two words.zig`); refused, EINVAL, in acme's words (xfid.c:650) and why,
are a blank at either end (not quietly cut off), `bad character in file
-name: a blank at its end`, a second line, `...: a newline (a name is one
+name: a blank at its start` (or `end`), a second line, `...: a newline (a name is one
line)`, a control byte, DEL or a C1 control (U+0080-U+009F), `...: a
control character`, and bytes that are not UTF-8, `...: not UTF-8`. `body` appends on write and replaces on truncating open. A
terminal's `body` is its history as plain text, frozen per open, in logical
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig
index 66e3dad8..929a298a 100644
--- a/src/ninep/pane.zig
+++ b/src/ninep/pane.zig
@@ -666,7 +666,8 @@ fn nameFault(name: []const u8) ?[]const u8 {
while (std.mem.indexOfScalarPos(u8, name, i, 0xC2)) |at| : (i = at + 1)
if (at + 1 < name.len and name[at + 1] <= 0x9F) return e_name_char ++ ": a control character";
}
- if (name[0] == ' ' or name[name.len - 1] == ' ') return e_name_char ++ ": a blank at its end";
+ if (name[0] == ' ') return e_name_char ++ ": a blank at its start";
+ if (name[name.len - 1] == ' ') return e_name_char ++ ": a blank at its end";
return null;
}
@@ -1271,7 +1272,7 @@ test "name reads the file name and writing it promotes a scratch without touchin
// off), a second line, a control byte, DEL, a C1 control, not UTF-8.
for ([_][2][]const u8{
.{ "trailing.zig \n", "a blank at its end" },
- .{ " leading.zig\n", "a blank at its end" },
+ .{ " leading.zig\n", "a blank at its start" },
.{ "tab\t.zig\n", "a control character" },
.{ "two\nlines\n", "a newline" },
.{ "del\x7f.zig\n", "a control character" },