diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-05 20:05:20 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 22:03:21 -0300 |
| commit | d2b04b2a24a04b5de1416b33f37637f59dda71ee (patch) | |
| tree | 727b5d4006d67b85c9decee7d708f5811cd16e68 /src/tagline.zig | |
| parent | 12cb0a704075dea2512f77582635376fe967dee6 (diff) | |
| download | pardes-d2b04b2a24a04b5de1416b33f37637f59dda71ee.tar.gz pardes-d2b04b2a24a04b5de1416b33f37637f59dda71ee.zip | |
split pardes.zig by noun, the small moves: a header's word under a column (WordBounds, wordBoundsAtCol) goes to tagline.zig, the two frontend pixel helpers for tag bands (taglineBandOffset, topbarPaneBorderPixels) to Layer.zig with their test, the look walk's row budget (max_look_rows) to look.zig, its only reader; their callers name them there (draw.zig, mouse.zig, gui.zig, and macos.zig's two by text, built nowhere here); pathUnder goes, called from nowhere; the help index stays in the root, as builtins.zig's registry walks that file's own declarations and the index's rows depend on the registry (a dependency loop), and the theme's three accessors stay with the session, as colors.zig's locals are named theme; test moved, by name: tagline bands center in their cells and Tagbottom faces the window edge (to Layer.zig); a pure move, no field touched, a dump and the wire as they were; gates: tui core-test 960/960, behaviour-test 238/238, 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 | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/tagline.zig b/src/tagline.zig index 0bb0018b..3e7ebe52 100644 --- a/src/tagline.zig +++ b/src/tagline.zig @@ -518,3 +518,16 @@ test "a pane tag wraps a long line onto rows, and offsets map both ways" { try std.testing.expectEqual(@as(usize, 10), shown.toReal(11)); // the 'e' of Del try std.testing.expectEqual(@as(usize, 11), shown.fromReal(10)); } + +const WordBounds = struct { lo: usize, hi: usize }; + +/// The space-delimited word covering `col` in `str` (a header's click and +/// hover), null on a space or past the end. +pub fn wordBoundsAtCol(str: []const u8, col: usize) ?WordBounds { + if (col >= str.len or str[col] == ' ') return null; + var lo: usize = col; + while (lo > 0 and str[lo - 1] != ' ') lo -= 1; + var hi: usize = col; + while (hi < str.len and str[hi] != ' ') hi += 1; + return .{ .lo = lo, .hi = hi }; +} |
