diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-29 10:44:30 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:16 -0300 |
| commit | d5743f2a58a03539d3c34bee3b2ad18b96b2da55 (patch) | |
| tree | e2726a5605b4f42dae3de00c75d13d327c27b40d /src/ninep/ctl.zig | |
| parent | 5fd713889b6bdeb27c58941b77266c9336bf7b7d (diff) | |
| download | pardes-d5743f2a58a03539d3c34bee3b2ad18b96b2da55.tar.gz pardes-d5743f2a58a03539d3c34bee3b2ad18b96b2da55.zip | |
A refusal over unsaved panes keeps its list in +Unsaved and shows a short notice
Exit's refusal (and Restore's, Del's, Delcol's, get's) put its full text
on a notice that went: a long list of names, gone before it was read. The
list now goes into one +Unsaved pane, filled again by each refusal, a row
a pane (`<name>: Modified`) and the `Exit again to discard` line; the
notice is short, `3 unsaved panes — Exit again to discard`. The 9P
`unsaved` records and the write's err are as they were.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/ctl.zig')
| -rw-r--r-- | src/ninep/ctl.zig | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 18a7eaa9..477a91fe 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -861,12 +861,15 @@ fn getRefused(p: *Pardes, pane: *Pane) ?[]const u8 { if (std.hash.Wyhash.hash(0, f.content) == saved) return null; if (pane.discard_warned) |w| if (w.revision == f.revision and w.by == .get) return null; pane.discard_warned = .{ .revision = f.revision, .by = .get }; - const said = std.fmt.bufPrint(&p.fs.ename, "{s}: Modified (get again to discard)", .{f.path}) catch "Modified (get again to discard)"; - // Shown; the write's err record logs it, not a msg too. + const id = p.paneBySerial(pane.serial).?; + // Kept in +Unsaved, as Exit's refusal is; the notice is short. The + // write's err record logs it, not a msg too. + const listed = std.fmt.allocPrint(p.gpa, "{s}: Modified\n\nget again to discard\n", .{f.path}) catch null; + if (listed) |content| panes.Output.openUnsaved(p, id, content); p.fs.unlogged = true; - defer p.fs.unlogged = false; - p.setMessage(p.paneBySerial(pane.serial).?, said); - return said; + p.setMessage(id, "1 unsaved pane \u{2014} get again to discard"); + p.fs.unlogged = false; + return std.fmt.bufPrint(&p.fs.ename, "{s}: Modified (get again to discard)", .{f.path}) catch "Modified (get again to discard)"; } fn get(p: *Pardes, pane: *Pane, failed: *anyerror) u16 { |
