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.zig17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index 68fefbc5..a65b3562 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -408,7 +408,7 @@ fn writeQuoted(w: *std.Io.Writer, s: []const u8) !void {
try w.writeByte('\'');
}
-pub const pane_text_cap = 9 * 12 + 2 * 256 + 4 + "notcurrent ".len + 48 + "collapsed fit:height tint:filtered mode:insert ".len;
+pub const pane_text_cap = 9 * 12 + 2 * 256 + 4 + "notcurrent ".len + 48 + "collapsed fit:height tint:filtered mode:insert ".len + 129;
/// acme's winctlprint (plan9port wind.c), field for field: serial, tag
/// length, body length, isdir (1 for a directory pane), the dirty flag,
@@ -444,6 +444,11 @@ pub fn paneText(p: *Pardes, pane: *Pane, buf: []u8) []const u8 {
// PdfTint, in the words they take.
if (pane.collapsed) w.writeAll("collapsed ") catch {};
if (comptime pardes.pdf_enabled) if (pane.pdf) |pv| w.print("fit:{s} tint:{s} ", .{ @tagName(pv.fit), @tagName(pv.tint) }) catch {};
+ if (pane.addon != null) {
+ var fields: [128]u8 = undefined;
+ const kind_fields = pardes.Kind.ctlRead(pane, &fields);
+ if (kind_fields.len > 0) w.print("{s} ", .{kind_fields}) catch {};
+ }
// Last, the body's mode, which the tag shows as a box: helix's select
// is normal mode extending.
w.print("mode:{s} ", .{if (pane.body.mode == .normal and pane.body.select) "select" else @tagName(pane.body.mode)}) catch {};
@@ -521,6 +526,8 @@ fn checkBuiltin(p: *Pardes, req: Req, line: []const u8, scope: builtins.Scope) ?
const arg = if (sp) |s| std.mem.trim(u8, line[s + 1 ..], " \t") else "";
const here = if (std.meta.stringToEnum(Builtin, word)) |b| builtins.registry.here(p, b) else false;
const b = (if (here) std.meta.stringToEnum(Builtin, word) else null) orelse {
+ // An addon's word: its kind's to take or refuse as it runs.
+ if (pardes.Kind.word(word) != null) return null;
// A setting this build's frontend cannot show (Lift, GripWidth on a
// terminal, the window's own words in a terminal's view) is known,
// and says so rather than sound misspelt.
@@ -890,6 +897,14 @@ fn writeCommands(p: *const Pardes, w: *std.Io.Writer) !void {
}
try w.writeByte('\n');
}
+ // The addons' words, after the core's: `(addon <name>)` says whose.
+ for (pardes.Kind.wordsOf()) |kw| try w.print("{s}{s} {s} -- {s} (addon {s})\n", .{
+ std.mem.span(kw.w.name),
+ if (kw.w.arg != pardes.Kind.c.PA_ARG_NONE) " arg" else "",
+ if (kw.w.opens != 0) "both" else "pane",
+ if (kw.w.doc == null) "" else std.mem.span(kw.w.doc),
+ pardes.Kind.headName(kw.ops),
+ });
}
/// /commands' text (`writeCommands`), in the step's scratch.