summaryrefslogtreecommitdiff
path: root/src/ninep
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep')
-rw-r--r--src/ninep/ctl.zig7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index ec870253..3393c851 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -17,6 +17,7 @@ const builtins = @import("../builtins.zig");
const exec_line = @import("../exec.zig");
const tree = @import("tree.zig");
const pane_files = @import("pane.zig");
+const keys = @import("../keys.zig");
const Pardes = pardes.Pardes;
const Pane = pardes.Pane;
@@ -1103,7 +1104,7 @@ pub fn writePane(p: *Pardes, req: Req, pane: *Pane) Reply {
} else if (std.mem.eql(u8, line, "answer")) {
// With a question up, what it offers.
var offered: [64]u8 = undefined;
- if (p.questionChoices(p.paneBySerial(serial).?, &offered)) |choices|
+ if (keys.questionChoices(p, p.paneBySerial(serial).?, &offered)) |choices|
return tree.failText(req.tag, E.INVAL, std.fmt.bufPrint(&p.fs.ename, "answer takes {s} or -", .{choices}) catch "answer takes a choice or -");
return tree.failText(req.tag, E.INVAL, "answer takes a choice or -");
} else if (std.mem.startsWith(u8, line, "answer ") and p.panes[p.paneBySerial(serial).?].?.prompt == .save) {
@@ -1121,7 +1122,7 @@ pub fn writePane(p: *Pardes, req: Req, pane: *Pane) Reply {
const choice = std.mem.trim(u8, line["answer ".len..], " ");
const id = p.paneBySerial(serial).?;
var offered: [64]u8 = undefined;
- const choices = p.questionChoices(id, &offered) orelse return refuse(p, req, "no question asked", line);
+ const choices = keys.questionChoices(p, id, &offered) orelse return refuse(p, req, "no question asked", line);
// Only a choice the question offers answers it; anything
// else leaves it standing, and says what it takes.
if (!std.mem.eql(u8, choice, "-") and (choice.len != 1 or std.mem.indexOfScalar(u8, choices, choice[0]) == null)) {
@@ -1129,7 +1130,7 @@ pub fn writePane(p: *Pardes, req: Req, pane: *Pane) Reply {
// The choice refused is what is quoted: `answer takes a b or - "z"`.
return refuseQuoting(p, req, std.fmt.bufPrint(&why, "answer takes {s} or -", .{choices}) catch "answer takes a choice or -", choice, "");
}
- if (apply) _ = p.answerQuestion(id, if (choice[0] == '-') null else choice[0]);
+ if (apply) _ = keys.answerQuestion(p, id, if (choice[0] == '-') null else choice[0]);
} else if (!apply) {
if (checkBuiltin(p, req, line, .pane)) |refusal| return refusal;
// Edit on a pane with no text is the refusal a data write