diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-26 12:44:35 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-26 13:02:49 -0300 |
| commit | 51f211d694beff9a389ab519f2286cef077adb81 (patch) | |
| tree | 2df93ee551f2820011f6f67b32f5131fbd927888 /core/Command.zig | |
| parent | 3d60aa05ec1a6f9ed535186be6c6c2850c71b24d (diff) | |
| parent | d7b01dfc187244b6613a954d82552675d3bd2689 (diff) | |
| download | pardes-51f211d694beff9a389ab519f2286cef077adb81.tar.gz pardes-51f211d694beff9a389ab519f2286cef077adb81.zip | |
merge (M3): tonplrtr 3d60aa05ec1a (L2a: the tags, grips, band and notice row drawn from the chrome, the old ChromeTheme, Roles and Grounds views deleted, part H's inks, the path dim while a pane previews another file; M2's wxvzvomn, dump.load resolves the chrome; FP's PDF preview leak, the exec rerun's spawn stop, ABI 3.4's PDF hits) with rppqvrqx d7b01dfc1872 (W9, walkui UX DESIGN part O on W5's part M: the tag stays at rest and the head hangs under it as the band's first row, a picker hangs under the tag of the pane with the keyboard, the mouse never ends it, TagState.waits, Pick.tall, the act/source row gone), resolved: THE CODE: core/draw.zig joinBand draws W5/W9's layout with L2a's inks: the head (TagState.head) and the band from `p.chrome().on(focus or plain)` (its keys `inks.key`, its error `inks.severity[0]`, its dim and rule the ground's), the band's rows' keys, chords, `pre` (the name tint `chrome.name[g]`), dim, kind and matched letters as L2a drew them, W9's loop variable `i` kept; paintPaneTag keeps W9's question in the tag (TagState.asking) and L2a's single tag ink (W9's out-of-rest `text_style` gone with L2a's: a question's text and the tag's own were the same ink once Roles went), and draws the computed words in the words' ink whenever the tag does not ask (L2a's `head == null and !asks`: out of rest the tag is the rest tag now, so its words are the rest words); render's head-and-band gutter (W9's `at.tag`) on L2a's ground; draw's key-ink test reads `p.chrome().on(.focus)` and W9's `? help`; core/TagState.zig's W5 test "out of rest a tag is drawn as at rest ..." (renamed: "... but the box and its path's ink, the path its own and dim ...") lets the path's cells differ in their ink alone, the dim ink, the dimmed text ending `/far.txt`: L2a's zrxurkop dims a tag's path while its body previews another file (the coordinator's ruling, UX DESIGN M7.2), which the test, written before it on W5's tree, read as a moved cell (core-test failed it at TagState.zig:1741 on the merge as jj made it); THE GOLDENS: process-test -- --update re-recorded all 103 golden cases, the 102 golden files (every one with a frame out of rest among them), and moved exactly the two in conflict, fsearch and selregex, each now W9's text rows byte for byte (gdiff.py: no snap row differs from W9's) and L2a's inks on them; read cell by cell (.scratch/walkui/M3/gpairs.py: each cell where the merge differs from W9's recording, and whether L2a made that same move base -> L2a): selregex's four style blocks and fsearch's one move only by L2a's classes: the window and column rows to the page (#b2c3b8 on #1d2824 -> #788079 on #0d1410, the active column's #becfc4 on #314738 too), the reading pane's tint #2c2c0f gone to the focus ground #394440 under the rest tag (full ink #becfc4 -> #cadbd0, the name tint #ecc8f2 kept, its computed words and the blanks after them #becfc4 -> #a1b1a8, the word ink) and under the head on the row below it (text #cadbd0, keys #bada9d -> #add38a bold, dim #79836f -> #8e9d94), a focused reading grip's glyph #000000 -> mode_glyph #06779d, the rail's current tick to the current hit #917a53, a command pane's computed words #b2c3b8 -> #819188; the only pairs L2a's own recordings never made are the same ink moves on cells W9 newly drew there: the head row's gutter cells on the tag's ground (`d` and the body's #e5eee5 on #2c2c0f -> #394440: render's gutter fill on L2a's ground), and fsearch's rest tag on the reading pane W9 moved to row 16 (name tint and words as selregex's); no row neither side explains; the 100 other golden files re-recorded byte for byte as the merge had them (L2a's 36 as L2a recorded them, W9's six text-only goldens as W9 did); GATES (Debug tui, on this change): core-test 1163/1338 (175 skipped; L2a's tree 1160/1335, W9's three new tests), shell-test 1386/1389 (3 skipped), process-test 0 of 103 failed with --update (2 moved, read above); the rest of the gates on the stack's top; load 1.2 to 2.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'core/Command.zig')
| -rw-r--r-- | core/Command.zig | 58 |
1 files changed, 48 insertions, 10 deletions
diff --git a/core/Command.zig b/core/Command.zig index 132ad9e4..bb42bbbd 100644 --- a/core/Command.zig +++ b/core/Command.zig @@ -710,6 +710,12 @@ fn tagOf(p: *Pardes) ![]const u8 { return tagline.tagText(p, p.scratch.allocator(), p.panes[p.view().active].?); } +/// The head under the active pane's tag (UX DESIGN M2); none at rest. +fn headOf(p: *Pardes) ![]const u8 { + const h = try TagState.head(p, p.scratch.allocator(), p.panes[p.view().active].?); + return if (h) |made| made.text else ""; +} + /// Whether `needle` is in `hay`, a run of two spaces or more in either read /// as two: a right block's padding is its row's (UX D3). fn has(hay: []const u8, needle: []const u8) bool { @@ -753,7 +759,7 @@ test ": opens a field in the tag after its key cell: the tag's own words first, try std.testing.expectEqual(Prompt.Op.command, s.prompt.op); try std.testing.expectEqual(panes.Pane.Focus.body, pane.focus); // The head: its key cell, the field, the count, the hints. - try std.testing.expect(has(try tagOf(p), ": 18 commands Tab complete · ⏎ run · C-r history · esc")); + try std.testing.expect(has(try headOf(p), "18 commands C-r history")); // The rows: the tag's words in its order, `in the tag`, the last ruled // off; then the commands, each what it takes. try std.testing.expect(has(try bandRow(p, a, 0), "▶ Save ")); @@ -771,7 +777,7 @@ test ": opens a field in the tag after its key cell: the tag's own words first, try std.testing.expect(has(first[9].text, "theme") and has(first[9].text, "<theme>")); // Typing filters both, by the scorer, in their order. typeKeys(p, "th"); - try std.testing.expect(has(try tagOf(p), ": th = Exec th 1 command ")); + try std.testing.expect(has(try headOf(p), ": th = Exec th 1 command ")); try std.testing.expect(has(try bandRow(p, a, 0), "▶ theme ")); // Tab: the command, a space after it; the field's plain word is its // pardes word once it is whole. @@ -779,7 +785,7 @@ test ": opens a field in the tag after its key cell: the tag's own words first, try std.testing.expectEqualStrings("theme ", s.field.text()); typeKeys(p, "acme"); const worn = colors.themes[p.theme_preview.?].name; - try std.testing.expect(has(try tagOf(p), try std.fmt.allocPrint(a, ": theme acme = Exec Theme {s} ", .{worn}))); + try std.testing.expect(has(try headOf(p), try std.fmt.allocPrint(a, ": theme acme = Exec Theme {s} ", .{worn}))); p.update(.{ .key = .{ .cp = Key.enter } }); try std.testing.expectEqual(TagState.Kind.rest, s.kind); try std.testing.expectEqualStrings(worn, p.theme().name); @@ -789,7 +795,7 @@ test ": opens a field in the tag after its key cell: the tag's own words first, // `:sort`: the selections piped through sort, as `|sort` does. while (p.nextEffect()) |_| {} typeKeys(p, "%:sort"); - try std.testing.expect(has(try tagOf(p), ": sort = Exec Edit |sort 1 command")); + try std.testing.expect(has(try headOf(p), ": sort = Exec Edit |sort 1 command")); p.update(.{ .key = .{ .cp = Key.enter } }); var asked: ?u32 = null; while (p.nextEffect()) |effect| if (effect == .pipe) { @@ -798,7 +804,7 @@ test ": opens a field in the tag after its key cell: the tag's own words first, try std.testing.expectEqualStrings("sort", p.pipe.pipeRequest(asked orelse return error.MissingPipeEffect).?.command); // `:goto 2`: Look `:2`. typeKeys(p, ":goto 2"); - try std.testing.expect(has(try tagOf(p), ": goto 2 = Look :2 <line> ")); + try std.testing.expect(has(try headOf(p), ": goto 2 = Look :2 <line> ")); p.update(.{ .key = .{ .cp = Key.enter } }); try std.testing.expectEqual(@as(i32, 1), pane.body.cur_row); // S-Tab: the last row; Tab after it, round to the first. A tag word @@ -846,7 +852,7 @@ test ":theme lists the themes and the whole window wears the current one, none d typeKeys(p, ":theme "); try std.testing.expectEqual(Rows.themes, s.prompt.command.rows); try std.testing.expectEqual(@as(u16, @intCast(colors.themes.len)), s.nhits); - try std.testing.expect(has(try tagOf(p), try std.fmt.allocPrint(a, " {d} themes · the window wears the current one ", .{colors.themes.len}))); + try std.testing.expect(has(try headOf(p), try std.fmt.allocPrint(a, " {d} themes · the window wears the current one ", .{colors.themes.len}))); // The window wears the first: its colours, its chrome; no pane dimmed. try std.testing.expectEqualStrings(colors.themes[s.hits[0]].name, p.theme().name); try std.testing.expectEqual(colors.Chrome.of(p.theme()), p.chrome().*); @@ -890,9 +896,9 @@ test ":theme lists the themes and the whole window wears the current one, none d try std.testing.expectEqual(Rows.values, s.prompt.command.rows); try std.testing.expectEqual(@as(u16, 2), s.nhits); try std.testing.expect(has(try bandRow(p, a, 0), "▶ on now")); - try std.testing.expect(has(try tagOf(p), ": set Wrap = Exec Wrap 2 values ")); + try std.testing.expect(has(try headOf(p), ": set Wrap = Exec Wrap 2 values ")); typeKeys(p, "of"); - try std.testing.expect(has(try tagOf(p), ": set Wrap of = Exec Wrap of 1 value ")); + try std.testing.expect(has(try headOf(p), ": set Wrap of = Exec Wrap of 1 value ")); p.update(.{ .key = .{ .cp = Key.tab } }); p.update(.{ .key = .{ .cp = Key.enter } }); try std.testing.expect(!p.settings.wrap); @@ -914,7 +920,7 @@ test ":theme lists the themes and the whole window wears the current one, none d // :open: the line goes to Find, the rest of it the query, the keys // after it typed into Find's field. typeKeys(p, ":o"); - try std.testing.expect(has(try tagOf(p), ": o = Exec Find ")); + try std.testing.expect(has(try headOf(p), ": o = Exec Find ")); typeKeys(p, " te"); try std.testing.expectEqual(TagState.Kind.pick, s.kind); try std.testing.expectEqual(pardes.Pick.Source.find, pardes.Pick.live(p).?.source); @@ -956,7 +962,7 @@ test ": has a history of its own: Up and Down bring back the lines Enter ran, ne typeKeys(p, ":"); p.update(.{ .key = .{ .cp = Key.up } }); try std.testing.expectEqualStrings("goto 2", s.field.text()); - try std.testing.expect(has(try tagOf(p), ": goto 2 = Look :2 <line> ")); + try std.testing.expect(has(try headOf(p), ": goto 2 = Look :2 <line> ")); p.update(.{ .key = .{ .cp = Key.up } }); try std.testing.expectEqualStrings("set Wrap off", s.field.text()); try std.testing.expectEqual(Rows.values, s.prompt.command.rows); @@ -1087,3 +1093,35 @@ test ": lists the words of the pane's kind its tag does not show now, `for this try std.testing.expectEqual(@as(usize, 1), p.view().ncol); try std.testing.expectEqualStrings("one\n", pane.file.?.content); } + +test ": hangs its field under the tag, which stays as at rest; `:` on the empty field gives the keyboard to that tag's own text right above it, the head's row the body's again (UX DESIGN M3)" { + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 30 }); + defer p.deinit(); + var frame = std.heap.ArenaAllocator.init(std.testing.allocator); + defer frame.deinit(); + const a = frame.allocator(); + const pane = try p.setTestFile("one\ntwo\n"); + pane.tag.own = try p.gpa.dupe(u8, "notes"); + p.sync(); + const id = p.view().active; + const r = p.view().rects[id]; + const head_y = p.tagTop(pane, r) + pane.tag_rows; + const rest = try a.dupe(u8, try tagOf(p)); + const at_rest = try a.dupe(pardes.Cell, (try p.render(a)).cells); + const cols = p.surface.cols; + typeKeys(p, ":"); + try std.testing.expectEqual(TagState.Kind.prompt, p.view().tag_state.kind); + try std.testing.expectEqualStrings(rest, try tagOf(p)); + var s = try p.render(a); + try std.testing.expectEqualStrings(":", s.at(r.x + pardes.TAG_TEXT_INSET, head_y).grapheme()); + typeKeys(p, ":"); + try std.testing.expectEqual(TagState.Kind.rest, p.view().tag_state.kind); + try std.testing.expectEqual(panes.Pane.Focus.tag, pane.focus); + try std.testing.expectEqualStrings(rest, try tagOf(p)); + s = try p.render(a); + for (r.x..r.x + r.w) |x| try std.testing.expectEqualStrings(at_rest[@as(usize, head_y) * cols + x].grapheme(), s.cells[@as(usize, head_y) * cols + x].grapheme()); + // The caret at the start of the tag's own text. + const own: u16 = @intCast(panes.File.displayWidth(p.settings.tab, rest[0..std.mem.indexOf(u8, rest, "notes").?])); + try std.testing.expectEqual(r.x + pardes.TAG_TEXT_INSET + own, s.cursor.?.x); + try std.testing.expectEqual(p.tagTop(pane, r), s.cursor.?.y); +} |
