diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-29 02:32:33 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:15 -0300 |
| commit | 672b2643583d13feef5d47600e0f6c15f276fba2 (patch) | |
| tree | 3d556d0f30e72c8b2ed7bd4177a802e2a0697992 /src/exec.zig | |
| parent | 45a66bd1c062a5cf4d63b1df68e050b059cdfa1d (diff) | |
| download | pardes-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/exec.zig')
| -rw-r--r-- | src/exec.zig | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/exec.zig b/src/exec.zig index d4480e00..6de7991c 100644 --- a/src/exec.zig +++ b/src/exec.zig @@ -808,6 +808,8 @@ pub const NewPane = enum { scratch, fs, shell, doc, command, errors }; /// t->w == nil). pub fn placeNew(p: *Pardes, from: usize, origin: ?usize, id: usize, kind: NewPane) void { const asked = if (p.exec_column != null) null else origin; + layout.compute(p); + const before = p.rects; switch (p.settings.placement) { .acme => switch (kind) { // New: the bottom half of the last pane in its own column @@ -821,6 +823,21 @@ pub fn placeNew(p: *Pardes, from: usize, origin: ?usize, id: usize, kind: NewPan }, .pardes => pardesPlace(p, from, id, kind), } + // No pane is made shorter than its tag and two rows: where the place + // chosen has not the room, the column's tallest pane gives it, and + // where none can, the pane is refused, and closed at the step's end + // (Pardes.unplaced) once whatever made it is done with it. + if (!layout.placedRoomy(p, id, &before)) if (layout.findPane(p, id)) |f| { + layout.removePane(p, id); + for (p.col_panes[f.col][0..p.col_n[f.col]]) |k| p.rects[k] = before[k]; + layout.snapColWeights(p, f.col); + if (!layout.splitTallest(p, f.col, id) or !layout.placedRoomy(p, id, &before)) { + if (layout.findPane(p, id) == null) layout.insert(p, f.col, p.col_n[f.col], id); + p.unplaced.set(id); + p.reportError(from, "placement", error.NoPaneRoom); + return; + } + }; if (kind == .command) return; tagline.exitHeader(p); p.active = id; |
