summaryrefslogtreecommitdiff
path: root/src/builtins.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 19:53:53 -0300
committerGabriel Schneider <[email protected]>2026-11-05 22:03:21 -0300
commit12cb0a704075dea2512f77582635376fe967dee6 (patch)
tree0f498bf581e3f8ece31f8a5eaa06accba7aa7415 /src/builtins.zig
parent1a1ce29051ea6aa3be4754074f6a00b905d6b208 (diff)
downloadpardes-12cb0a704075dea2512f77582635376fe967dee6.tar.gz
pardes-12cb0a704075dea2512f77582635376fe967dee6.zip
split pardes.zig by noun, layout: the session's columns and the rows its chrome takes move into src/layout.zig: newColumn, setActiveColumn, activeColumn, noteTyped, newScratchIn, keyboardColumn, removeColumn, besideColumn, topBarHeight, columnBarHeight, wantedTagRows, bodyTop, tagTop, tagCapacity and reprojectTagHit; the session keeps four as declaration aliases (topBarHeight and bodyTop, called from everywhere; tagTop and setActiveColumn, which Store.zig and Handover.zig call, so the persistence agent's files are untouched), the rest are layout.x(p, ...) in their callers (draw.zig, mouse.zig, ninep/cols.zig, tagline.zig and seven more; gui.zig, whose locals are named layout, through pardes.layout); layout's own placement helper bodyTop, a pane's top past its tag as heights go, is bodyFrom now, the name going to the session's; tests moved with them, by name: a new column takes width only from the column that created it; Newcol refuses an unsplittable restored weight before spawning; repeated non-dyadic column splits preserve every unrelated boundary; dragging a column's only pane to another leaves that column in place, empty; tiny screens keep pane space before adding a column tag; a pure move, no field touched, a dump and the wire as they were; gates: tui core-test 960/960, behaviour-test 238/238, pane-test 171/172 (1 skipped), snap all 108 scripts ok, gui unit-test 1518/1519 (1 skipped)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/builtins.zig')
-rw-r--r--src/builtins.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/builtins.zig b/src/builtins.zig
index 0ad7d998..8a2c2f5f 100644
--- a/src/builtins.zig
+++ b/src/builtins.zig
@@ -1264,7 +1264,7 @@ pub const New = struct {
pub const Newcol = struct {
pub const scope: Scope = .session;
pub fn run(c: Ctx) void {
- c.p.newColumn(c.id);
+ layout.newColumn(c.p, c.id);
}
};
@@ -1413,7 +1413,7 @@ pub const Delcol = struct {
// acme's Delcol refuses a column with unsaved text (exec.c delcol,
// cols.c colclean), once: the next Delcol closes it.
if (warnModifiedIn(c, .Delcol, .{ .column = col })) return;
- c.p.removeColumn(col) catch |err| c.p.reportError(c.id, "close column", err);
+ layout.removeColumn(c.p, col) catch |err| c.p.reportError(c.id, "close column", err);
}
};
@@ -1536,7 +1536,7 @@ pub const Joincol = struct {
pub const scope: Scope = .session;
pub fn run(c: Ctx) void {
// The keyboard's column joins the one to its right; the last has none.
- const col = c.p.keyboardColumn(c.p.active) orelse return;
+ const col = layout.keyboardColumn(c.p, c.p.active) orelse return;
if (col + 1 >= c.p.ncol) return c.p.reportFailure(c.id, "Joincol: no column to the right");
// As Newcol is refused: a column that could not give each pane its
// tag and 2 rows would leave a layout `size` refuses as it is.
@@ -1757,7 +1757,7 @@ pub const Down = struct {
pub fn run(c: Ctx) void {
if (c.p.header_focus) {
const column = layout.findPane(c.p, c.id);
- if (c.p.header_column == null and c.p.columnBarHeight() > 0)
+ if (c.p.header_column == null and layout.columnBarHeight(c.p) > 0)
return tagline.enterHeader(c.p, if (column) |at| at.col else 0);
// Onto the top pane of the column the header stands over.
const col = c.p.header_column orelse if (column) |at| at.col else return;
@@ -1779,7 +1779,7 @@ pub const Up = struct {
return;
}
if (layout.focusDir(c.p, c.id, .up)) return;
- if (c.p.columnBarHeight() > 0) {
+ if (layout.columnBarHeight(c.p) > 0) {
if (layout.findPane(c.p, c.id)) |at| tagline.enterHeader(c.p, at.col);
} else if (c.p.topBarHeight() > 0) tagline.enterHeader(c.p, null);
}