summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 05:20:13 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commit5002c612298fe645791218059a69d2bc80a42d2d (patch)
tree1c3ea64ea9b18f8c4f3f67508520f41fd758119e /src/pardes.zig
parentc27e38eb3e97fd505255ee4b42d32ddc77c58ced (diff)
downloadpardes-5002c612298fe645791218059a69d2bc80a42d2d.tar.gz
pardes-5002c612298fe645791218059a69d2bc80a42d2d.zip
Newcol at the column cap says so, and a desktop session holds 16 columns
Newcol with every column slot taken, or a column too narrow to split, did nothing and said nothing. It now fails (a ctl write with it) with no space for a column: 16 max (ENOSPC through 9ns), or that the column is too narrow. MAX_COLS is 16 on a desktop, 6 on the board; each column costs about 8 KB of core state (the Pardes struct grows from 1.47 MB to 1.56 MB), most of it its tag's text. fs.md and the skill give the cap. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index b488ec1c..9f192004 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -267,7 +267,9 @@ pub const MAX_TAG_ROWS = 8;
pub const MAX_TAG_LAYERS = MAX_PANES + MAX_COLS + 1 + MAX_PANES * Pane.Notices.max;
pub const NOTICE_LAYER_BASE = MAX_PANES + MAX_COLS + 1;
pub const PDF_PAGE_GAP_PX = panes.Pdf.page_gap_px;
-pub const MAX_COLS = 6;
+/// Columns a session holds: 16 on a desktop (each costs about 8 KB of state,
+/// a column tag being most of it), 6 on the board.
+pub const MAX_COLS = if (platform == .esp32p4) 6 else 16;
const column_weight_unit = layout.column_weight_unit;
const max_column_weight = layout.max_column_weight;
pub const MAX_JUMPS = 64;
@@ -4849,7 +4851,14 @@ pub const Pardes = struct {
/// on its tag, for the next pane made to fill.
pub fn newColumn(p: *Pardes, from_id: usize) void {
const col = p.keyboardColumn(from_id) orelse return;
- const c = layout.insertColumn(p, col, false) orelse return;
+ // Said, not silently nothing: "no space" is 9ns's word for ENOSPC.
+ const c = layout.insertColumn(p, col, false) orelse {
+ var said: [96]u8 = undefined;
+ return p.reportFailure(from_id, if (p.ncol >= MAX_COLS)
+ std.fmt.bufPrint(&said, "Newcol: no space for a column: {d} max", .{MAX_COLS}) catch "Newcol: no space for a column"
+ else
+ "Newcol: no space for a column: this one is too narrow to split");
+ };
tagline.enterHeader(p, c);
}