summaryrefslogtreecommitdiff
path: root/src/ninep/addr.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 04:21:41 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:15 -0300
commitf31c84eb166e8071152b2fa2922d54f492893f33 (patch)
treef9153cf7250cbe90506ac27305feee18b2b9e07c /src/ninep/addr.zig
parentb85f9e56fa04291fc1791bdceae7b0f2c284114c (diff)
downloadpardes-f31c84eb166e8071152b2fa2922d54f492893f33.tar.gz
pardes-f31c84eb166e8071152b2fa2922d54f492893f33.zip
A bare Shell names the shell it goes back to, and 12:0 says columns count from 1
A bare Shell reset to the default without saying which; it now says Shell: the default again, <shell> ($SHELL, else /bin/sh). A line:col of column 0 said only address out of range; it now adds that a column counts from 1. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/addr.zig')
-rw-r--r--src/ninep/addr.zig5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ninep/addr.zig b/src/ninep/addr.zig
index 15f23a55..989571a5 100644
--- a/src/ninep/addr.zig
+++ b/src/ninep/addr.zig
@@ -13,6 +13,7 @@ fn clip(n: usize) u32 {
pub const e_no_match = "no match for regexp";
pub const e_range = "address out of range";
+pub const e_col_zero = "address out of range: a column counts from 1";
pub const e_regexp = "bad regular expression";
/// Not "took too long": 9ns reads errors by their words, and that would be
/// ENAMETOOLONG.
@@ -104,7 +105,7 @@ pub const Addr = struct {
col = @min(col * 10 + (a.expr[a.i] - '0'), std.math.maxInt(u32));
const lines = modal.cursorLineCount(a.text);
if (n == 0 or n > lines or col == 0) {
- a.err = e_range;
+ a.err = if (col == 0) e_col_zero else e_range;
return null;
}
const q = clip(modal.runeOffsetAt(a.text, .{ .row = @intCast(n - 1), .col = @intCast(col - 1) }));
@@ -483,7 +484,7 @@ test "the address language, form by form" {
for ([_][2][]const u8{
.{ "zzz", e_syntax }, .{ "/nomatch/", e_no_match }, .{ "99", e_range },
.{ "#999", e_range }, .{ "/a[/", e_regexp }, .{ "/(a/", e_regexp },
- .{ "/*a/", e_regexp }, .{ "99:1", e_range }, .{ "2:0", e_range },
+ .{ "/*a/", e_regexp }, .{ "99:1", e_range }, .{ "2:0", e_col_zero },
}) |c| {
_ = th.wr(p, addr, "#0");
try testing.expectEqualStrings(c[1], th.wr(p, addr, c[0]).reply.ename);