summaryrefslogtreecommitdiff
path: root/src/keys.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-09 03:31:33 -0300
committerGabriel Schneider <[email protected]>2026-11-09 03:31:33 -0300
commit5de9d27458cd8ff7e326532e8923c933e141ea7f (patch)
tree4b6f63dcfbeea1c4727c6790522c645e082ed150 /src/keys.zig
parent396791f7ca7a03d1cb58a9db35d4d4314ee0c6e9 (diff)
downloadpardes-5de9d27458cd8ff7e326532e8923c933e141ea7f.tar.gz
pardes-5de9d27458cd8ff7e326532e8923c933e141ea7f.zip
idioms: swallows a caller can decide on, decided: a key a macro or a repeat cannot keep is said (Macro.append returns error{OutOfMemory}), a kind's found rows and list pane say their copy's failure as their fill's, a kind word's value past its pane's 256-byte record is said instead of dropped, and the REPL ask record's two prints, which fit, are unreachable with the reason
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/keys.zig')
-rw-r--r--src/keys.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/keys.zig b/src/keys.zig
index 5be3a110..c197940e 100644
--- a/src/keys.zig
+++ b/src/keys.zig
@@ -153,7 +153,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);
+ 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);
// 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| {
@@ -414,7 +414,7 @@ pub fn handleKey(p: *Pardes, key: Key) void {
const m = &p.macro;
switch (was) {
.normal => {
- Macro.append(&m.command, p.gpa, key);
+ Macro.append(&m.command, p.gpa, key) catch |err| p.reportError(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);
@@ -424,7 +424,7 @@ pub fn handleKey(p: *Pardes, key: Key) void {
} 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);
+ Macro.append(&m.last_insert, p.gpa, key) catch |err| p.reportError(p.view().active, "macro", err);
if (t.mode != .insert) m.inserting = false;
},
.tty => {},