summaryrefslogtreecommitdiff
path: root/src/keys.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/keys.zig')
-rw-r--r--src/keys.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/keys.zig b/src/keys.zig
index e6b417a9..ece79651 100644
--- a/src/keys.zig
+++ b/src/keys.zig
@@ -90,8 +90,8 @@ pub fn questionChoices(p: *const Pardes, id: usize, buf: []u8) ?[]const u8 {
const ask = p.repl_ask orelse return null;
var w = std.Io.Writer.fixed(buf);
for (ask.offered, 0..) |serial, i| if (serial != 0) {
- if (w.buffered().len > 0) w.writeByte(' ') catch {};
- w.writeByte(@intCast('a' + i)) catch {};
+ if (w.buffered().len > 0) w.writeByte(' ') catch unreachable; // 26 letters and spaces fit 64
+ w.writeByte(@intCast('a' + i)) catch unreachable;
};
return w.buffered();
},
@@ -112,7 +112,7 @@ pub fn answerQuestion(p: *Pardes, id: usize, choice: ?u8) bool {
if (questionChoices(p, id, &offered)) |choices| {
const chosen: ?u8 = if (choice) |c| (if (std.mem.indexOfScalar(u8, choices, c) != null and c != ' ') c else null) else null;
var rec: [32]u8 = undefined;
- ctlfs.events.notePath(p, "answer", std.fmt.bufPrint(&rec, "{d} {c}", .{ asked.serial, chosen orelse '-' }) catch "");
+ ctlfs.events.notePath(p, "answer", std.fmt.bufPrint(&rec, "{d} {c}", .{ asked.serial, chosen orelse '-' }) catch unreachable); // a u32 and a letter
}
switch (asked.prompt) {
.repl_choice => {
@@ -258,7 +258,7 @@ pub fn handleKey(p: *Pardes, key: Key) void {
// 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 return;
+ const nt = p.newShell(free, "") catch |err| return p.reportError(p.view().active, "Term", err);
nt.greet = true;
// From a tag, as a 9P new is: acme's t->w == nil.
exec.placeNew(p, p.view().active, if (p.view().header != null) null else p.view().active, free, .shell);
@@ -340,7 +340,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, t) catch return) catch return;
+ const shown = p.scratch.allocator().dupe(u8, edit.flatSurface(p, t) catch |err| return p.reportError(p.view().active, "exec", err)) catch |err| return p.reportError(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);
@@ -417,7 +417,7 @@ pub fn handleKey(p: *Pardes, key: Key) void {
Macro.append(&m.command, p.gpa, key);
if (t.mode == .insert) {
m.last_insert.clearRetainingCapacity();
- m.last_insert.appendSlice(p.gpa, m.command.items) catch {};
+ m.last_insert.appendSlice(p.gpa, m.command.items) catch |err| p.reportError(p.view().active, "macro", err);
m.typed_from = m.last_insert.items.len;
m.inserting = true;
m.command.clearRetainingCapacity();