summaryrefslogtreecommitdiff
path: root/src/Messages.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 02:32:33 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:15 -0300
commit672b2643583d13feef5d47600e0f6c15f276fba2 (patch)
tree3d556d0f30e72c8b2ed7bd4177a802e2a0697992 /src/Messages.zig
parent45a66bd1c062a5cf4d63b1df68e050b059cdfa1d (diff)
downloadpardes-672b2643583d13feef5d47600e0f6c15f276fba2.tar.gz
pardes-672b2643583d13feef5d47600e0f6c15f276fba2.zip
No placement leaves a pane shorter than its tag and two rows
Placement could split a pane down to a tag and one row, or give a new one less. Every placement now checks the pane it made and each pane it shrank against its tag (wrapped at its width) plus two rows: where they lack the room, the column's tallest pane is halved instead, and where none can give it the new pane is refused with "no space for a pane in that column" (ENOSPC over 9P) and closed at the step's end, once its maker is done with it. splitBelow and splitParent leave two body rows (a boot layout, split before any row exists, is as before). Re-recorded by name: lookpanes (panes one or two rows lower) and splitparent (the 6-row squeeze now refuses); fs.py closes the scratches and long-named panes it no longer needs, since its 24-row session filled. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/Messages.zig')
-rw-r--r--src/Messages.zig11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Messages.zig b/src/Messages.zig
index b197e715..daf195bb 100644
--- a/src/Messages.zig
+++ b/src/Messages.zig
@@ -444,18 +444,23 @@ pub fn messageLog(m: *const Messages, i: usize) ?*const LoggedMessage {
return &m.log[(first + i) % limits.message_log];
}
-/// `<operation>: <the error in words>`: FileNotFound reads "file not found".
/// What a route that would open a pane says when every slot is taken.
/// "no space": 9ns's word for ENOSPC (it has none for ENFILE).
pub const no_pane_slots = "no space for a pane: {d} max";
+/// ...and when the column it would go in has no rows for one.
+pub const no_pane_room = "no space for a pane in that column: each keeps its tag and {d} rows";
+/// `<operation>: <the error in words>`: FileNotFound reads "file not found".
pub fn reportError(p: *Pardes, id: usize, operation: []const u8, err: anyerror) void {
var buf: [256]u8 = undefined;
var w = std.Io.Writer.fixed(&buf);
w.print("{s}: ", .{operation}) catch {};
// Every route that opens a pane says the cap the same way.
- if (err == error.NoPaneSlots) {
- w.print(no_pane_slots, .{pardes.MAX_PANES}) catch {};
+ if (err == error.NoPaneSlots or err == error.NoPaneRoom) {
+ if (err == error.NoPaneSlots)
+ w.print(no_pane_slots, .{pardes.MAX_PANES}) catch {}
+ else
+ w.print(no_pane_room, .{pardes.layout.min_body_rows}) catch {};
// A 9P look or exec that would open the pane fails with it too.
p.fs.no_pane_slot = true;
@memcpy(p.fs.ename[0..w.buffered().len], w.buffered());