summaryrefslogtreecommitdiff
path: root/core/keys.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/keys.zig')
-rw-r--r--core/keys.zig24
1 files changed, 12 insertions, 12 deletions
diff --git a/core/keys.zig b/core/keys.zig
index 5a3ad10f..2f63d045 100644
--- a/core/keys.zig
+++ b/core/keys.zig
@@ -43,7 +43,7 @@ pub fn cycleMode(p: *Pardes, id: usize) void {
pane.body.mode = .normal;
pane.body.normal.clear();
},
- .normal => edit.enterInsert(p.editor(), &pane.body, .at, 1) catch |err| p.reportError(id, "edit", err),
+ .normal => edit.enterInsert(p.editor(), &pane.body, .at, 1) catch |err| p.reportError(.at(id), "edit", err),
.insert => {
edit.exitInsert(p.editor(), &pane.body);
if (pane.isTerminal()) enterTty(p, id);
@@ -88,7 +88,7 @@ pub fn forwardKey(p: *Pardes, id: usize, key: Key) void {
var first: std.heap.BufferFirstAllocator = .init(&room, p.gpa);
var out: std.Io.Writer.Allocating = .init(first.allocator());
defer out.deinit();
- panes.Term.key(state, key, &out.writer) catch |err| return p.reportError(id, "key", err);
+ panes.Term.key(state, key, &out.writer) catch |err| return p.reportError(.at(id), "key", err);
if (out.written().len > 0) p.emitWrite(id, out.written());
}
@@ -177,7 +177,7 @@ pub fn answerQuestion(p: *Pardes, id: usize, choice: ?u8) bool {
exec.sendToRepl(p, id, to, ask.text);
return true;
};
- p.setMessage(id, "Repl: the REPL chosen is gone; nothing sent");
+ p.setMessage(.at(id), "Repl: the REPL chosen is gone; nothing sent");
},
.del_side => {
asked.prompt = .none;
@@ -194,7 +194,7 @@ pub fn answerQuestion(p: *Pardes, id: usize, choice: ?u8) bool {
pub fn handleKey(p: *Pardes, key: Key) void {
// A double-click is two clicks with nothing between them.
p.view().last_click = null;
- if (p.macro.recording != 0 and p.macro.replaying == 0) Macro.append(&p.macro.recorded, p.gpa, key) catch |err| p.reportError(p.view().active, "macro", err);
+ if (p.macro.recording != 0 and p.macro.replaying == 0) Macro.append(&p.macro.recorded, p.gpa, key) catch |err| p.reportError(.at(p.view().active), "macro", err);
// A question waiting on a pane takes the next key, whatever mode the
// pane or a header edit is in: that key is its answer.
for (p.panes, 0..) |slot, id| {
@@ -298,8 +298,8 @@ pub fn handleKey(p: *Pardes, key: Key) void {
// global window ops (any mode): Alt-n new terminal below, Alt-c move
// the active terminal into a fresh column
if (hit(key, config.new_shell_below)) {
- const free = p.freeSlot() orelse return p.reportError(p.view().active, "Term", error.NoPaneSlots);
- const nt = p.newShell(free, "") catch |err| return p.reportError(p.view().active, "Term", err);
+ const free = p.freeSlot() orelse return p.reportError(.at(p.view().active), "Term", error.NoPaneSlots);
+ const nt = p.newShell(free, "") catch |err| return p.reportError(.at(p.view().active), "Term", err);
nt.greet = true;
// From a tag, as a 9P new is: acme's t->w == nil.
layout.placeNew(p, p.view().active, if (p.view().header != null) null else p.view().active, free, .shell);
@@ -339,7 +339,7 @@ pub fn handleKey(p: *Pardes, key: Key) void {
}
if (hit(key, config.escape) or pending) {
pane.input.mode = .normal;
- p.setMessage(p.view().active, "name drafted: Enter renames the buffer, Esc drops the draft");
+ p.setMessage(.at(p.view().active), "name drafted: Enter renames the buffer, Esc drops the draft");
return;
}
edit.handleInsert(p.editor(), &pane.input, key);
@@ -381,7 +381,7 @@ pub fn handleKey(p: *Pardes, key: Key) void {
if (t.what != .body) {
// An explicit selection, else the word under the cursor in the
// text as it is shown: a tag's prefix is part of what a word is.
- const shown = p.scratch.allocator().dupe(u8, edit.flatSurface(p.editor(), t) catch |err| return p.reportError(p.view().active, "exec", err)) catch |err| return p.reportError(p.view().active, "exec", err);
+ const shown = p.scratch.allocator().dupe(u8, edit.flatSurface(p.editor(), t) catch |err| return p.reportError(.at(p.view().active), "exec", err)) catch |err| return p.reportError(.at(p.view().active), "exec", err);
const range = t.primaryRange(shown, 0);
const lo = @min(range.anchor, range.head);
const hi = @max(range.anchor, range.head);
@@ -451,17 +451,17 @@ pub fn handleKey(p: *Pardes, key: Key) void {
const m = &p.macro;
switch (was) {
.normal => {
- Macro.append(&m.command, p.gpa, key) catch |err| p.reportError(p.view().active, "macro", err);
+ Macro.append(&m.command, p.gpa, key) catch |err| p.reportError(.at(p.view().active), "macro", err);
if (t.mode == .insert) {
m.last_insert.clearRetainingCapacity();
- m.last_insert.appendSlice(p.gpa, m.command.items) catch |err| p.reportError(p.view().active, "macro", err);
+ m.last_insert.appendSlice(p.gpa, m.command.items) catch |err| p.reportError(.at(p.view().active), "macro", err);
m.typed_from = m.last_insert.items.len;
m.inserting = true;
m.command.clearRetainingCapacity();
} else if (std.meta.eql(t.normal, modal.Normal.State{})) m.command.clearRetainingCapacity();
},
.insert => if (m.inserting) {
- Macro.append(&m.last_insert, p.gpa, key) catch |err| p.reportError(p.view().active, "macro", err);
+ Macro.append(&m.last_insert, p.gpa, key) catch |err| p.reportError(.at(p.view().active), "macro", err);
if (t.mode != .insert) m.inserting = false;
},
.tty => {},
@@ -483,7 +483,7 @@ fn leaderKey(p: *Pardes, key: Key) void {
const c: u8 = @intCast(key.cp);
if (c == config.leader_help) {
panes.Output.openHelp(p, v.active, v.leader_keys[0..p.view().leader_n]) catch |err|
- p.reportError(v.active, "help", err);
+ p.reportError(.at(v.active), "help", err);
return;
}
if (v.leader_n >= v.leader_keys.len) return;