summaryrefslogtreecommitdiff
path: root/src/ninep/ctl.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep/ctl.zig')
-rw-r--r--src/ninep/ctl.zig22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index e6e738a5..f6457b83 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -554,6 +554,7 @@ fn checkBuiltin(p: *Pardes, req: Req, line: []const u8, scope: builtins.Scope) ?
.font => config.Runtime.FontSpec.parse(arg) != null,
// Bare, it says the width, as from a pane's exec.
.tab => arg.len == 0 or (std.fmt.parseInt(u16, arg, 10) catch 0) -% 1 < 16,
+ .callstack_depth => arg.len == 0 or (std.fmt.parseInt(u8, arg, 10) catch 0) -% 1 < pardes.lsp.callstack_max_depth,
else => probe: {
var probe = p.settings;
break :probe probe.apply(setting, if (arg.len > 0) arg else null);
@@ -662,6 +663,7 @@ pub fn writeSettingsOf(p: *Pardes, s: *const config.Runtime, w: *std.Io.Writer)
.motion => try w.print("{s} {s}\n", .{ word, @tagName(s.motion) }),
.inactive_dim => try w.print("{s} {d}\n", .{ word, s.inactive_dim }),
.grip_width => try w.print("{s} {d}\n", .{ word, s.grip_width }),
+ .callstack_depth => try w.print("{s} {d}\n", .{ word, s.callstack_depth }),
.tab => try w.print("{s} {d}\n", .{ word, s.tab }),
}
}
@@ -743,12 +745,13 @@ pub fn fillPager(p: *Pardes, serial: u32, held: *std.ArrayList(u8)) error{OutOfM
f.pager_spans = page.spans;
f.saved_revision = f.revision;
// A diff paged (`git show`, difftui's patches): its hunks stacked in a
- // +Diff (DiffLook hunks), the +Pager folded to its tag under it for
- // Diff to bring back. The keyboard stays where it was, as a page's.
+ // +Diff (DiffLook hunks) in the +Pager's place, the +Pager closed. The
+ // keyboard stays where it was, as a page's.
if (f.pager_diff and p.settings.diff_look == .hunks) {
const keyboard = p.active;
- if (panes.Output.openDiff(p, id, f.path, f.content)) |_| {
- if (!pane.collapsed) pardes.layout.toggleCollapse(p, id);
+ if (panes.Output.openDiff(p, id, f.path, f.content)) |hid| {
+ // ponytail: the text is gone with it; Diff on the +Diff says no such file.
+ p.removePane(id, hid) catch {};
} else |_| {}
if (p.panes[keyboard] != null) p.active = keyboard;
}
@@ -1452,6 +1455,8 @@ test "the root ctl reads the settings as a write takes them, and takes the sessi
try testing.expectEqual(@as(u64, settings.len), call(p, .{ .tag = 1, .op = .getattr, .node = root_ctl }).reply.attr.size);
try testing.expect(std.mem.indexOf(u8, settings, "Verbose on\n") != null);
try testing.expect(std.mem.indexOf(u8, settings, "LocationsConfig ") != null);
+ try testing.expect(std.mem.indexOf(u8, settings, "CallstackDepth 8\n") != null);
+ try testing.expectEqual(Status.ok, wr(p, root_ctl, "CallstackDepth").reply.status);
// Settings only: nothing /status or the DumpConfig window says.
try testing.expect(std.mem.indexOf(u8, settings, "Platform") == null);
try testing.expect(std.mem.indexOf(u8, settings, "requested") == null);
@@ -1494,7 +1499,6 @@ test "the root ctl reads the settings as a write takes them, and takes the sessi
try testing.expectEqual(Status.ok, wr(p, root_ctl, "Verbose off").reply.status);
}
-
test "a second lock is refused until the holder unlocks or closes, and binds nobody else" {
const p = try withFile(testing.allocator, "one\ntwo\n");
defer p.deinit();
@@ -3920,7 +3924,7 @@ test "a closed file is found again: Recent and /recent list it closed, a look at
try testing.expectEqual(Status.ok, wr(p, root_exec, "Recent\n").reply.status);
const rows = p.panes[p.paneBySerial(try std.fmt.parseInt(u32, std.mem.trimEnd(u8, rd(p, root_exec, 0, 64).bytes, "\n"), 10)).?].?;
const at = std.mem.indexOf(u8, rows.file.?.content, try std.fmt.bufPrint(&want, "{s}:3:", .{a})).?;
- const row = rows.file.?.content[at .. std.mem.indexOfScalarPos(u8, rows.file.?.content, at, '\n').?];
+ const row = rows.file.?.content[at..std.mem.indexOfScalarPos(u8, rows.file.?.content, at, '\n').?];
try testing.expect(std.mem.endsWith(u8, row, " (closed)"));
try testing.expectEqual(Status.ok, wr(p, Node.of(rows.serial, .look), try std.fmt.bufPrint(&line, "{s}\n", .{row[0 .. row.len - " (closed)".len]})).reply.status);
p.sync();
@@ -4159,11 +4163,11 @@ test "a remembered place is clamped to the file as it is now, its selection's tw
_ = wr(p, root_exec, "Recent\n");
const rows = p.panes[p.paneBySerial(try std.fmt.parseInt(u32, std.mem.trimEnd(u8, rd(p, root_exec, 0, 64).bytes, "\n"), 10)).?].?;
const at = std.mem.indexOf(u8, rows.file.?.content, "c.txt:").?;
- const row = rows.file.?.content[at .. std.mem.indexOfScalarPos(u8, rows.file.?.content, at, '\n').?];
+ const row = rows.file.?.content[at..std.mem.indexOfScalarPos(u8, rows.file.?.content, at, '\n').?];
// Both ends are in the row, a range.
try testing.expect(std.mem.indexOfScalar(u8, row, '-') != null);
var full: [4400]u8 = undefined;
- const loc = try std.fmt.bufPrint(&full, "{s}/{s}\n", .{ dir, row[0 .. std.mem.indexOfScalar(u8, row, ' ').?] });
+ const loc = try std.fmt.bufPrint(&full, "{s}/{s}\n", .{ dir, row[0..std.mem.indexOfScalar(u8, row, ' ').?] });
// A look at it opens the file, never a miss, clamped to its last line.
try testing.expectEqual(Status.ok, wr(p, Node.of(rows.serial, .look), loc).reply.status);
p.sync();
@@ -4350,7 +4354,7 @@ test "every word's /commands description is its own doc comment's first sentence
undescribed += 1;
continue;
};
- const word = line[0 .. std.mem.indexOfScalar(u8, line, ' ').?];
+ const word = line[0..std.mem.indexOfScalar(u8, line, ' ').?];
if (config.Runtime.find(word)) |setting| {
try testing.expect(std.mem.endsWith(u8, line, setting.doc));
continue;