diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-05 19:53:53 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 22:03:21 -0300 |
| commit | 12cb0a704075dea2512f77582635376fe967dee6 (patch) | |
| tree | 0f498bf581e3f8ece31f8a5eaa06accba7aa7415 /src/tagline.zig | |
| parent | 1a1ce29051ea6aa3be4754074f6a00b905d6b208 (diff) | |
| download | pardes-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/tagline.zig')
| -rw-r--r-- | src/tagline.zig | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/tagline.zig b/src/tagline.zig index e14feab4..0bb0018b 100644 --- a/src/tagline.zig +++ b/src/tagline.zig @@ -11,6 +11,7 @@ const exec = @import("exec.zig"); const config = @import("config.zig"); const pdf_enabled = panes.Pdf.enabled; const Layer = @import("Layer.zig"); +const layout = @import("layout.zig"); const Pane = panes.Pane; const Text = panes.Text; const TAG_TEXT_INSET = pardes.TAG_TEXT_INSET; @@ -82,11 +83,11 @@ pub fn revealHeader(p: *Pardes) void { }; const text = edit.flatSurface(p, t) catch return; const cur: usize = @intCast(@max(0, t.cur_row)); - const rows: usize = if (p.header_column != null) p.columnBarHeight() else p.topBarHeight(); + const rows: usize = if (p.header_column != null) layout.columnBarHeight(p) else p.topBarHeight(); if (cur < p.header_top) p.header_top = cur; if (rows > 0 and cur >= p.header_top + rows) p.header_top = cur + 1 - rows; const line = modal.lineSlice(text, cur); - const width = p.tagCapacity(if (p.header_column) |c| p.col_w[c] -| TAG_TEXT_INSET else p.screen_w -| TAG_TEXT_INSET); + const width = layout.tagCapacity(p, if (p.header_column) |c| p.col_w[c] -| TAG_TEXT_INSET else p.screen_w -| TAG_TEXT_INSET); const col = panes.File.rawDisplayCol(line, @min(@as(usize, @intCast(@max(0, t.cur_col))), line.len)); if (col < p.header_scroll) p.header_scroll = col; if (col >= p.header_scroll + width) p.header_scroll = col -| (width -| 1); @@ -308,7 +309,7 @@ pub fn wrapTag(arena: std.mem.Allocator, whole: []const u8, width: usize) !Shown /// than what is left (libframe frutil.c _frcklinewrap), and the caret past /// its end sits at the edge (frptofchar.c clamps it to r.max.x). pub fn tagWidth(p: *const Pardes, id: usize) usize { - return @max(1, @as(usize, p.tagCapacity(p.rects[id].w -| TAG_TEXT_INSET))); + return @max(1, @as(usize, layout.tagCapacity(p, p.rects[id].w -| TAG_TEXT_INSET))); } pub fn shownTag(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !Shown { @@ -504,7 +505,7 @@ test "a column or workspace tag is one line: a newline in it is a space" { try std.testing.expectEqualStrings("Newcol Exit", p.global_tag.own.?); try std.testing.expectEqual(@as(i32, 0), p.col_tags[0].cur_row); try std.testing.expectEqual(@as(i32, 6), p.col_tags[0].cur_col); - try std.testing.expectEqual(pardes.COLBAR_H, p.columnBarHeight()); + try std.testing.expectEqual(pardes.COLBAR_H, layout.columnBarHeight(p)); try std.testing.expectEqual(pardes.TOPBAR_H, p.topBarHeight()); } |
