summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-04 23:44:02 -0300
committerGabriel Schneider <[email protected]>2026-11-05 01:00:59 -0300
commit4e01152529be72a36a1c850106d3a0f91f46091c (patch)
tree9e1409bcabd3b578248394f3b3fe415a264e9ee2 /src/pardes.zig
parent8b24617780e0f9d50b0bfd9cee1883802af24515 (diff)
downloadpardes-4e01152529be72a36a1c850106d3a0f91f46091c.tar.gz
pardes-4e01152529be72a36a1c850106d3a0f91f46091c.zip
pardes.zig: a name being drafted says "name drafted" from one branch, at p.active (the pane handleKey has), where two branches each looked the pane's slot up again to say it; dumpFailed's message buffer is declared once, not in each of its three branches
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig31
1 files changed, 13 insertions, 18 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index e0311749..cd247272 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -5373,16 +5373,15 @@ pub const Pardes = struct {
// Into a DumpDir that is not there: said so, ENOENT, as a Save is;
// one that is there but no directory (`/dev/null`) says that.
const parent = parentTrouble(path, err);
- if (parent.denied and parent.kind == null) {
- var said: [limits.host_path_cap + 48]u8 = undefined;
- p.reportFailure(p.active, std.fmt.bufPrint(&said, "{s}: permission denied", .{operation}) catch "Dump: permission denied");
- } else if (parent.kind != null and parent.kind != .directory) {
- var said: [limits.host_path_cap + 48]u8 = undefined;
- p.reportFailure(p.active, std.fmt.bufPrint(&said, "{s}: {s} is not a directory", .{ operation, parent.dir }) catch "Dump: not a directory");
- } else if (parent.missing) {
- var said: [limits.host_path_cap + 48]u8 = undefined;
- p.reportFailure(p.active, std.fmt.bufPrint(&said, "{s}: no such directory", .{operation}) catch "Dump: no such directory");
- } else p.reportError(p.active, operation, err);
+ var said: [limits.host_path_cap + 48]u8 = undefined;
+ if (parent.denied and parent.kind == null)
+ p.reportFailure(p.active, std.fmt.bufPrint(&said, "{s}: permission denied", .{operation}) catch "Dump: permission denied")
+ else if (parent.kind != null and parent.kind != .directory)
+ p.reportFailure(p.active, std.fmt.bufPrint(&said, "{s}: {s} is not a directory", .{ operation, parent.dir }) catch "Dump: not a directory")
+ else if (parent.missing)
+ p.reportFailure(p.active, std.fmt.bufPrint(&said, "{s}: no such directory", .{operation}) catch "Dump: no such directory")
+ else
+ p.reportError(p.active, operation, err);
// In the words the message row has, so the write's err is the one
// record of it (its msg goes: 9p_io, dropMessage).
p.noteLateFailure(p.active);
@@ -6123,18 +6122,14 @@ pub const Pardes = struct {
return;
}
const pending = pane.input.mode != .insert;
- if (hit(key, config.escape) and !pending) {
- pane.input.mode = .normal;
- if (p.paneIdOf(pane)) |id| p.setMessage(id, "name drafted: Enter renames the buffer, Esc drops the draft");
- return;
- }
- if (hit(key, config.escape)) {
+ if (hit(key, config.escape) and pending) {
pane.closePrompt();
pane.focus = .body;
return;
}
- if (pending) {
- if (p.paneIdOf(pane)) |id| p.setMessage(id, "name drafted: Enter renames the buffer, Esc drops the draft");
+ if (hit(key, config.escape) or pending) {
+ pane.input.mode = .normal;
+ p.setMessage(p.active, "name drafted: Enter renames the buffer, Esc drops the draft");
return;
}
edit.handleInsert(p, &pane.input, key);