diff options
Diffstat (limited to 'core/ninep/ctl.zig')
| -rw-r--r-- | core/ninep/ctl.zig | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/core/ninep/ctl.zig b/core/ninep/ctl.zig index 2411b20f..6d78bc44 100644 --- a/core/ninep/ctl.zig +++ b/core/ninep/ctl.zig @@ -555,7 +555,7 @@ fn checkBuiltin(p: *Pardes, req: Req, line: []const u8, scope: builtins.Scope) ? if (arg.len == 0 and builtins.registry.requiresArg(b)) return refuse(p, req, "wrong #args in control message", line); const setting = config.Settings.find(word) orelse return null; const takes = switch (setting.action) { - .theme => if (pardes.colors.themeIndex(arg) != null) true else { + .theme => if (pardes.colors.themeIndex(arg) != null or pardes.colors.successorOf(arg) != null) true else { // `refuse` quotes the line after it, all in the 128 bytes an // Rerror carries: the names get what is left. const head = "bad value in control message; like it: "; @@ -882,7 +882,10 @@ const e_no_pane = "no such pane"; /// rio's kbdin (windows/rio/xfid.c:515): each rune written is a key typed /// at the pane with the keyboard, the user's own, each done before the next -/// and all before the write is answered. Control runes are Ctrl and a +/// and all before the write is answered. They run as the keyboard's, not as +/// a script's write: what they start on a worker (a picker's listing or +/// search, a parse, a language server's answer) comes after the answer, as +/// a keyboard's comes a frame later. Control runes are Ctrl and a /// letter, but for Plan 9's keys (include/ALL/keyboard.h): \n or \r Enter, /// \t Tab, \b Backspace, 0x7f Delete, 0x1b Esc, and the arrows, Home, End, /// Page Up and Down, Insert and F1-F12 at its private-use runes. Its @@ -890,8 +893,11 @@ const e_no_pane = "no such pane"; /// or Ctrl to the key after them. pub fn writeKbdin(p: *Pardes, req: Req) Reply { const view = std.unicode.Utf8View.init(req.data) catch return tree.failText(req.tag, E.INVAL, "invalid UTF-8"); - p.fs.typed = true; - defer p.fs.typed = false; + // The keyboard's path, not a script's write's: nothing waits on the + // loop for a picker's source or an answer (Pick.asked, Stream.step). + const serving = p.fs.serving; + p.fs.serving = false; + defer p.fs.serving = serving; var it = view.iterator(); var mods: pardes.Key = .{ .cp = 0 }; while (it.nextCodepointSlice()) |rune| { @@ -946,8 +952,10 @@ fn kbdKey(rune: []const u8) pardes.Key { /// changed since the last line is pressed or released there, in that order /// of buttons; a move with one held drags, with none moves. pub fn writeMousein(p: *Pardes, req: Req) Reply { - p.fs.typed = true; - defer p.fs.typed = false; + // The mouse's path, as kbdin's keys take the keyboard's. + const serving = p.fs.serving; + p.fs.serving = false; + defer p.fs.serving = serving; var lines = std.mem.tokenizeScalar(u8, req.data, '\n'); while (lines.next()) |line| { var words = std.mem.tokenizeAny(u8, line, " \t\r"); |
