diff options
Diffstat (limited to 'src/ninep/ctl.zig')
| -rw-r--r-- | src/ninep/ctl.zig | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 665913fc..709f017f 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -60,8 +60,10 @@ pub fn run(p: *Pardes, id: usize, exec: bool, text: []const u8, in_tag: bool) vo // record back to have it done. // A click in a column's or the workspace's tag is not the pane's. if (!in_tag and p.panes[id].?.fs.readers > 0) { - const named = std.meta.stringToEnum(Builtin, exec_line.commandText(text)) != null; - var flag: u32 = pardes.ctlfs.events.flag_expansion; + const named = exec_line.namesBuiltin(text); + // No flag 2: a written line was never expanded from a click, and no + // expansion record follows (editors/acme/look.c:42-43, exec.c:154-157). + var flag: u32 = 0; if (named) flag |= pardes.ctlfs.events.flag_builtin; if (!exec and !named and std.mem.indexOfAny(u8, text, "/.:") != null) flag |= pardes.ctlfs.events.flag_filename; _ = pardes.ctlfs.events.noteAction(p, id, if (exec) .body_exec else .body_look, 0, 0, flag, text); @@ -1453,16 +1455,17 @@ test "a pane's own look and exec go to the event reader holding it, which writes const pane = p.panes[0].?; try testing.expect(std.mem.indexOf(u8, pane.msg[0..pane.msg_len], "routed") == null); const record = call(p, .{ .tag = 2, .op = .read, .node = event, .handle = h, .size = 256 }).bytes; - try testing.expectEqualStrings("FX0 0 2 10 Msg routed\n", record); + // Flag 1: its first word is a builtin; no 2, no expansion follows. + try testing.expectEqualStrings("FX0 0 1 10 Msg routed\n", record); // Written back, it is done. try testing.expectEqual(tree.Status.ok, wr(p, event, record).reply.status); try testing.expect(std.mem.indexOf(u8, pane.msg[0..pane.msg_len], "routed") != null); try testing.expectEqual(tree.Status.ok, wr(p, Node.of(serial, .look), "one.txt:3\n").reply.status); - try testing.expectEqualStrings("FL0 0 6 9 one.txt:3\n", call(p, .{ .tag = 3, .op = .read, .node = event, .handle = h, .size = 256 }).bytes); + try testing.expectEqualStrings("FL0 0 4 9 one.txt:3\n", call(p, .{ .tag = 3, .op = .read, .node = event, .handle = h, .size = 256 }).bytes); // The root's is a click at the pane with the keyboard, this one. try testing.expectEqual(tree.Status.ok, wr(p, root_exec, "Msg rooted\n").reply.status); try testing.expect(std.mem.indexOf(u8, pane.msg[0..pane.msg_len], "rooted") == null); - try testing.expectEqualStrings("FX0 0 2 10 Msg rooted\n", call(p, .{ .tag = 5, .op = .read, .node = event, .handle = h, .size = 256 }).bytes); + try testing.expectEqualStrings("FX0 0 1 10 Msg rooted\n", call(p, .{ .tag = 5, .op = .read, .node = event, .handle = h, .size = 256 }).bytes); _ = call(p, .{ .tag = 4, .op = .release, .node = event, .handle = h }); // With no reader, the root's and the pane's act at once. try testing.expectEqual(tree.Status.ok, wr(p, Node.of(serial, .exec), "Msg direct\n").reply.status); |
