diff options
| -rw-r--r-- | core/Band.zig | 55 | ||||
| -rw-r--r-- | core/Core.zig | 11 | ||||
| -rw-r--r-- | core/TagState.zig | 97 | ||||
| -rw-r--r-- | test/process/tty_boot.zig | 51 | ||||
| -rw-r--r-- | test/process/tty_editing.zig | 5 | ||||
| -rw-r--r-- | test/process/tty_terminals.zig | 9 | ||||
| -rw-r--r-- | test/snapshots/builtins.golden | 94 | ||||
| -rw-r--r-- | test/snapshots/find.golden | 9 | ||||
| -rw-r--r-- | test/snapshots/leader.golden | 127 | ||||
| -rw-r--r-- | test/snapshots/ttyhelp.golden | 18 |
10 files changed, 332 insertions, 144 deletions
diff --git a/core/Band.zig b/core/Band.zig index 9fa204ee..03cdbbda 100644 --- a/core/Band.zig +++ b/core/Band.zig @@ -328,24 +328,31 @@ fn findSpines(band: *Band, p: *Pardes, arena: std.mem.Allocator, pane: *Pane, id } /// `rows` wrapped at `width` display columns, word by word, `height` rows -/// at most: a doc's paragraphs. +/// at most: a doc's paragraphs, a line each in its text (builtins.Doc), +/// each starting a row (a newline drawn in a row was a `�`). fn wrap(arena: std.mem.Allocator, tab: u16, rows: []const Row, width: u16, max: u16) ![]const Row { var out: std.ArrayList(Row) = .empty; - for (rows) |row| { - if (File.displayWidth(tab, row.text) <= width) { - try out.append(arena, row); - } else { - var rest = row.text; - while (rest.len > 0 and out.items.len < max) { - var cut = File.byteAtDisplay(tab, rest, width); - if (cut < rest.len) { - if (std.mem.lastIndexOfScalar(u8, rest[0..cut], ' ')) |space| { - if (space > 0) cut = space; + for (rows) |whole| { + var paragraphs = std.mem.splitScalar(u8, whole.text, '\n'); + var row = whole; + while (paragraphs.next()) |text| : (row = .{ .text = "" }) { + if (out.items.len >= max) break; + row.text = text; + if (File.displayWidth(tab, row.text) <= width) { + try out.append(arena, row); + } else { + var rest = row.text; + while (rest.len > 0 and out.items.len < max) { + var cut = File.byteAtDisplay(tab, rest, width); + if (cut < rest.len) { + if (std.mem.lastIndexOfScalar(u8, rest[0..cut], ' ')) |space| { + if (space > 0) cut = space; + } } + if (cut == 0) cut = modal.nextGrapheme(rest, 0); + try out.append(arena, .{ .text = std.mem.trimEnd(u8, rest[0..cut], " ") }); + rest = std.mem.trimStart(u8, rest[cut..], " "); } - if (cut == 0) cut = modal.nextGrapheme(rest, 0); - try out.append(arena, .{ .text = std.mem.trimEnd(u8, rest[0..cut], " ") }); - rest = std.mem.trimStart(u8, rest[cut..], " "); } } if (out.items.len >= max) break; @@ -540,3 +547,23 @@ test "the band's words are read-only text: B2 runs one, the tag back at rest" { try std.testing.expect(p.settings.wrap != wrapped); try std.testing.expect(p.view().prefix == .none and !p.view().tag_state.unrolled); } + +test "a doc's paragraphs are rows of their own: no newline in a band's row" { + const Key = pardes.Key; + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 40 }); + defer p.deinit(); + _ = try p.setTestFile("one\n"); + const id = p.view().active; + var frame = std.heap.ArenaAllocator.init(std.testing.allocator); + defer frame.deinit(); + const a = frame.allocator(); + // SPC b b is Panes, whose documentation has three paragraphs. + for ([_]u21{ ' ', 'b', Key.down }) |c| p.update(.{ .key = .{ .cp = c } }); + const band = (try of(p, a, p.panes[id].?, id)).?; + var docs: usize = 0; + for (band.steps[0..band.nsteps]) |step| for (step.rows) |row| { + try std.testing.expect(std.mem.indexOfScalar(u8, row.text, '\n') == null); + if (step.doc) docs += 1; + }; + try std.testing.expect(docs > 2); +} diff --git a/core/Core.zig b/core/Core.zig index 11f254ab..5ce635f2 100644 --- a/core/Core.zig +++ b/core/Core.zig @@ -2028,6 +2028,15 @@ pub fn sync(p: *Pardes) void { caret_row = std.mem.count(u8, shown.text[0..@min(shown.fromReal(cur), shown.text.len)], "\n"); } if (!pane.tag_expanded) wanted = 1; + // Out of rest the head is the tag's text (TagState), and the tag + // keeps the rows its own text takes at least: a head shorter than + // it (a root's key cell, before its level shows) moved the body up + // and back down a moment later; a terminal's exactly those, its pty + // its body (a resize the program under it saw at every C-w and SPC). + if (pardes.TagState.hostOf(p) == id) { + const rest = layout.wantedTagRows(p, id); + wanted = if (pane.isTerminal()) rest else @max(wanted, rest); + } pane.tag_rows = @intCast(@min(wanted, MAX_TAG_ROWS, @max(BOX_H, r.h -| 1))); if (pane.collapsed) pane.tag_rows = BOX_H; if (pane.focus == .tag and pane.prompt != .name) { @@ -2035,7 +2044,7 @@ pub fn sync(p: *Pardes) void { var top: usize = pane.tag_top; if (cur < top) top = cur; if (cur >= top + pane.tag_rows) top = cur + 1 - pane.tag_rows; - pane.tag_top = @intCast(@min(top, lines - pane.tag_rows)); + pane.tag_top = @intCast(@min(top, lines -| pane.tag_rows)); } else pane.tag_top = 0; // The band unrolled under the tag's text pushes the body down: // the tag's rows, as everything under them counts them. diff --git a/core/TagState.zig b/core/TagState.zig index a0ac6353..867b1391 100644 --- a/core/TagState.zig +++ b/core/TagState.zig @@ -486,21 +486,28 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?Head { // The rolled level wraps to three rows at most (SPEC §3.6): what does // not fit is `…`, and `↓` unrolls it whole. A terminal's to the rows its // own text takes: its pty is its body, and a which-key that took a row - // would resize the program under it at every SPC. + // would resize the program under it at every SPC. Every cell is + // counted: the prefix, each child with its separator and a group's + // `…`, the ` …` after a child that is not the last, a struck key, the + // hint (left out, a terminal's tag took a row more at some widths). const hint = " ↓ unroll · ? help"; + const more = " …"; const prefix = try tagline.prefixIn(p, arena, pane); const tab = p.settings.tab; const most: usize = if (pane.isTerminal()) @import("layout.zig").wantedTagRows(p, id) else 3; - const room = most * tagline.tagWidth(p, id) -| panes.File.displayWidth(tab, prefix) -| panes.File.displayWidth(tab, hint) -| 2; + const struck: usize = if (s.miss != 0) 1 + panes.File.displayWidth(tab, bindings.keyName(s.miss)) else 0; + const room = most * tagline.tagWidth(p, id) -| panes.File.displayWidth(tab, prefix) -| panes.File.displayWidth(tab, hint) -| struck; var children: [bindings.max_children]bindings.Child = undefined; + const level = bindings.level(p, cur.root, cur.path, &children); const used = s.used[node.group]; - for (bindings.level(p, cur.root, cur.path, &children)) |c| { - const width = panes.File.displayWidth(tab, b.text.items) + 2 + bindings.keyName(c.key).len + 1 + panes.File.displayWidth(tab, c.label); - if (width > room) { - try b.put(" …"); + var width = panes.File.displayWidth(tab, b.text.items); + for (level, 0..) |c, i| { + width += @as(usize, if (i == 0) 1 else 2) + panes.File.displayWidth(tab, bindings.keyName(c.key)) + 1 + panes.File.displayWidth(tab, c.label) + @intFromBool(c.group); + if (width + @as(usize, if (i + 1 < level.len) panes.File.displayWidth(tab, more) else 0) > room) { + try b.put(more); break; } - try b.put(if (b.text.items.len > 0 and std.mem.endsWith(u8, b.text.items, "▸")) " " else " "); + try b.put(if (i == 0) " " else " "); const lo: u32 = @intCast(b.text.items.len); try b.styled(bindings.keyName(c.key), .key); try b.put(" "); @@ -808,3 +815,79 @@ test "a terminal's rolled level takes no more tag rows than its own text: its pt try std.testing.expectEqual(tag_rows, pane.tag_rows); try std.testing.expectEqual(rows, pane.rows); } + +test "a rolled level fits its rows at every width: its `…`, its groups' `…` and a struck key are counted" { + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 40 }); + defer p.deinit(); + _ = try p.setTestFile("one\n"); + var frame = std.heap.ArenaAllocator.init(std.testing.allocator); + defer frame.deinit(); + const a = frame.allocator(); + const pane = p.panes[p.view().active].?; + for ([_]pardes.Key{ .{ .cp = ' ' }, .{ .cp = 'w', .ctrl = true } }) |root| for ([_]bool{ false, true }) |struck| { + p.update(.{ .key = root }); + p.advance(p.clock.now_ns); + p.clock.now_ns = p.view().tag_state.due_ns; + // `x` is a child of neither level: struck, the level stays. + if (struck) p.update(.{ .key = .{ .cp = 'x' } }); + for (30..161) |cols| { + p.update(.{ .resize = .{ .cols = @intCast(cols), .rows = 40 } }); + try std.testing.expect(hostOf(p) != null); + try std.testing.expect((try tagline.shownTag(p, a, pane)).rows() <= 3); + } + toRest(p); + p.update(.{ .resize = .{ .cols = 120, .rows = 40 } }); + }; +} + +test "a terminal's rolled level keeps its tag rows at every width, C-w's as SPC's: its pty is never resized" { + if (pardes.Term.ops == null) return error.SkipZigTest; // a shell + const p = try Pardes.init(std.testing.allocator, .{ .file = "mise.toml", .cols = 100, .rows = 30 }); + defer p.deinit(); + _ = pardes.exec.spawnTty(p, 0); + const shell = p.view().active; + const pane = p.panes[shell].?; + pane.body.mode = .normal; + for ([_]pardes.Key{ .{ .cp = ' ' }, .{ .cp = 'w', .ctrl = true } }) |root| for (30..131) |cols| { + p.update(.{ .resize = .{ .cols = @intCast(cols), .rows = 30 } }); + p.sync(); + const rows, const tag_rows = .{ pane.rows, pane.tag_rows }; + p.update(.{ .key = root }); + // Its key cell alone, before the level shows: shorter than the + // tag's own text, the rows it had. + p.sync(); + try std.testing.expect(hostOf(p) == shell); + try std.testing.expectEqual(tag_rows, pane.tag_rows); + try std.testing.expectEqual(rows, pane.rows); + p.advance(p.clock.now_ns); + p.clock.now_ns = p.view().tag_state.due_ns; + p.sync(); + try std.testing.expectEqual(tag_rows, pane.tag_rows); + try std.testing.expectEqual(rows, pane.rows); + toRest(p); + }; +} + +test "a tag out of rest keeps its rows at rest at least: a root's key cell alone moves no body up" { + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 40, .rows = 30 }); + defer p.deinit(); + _ = try p.setTestFile("one\n"); + const pane = p.panes[p.view().active].?; + p.sync(); + const rows, const tag_rows = .{ pane.rows, pane.tag_rows }; + try std.testing.expect(tag_rows > 1); + p.update(.{ .key = .{ .cp = ' ' } }); + p.sync(); + try std.testing.expect(hostOf(p) != null); + try std.testing.expectEqual(tag_rows, pane.tag_rows); + try std.testing.expectEqual(rows, pane.rows); + // With the keyboard in the tag (whose top row follows its caret) too: + // C-w's key cell, a line, in a tag of more rows. + toRest(p); + pane.focus = .tag; + p.update(.{ .key = .{ .cp = 'w', .ctrl = true } }); + p.sync(); + try std.testing.expect(hostOf(p) != null); + try std.testing.expectEqual(tag_rows, pane.tag_rows); + try std.testing.expectEqual(@as(u16, 0), pane.tag_top); +} diff --git a/test/process/tty_boot.zig b/test/process/tty_boot.zig index 01b35a24..e342ea46 100644 --- a/test/process/tty_boot.zig +++ b/test/process/tty_boot.zig @@ -114,14 +114,17 @@ fn boot(gpa: std.mem.Allocator, exe: [:0]const u8) !void { fn builtins(gpa: std.mem.Allocator, exe: [:0]const u8) !void { var t = try Tty.init(gpa, exe, "builtins"); defer t.deinit(); - try t.lines("notes.txt", 6, ""); + // SPC ? is Help in the tag now (pick-ui SPEC §4.5): the +Help index is + // the word's, `Help` run from the workspace's tag, `Help c` swept here. + try t.file("notes.txt", "Help c Help h\nline 2\nline 3\nline 4\nline 5\nline 6\n"); try t.start(67, 120, &.{"notes.txt"}); try t.wait(8000, "notes.txt"); try t.stable(700, 20000); try t.snap("boot"); // The full index includes commands without leader paths. - try t.key("space ?"); + try t.press("middle", "@Help", 1); + try t.release("middle", "@Help", 1); try t.wait(10000, "pardes builtins: each one's keys and its name"); try t.wait(10000, "ClipPasteBefore"); // The words with no SPC path come last, each under its documentation: @@ -141,19 +144,20 @@ fn builtins(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try t.key("space j n space j n space j n"); try t.wait(10000, "Look enter, right-click"); try t.wait(10000, "Look at its argument as B3 does"); - try t.key("space c ?"); + try sweepHelp(&t, "@Help#1", 4); try t.wait(10000, "under SPC c"); try t.wait(10000, "Joincol"); try t.stable(700, 15000); try t.snap("column-group"); - try t.key("space h ?"); + try sweepHelp(&t, "@Help#2", 4); try t.wait(10000, "Tutor"); try t.stable(700, 15000); try t.snap("docs-group"); - // Tutor's row, under the documentation of the three before it - try t.press("middle", "@Tutor", 24); - try t.release("middle", "@Tutor", 24); + // Tutor's row, under the documentation of the four before it (Keys, + // describe-key, is SPC h k) + try t.press("middle", "@Tutor", 30); + try t.release("middle", "@Tutor", 30); try t.wait(10000, "PARDES TUTOR"); try t.stable(700, 15000); try t.snap("tutor-from-index"); @@ -472,13 +476,18 @@ fn topbarexec(gpa: std.mem.Allocator, exe: [:0]const u8) !void { fn leader(gpa: std.mem.Allocator, exe: [:0]const u8) !void { var t = try Tty.init(gpa, exe, "leader"); defer t.deinit(); - try t.file("cmds.txt", "Help"); + // SPC ? and `?` down a level are Help in the tag now (pick-ui SPEC + // §4.5): the +Help index for a group is the word's, `Help h` swept here. + try t.file("cmds.txt", "Help Help h Help t Help c Help l"); try t.start(41, 100, &.{"cmds.txt"}); try t.wait(8000, "Newcol Joincol"); try t.wait(8000, "cmds.txt"); try t.stable(700, 20000); + // SPC's level, rolled in the tag once its delay is up (a frame on the + // clock, which a quiet screen does not wait for) try t.key("space"); + try t.wait(5000, "↓ unroll"); try t.stable(400, 5000); try t.snap("spc"); try t.key("h"); @@ -489,15 +498,21 @@ fn leader(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try t.stable(400, 5000); try t.snap("abandoned"); try t.key("space x"); + try t.wait(5000, "↓ unroll"); try t.stable(400, 5000); try t.snap("unmapped"); + // A key the level has no child for is struck and the level stays + // (which-key); Esc leaves it. + try t.key("esc"); + try t.settle(100); + try t.stable(400, 5000); // Executing Help as text opens the full index, not a filtered group. try t.press("middle", "@Help", 4); try t.release("middle", "@Help", 4); try t.wait(10000, "pardes builtins: each one's keys and its name"); try t.wait(10000, "ClipPasteBefore"); - try t.key("space h ?"); + try sweepHelp(&t, "@Help#2", 4); try t.wait(10000, "under SPC h"); try t.stable(700, 15000); try t.snap("help-group"); @@ -517,23 +532,24 @@ fn leader(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try t.key("space d"); try t.stable(700, 15000); - try t.key("space ?"); + try t.press("middle", "@Help", 4); + try t.release("middle", "@Help", 4); try t.wait(10000, "pardes builtins: each one's keys and its name"); try t.wait(10000, "ClipPasteBefore"); // PDF commands depend on the build; these toggles do not. - try t.key("space t ?"); + try sweepHelp(&t, "@Help#3", 4); try t.wait(10000, "under SPC t"); // its first rows: each word's documentation under it, the rest below try t.wait(10000, "SPC t a Ascii"); try t.wait(10000, "SPC t c Changes"); // SPC w is Window itself now, not a group; the column group stands in - try t.key("space c ?"); + try sweepHelp(&t, "@Help#4", 4); try t.wait(10000, "under SPC c"); try t.wait(10000, "Joincol"); try t.stable(700, 15000); try t.snap("help-column"); - try t.key("space l ?"); + try sweepHelp(&t, "@Help#5", 4); try t.wait(10000, "WsDiagnostics"); try t.stable(700, 15000); try t.snap("help-language"); @@ -544,6 +560,15 @@ fn leader(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try t.done(); } +/// B2 swept over `Help <key>` from the word `at` on `row` (its six +/// cells): the word and its argument run, as a sweep anywhere runs them. +fn sweepHelp(t: *Tty, at: []const u8, row: u16) !void { + const end = try std.fmt.allocPrint(t.arena, "{s}+6", .{at}); + try t.press("middle", at, row); + try t.drag("middle", end, row); + try t.release("middle", end, row); +} + fn mini(gpa: std.mem.Allocator, exe: [:0]const u8) !void { var t = try Tty.init(gpa, exe, "mini"); defer t.deinit(); diff --git a/test/process/tty_editing.zig b/test/process/tty_editing.zig index 53e1da1e..33ad2802 100644 --- a/test/process/tty_editing.zig +++ b/test/process/tty_editing.zig @@ -608,9 +608,12 @@ fn find(gpa: std.mem.Allocator, exe: [:0]const u8) !void { try t.start(41, 120, &.{"here.txt"}); try t.wait(8000, "here.txt"); try t.stable(700, 20000); - // SPC f is a group (Find, New, Save, Recent, Grep): the indicator waits + // SPC f is a group (Find, New, Save, Recent, Grep): its level rolled in + // the tag once SPC's delay is up (a frame on the clock, which a quiet + // screen does not wait for) try t.key("space"); try t.key("f"); + try t.wait(5000, "↓ unroll"); try t.stable(400, 5000); try t.snap("group"); // the second f opens the query pane: every file listed, line 1 `Find ` diff --git a/test/process/tty_terminals.zig b/test/process/tty_terminals.zig index 9f7c9308..896ac062 100644 --- a/test/process/tty_terminals.zig +++ b/test/process/tty_terminals.zig @@ -226,12 +226,13 @@ fn ttyhelp(gpa: std.mem.Allocator, exe: [:0]const u8) !void { // row 0, which is not a pane, so the terminal never saw it. try t.key("c-b"); try t.stable(600, 10000); + // SPC ? is Help in the focused pane's tag (pick-ui SPEC §4.5): a field + // typed in, the leaves it matches in rows under the tag, the cursor's + // documentation beside them. try t.key("space"); try t.key("?"); - // The bare-tty boot now opens an empty pane under the shell, so the index is - // half as tall: wait on a row that is on screen. What the leader route - // produced is the snapshot below, not this. - try t.wait(10000, "SPC ? Help"); + try t.send("tutor"); + try t.wait(10000, "SPC h t · Tutor · help"); try t.stable(700, 15000); try t.snap("leaderworks"); try t.done(); diff --git a/test/snapshots/builtins.golden b/test/snapshots/builtins.golden index e9786c8a..d0277f63 100644 --- a/test/snapshots/builtins.golden +++ b/test/snapshots/builtins.golden @@ -2,7 +2,7 @@ | Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config History Debug Exit | New Term Find Grep Joincol Delcol | /tmp/pardes-snap/builtins/cwd/notes.txt Save Term Collapse Follow Del -| 1 line 1 +| 1 Help c Help h | 2 line 2 | 3 line 3 | 4 line 4 @@ -10,6 +10,7 @@ | 6 line 6 | ~ == snap column-group grid=120x67 cursor=7,10 +|3: 1 Help c Help h Help |9: /tmp/pardes-snap/builtins/cwd/+Help Save Term Collapse Follow Del |10: 1 pardes builtins under SPC c |11: 2 @@ -34,7 +35,7 @@ |30: ~ |57: +Search 1/1 Save Undock Del |58: /^ +Look -|59: @p2:220:1 Look enter, right-click +|59: @p2:224:1 Look enter, right-click == snap docs-group grid=120x67 cursor=7,10 |10: 1 pardes builtins under SPC h |12: 3 SPC h b Build @@ -44,50 +45,47 @@ |17: 7 SPC h c Changelog topbar |18: 8 Show this build's version and what changed to reach it, in a +Changelog. |19: 9 -|20: 10 SPC h m Messages -|21: 11 Show the messages said so far in a +Messages. -|22: 12 -|23: 13 SPC h t Tutor topbar -|24: 14 Open the tutor, a document to work through. -|25: 15 -|26: ~ -|27: -|28: -|29: -|30: -== snap tutor-from-index grid=120x67 cursor=7,37 +|20: 10 SPC h k Keys +|21: 11 Show what a key sequence runs: the next keys typed are replayed in the tag. +|22: 12 The tag shows `Keys` and the keys as they are typed; a sequence that reaches a leaf unrolls its level under the ↩ +|23: tag with the leaf on the cursor and its documentation beside it, and Enter runs it. Every root answers: SPC, g, ↩ +|24: m, z, Z, [, ], window mode's C-w. A sequence nothing is bound to is shown struck, `runs nothing`. Esc leaves it. +|25: 13 +|26: 14 SPC h m Messages +|27: 15 Show the messages said so far in a +Messages. +|28: 16 +|29: 17 SPC h t Tutor topbar +|30: 18 Open the tutor, a document to work through. +|31: 19 +|32: ~ +== snap tutor-from-index grid=120x67 cursor=7,43 +|3: 1 Help c Help h |10: 1 pardes builtins under SPC h Tutor -|26: +Search 1/1 Save Undock Del -|27: /^ +Look -|28: @p2:220:1 Look enter, right-click -|36: /tmp/pardes-snap/builtins/cwd/+Tutor Save Term Collapse Follow Del -|37: 1 -|38: 2 PARDES TUTOR -|39: 3 -|40: 4 This pane is +Tutor, a copy: edit it freely; there is no need to -|41: 5 Save it (a bare Save asks for a path to write a copy to). -|42: 6 `Del` in its tag closes it; once you have edited it, `Del` refuses -|43: 7 once and the second `Del` discards. `Tutor` or SPC h t opens a -|44: 8 fresh copy. -|45: 9 -|46: 10 The guide (docs/typ/guide.typ) explains; this is the hands-on part. -|47: 11 Each lesson is a few things to do, then names its guide section. -|48: 12 Words in backticks, like `Save`, are builtins. -|49: 13 `Exec` (B2) runs the builtin a word names, or else runs it as a -|50: 14 shell line; `Look` (B3) opens what the text names, or else finds -|51: 15 it. Type a builtin in any tag and `Exec` it. Lines starting with -|52: 16 "| " are tags. -|53: 17 -|54: 18 Press j until you reach part 1. -|55: 19 -|56: 20 -|57: 21 ================================================================= -|58: 22 = PART 1 — MODES = -|59: 23 ================================================================= -|60: 24 -|61: 25 1. The box left of this pane's tag is blank, so you are in -|62: 26 NORMAL mode. Press i: it shows ^ (INSERT). Type a word, then -|63: 27 Esc: blank again. -|64: 28 2. Press Esc once more, in NORMAL: the keyboard goes back to the -|65: 29 pane you were in before (not what helix does). Come back with -|66: 30 Esc again. +|32: +Search 1/1 Save Undock Del +|33: /^ +Look +|34: @p2:224:1 Look enter, right-click +|42: /tmp/pardes-snap/builtins/cwd/+Tutor Save Term Collapse Follow Del +|43: 1 +|44: 2 PARDES TUTOR +|45: 3 +|46: 4 This pane is +Tutor, a copy: edit it freely; there is no need to +|47: 5 Save it (a bare Save asks for a path to write a copy to). +|48: 6 `Del` in its tag closes it; once you have edited it, `Del` refuses +|49: 7 once and the second `Del` discards. `Tutor` or SPC h t opens a +|50: 8 fresh copy. +|51: 9 +|52: 10 The guide (docs/typ/guide.typ) explains; this is the hands-on part. +|53: 11 Each lesson is a few things to do, then names its guide section. +|54: 12 Words in backticks, like `Save`, are builtins. +|55: 13 `Exec` (B2) runs the builtin a word names, or else runs it as a +|56: 14 shell line; `Look` (B3) opens what the text names, or else finds +|57: 15 it. Type a builtin in any tag and `Exec` it. Lines starting with +|58: 16 "| " are tags. +|59: 17 +|60: 18 Press j until you reach part 1. +|61: 19 +|62: 20 +|63: 21 ================================================================= +|64: 22 = PART 1 — MODES = +|65: 23 ================================================================= +|66: 24 diff --git a/test/snapshots/find.golden b/test/snapshots/find.golden index 4825d1dc..ee343b32 100644 --- a/test/snapshots/find.golden +++ b/test/snapshots/find.golden @@ -1,10 +1,13 @@ -== snap group grid=120x41 cursor=7,3 +== snap group grid=120x41 cursor=7,4 | Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config History Debug Exit | New Term Find Grep Joincol Delcol -| /tmp/pardes-snap/find/cwd/here.txt Save Term Collapse Follow Del -| 1 Find zqm SPC f +| /tmp/pardes-snap/find/cwd/here.txt ␣ f ▸ c Config f Find g Grep h History n New r Recent s Save ↓ unroll · ? h +| elp +| 1 Find zqm == snap armed grid=120x41 cursor=7,23 +|2: /tmp/pardes-snap/find/cwd/here.txt Save Term Collapse Follow Del |3: 1 Find zqm Find +|4: |22: ^ +Search 1/5 Del |23: Find |24: here.txt diff --git a/test/snapshots/leader.golden b/test/snapshots/leader.golden index 9f523992..81ddd6ce 100644 --- a/test/snapshots/leader.golden +++ b/test/snapshots/leader.golden @@ -1,14 +1,28 @@ -== snap spc grid=100x41 cursor=7,3 +== snap spc grid=100x41 cursor=7,5 | Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config History Debug Exit | New Term Find Grep Joincol Delcol -| /tmp/pardes-snap/leader/cwd/cmds.txt Save Term Collapse Follow Del -| 1 Help SPC -== snap spc-h grid=100x41 cursor=7,3 -|3: 1 Help SPC h +| /tmp/pardes-snap/leader/cwd/cmds.txt ␣ ▸ b buffer… c column… f file… h help… j jump… l lsp… +| n new… s session… t view… / All ? Help d Del p ClipPaste P ClipPasteBefore q Exit R ClipR +| eplace w Window y ClipYank Y ClipYankMain ↓ unroll · ? help +| 1 Help Help h Help t Help c Help l +== snap spc-h grid=100x41 cursor=7,4 +|2: /tmp/pardes-snap/leader/cwd/cmds.txt ␣ h ▸ b Build c Changelog k Keys m Messages t Tutor ↓ u +|3: nroll · ? help +|4: 1 Help Help h Help t Help c Help l +|5: == snap abandoned grid=100x41 cursor=7,3 -|3: 1 Help -== snap unmapped grid=100x41 cursor=7,3 +|2: /tmp/pardes-snap/leader/cwd/cmds.txt Save Term Collapse Follow Del +|3: 1 Help Help h Help t Help c Help l +|4: +== snap unmapped grid=100x41 cursor=7,5 +|2: /tmp/pardes-snap/leader/cwd/cmds.txt ␣ ▸ b buffer… c column… f file… h help… j jump… l lsp… +|3: n new… s session… t view… / All ? Help d Del p ClipPaste P ClipPasteBefore q Exit R ClipR +|4: eplace w Window y ClipYank Y ClipYankMain x ↓ unroll · ? help +|5: 1 Help Help h Help t Help c Help l == snap help-group grid=100x41 cursor=7,6 +|2: /tmp/pardes-snap/leader/cwd/cmds.txt Save Term Collapse Follow Del +|3: 1 Help Help h Help t Help c Help l Help +|4: |5: /tmp/pardes-snap/leader/cwd/+Help Save Term Collapse Follow Del |6: 1 pardes builtins under SPC h |7: 2 @@ -20,34 +34,41 @@ |13: 7 SPC h c Changelog topbar |14: 8 Show this build's version and what changed to reach it, in a +Changelog. |15: 9 -|16: 10 SPC h m Messages -|17: 11 Show the messages said so far in a +Messages. -|18: 12 -|19: 13 SPC h t Tutor topbar -|20: 14 Open the tutor, a document to work through. -|21: 15 -|22: ~ -== snap tutor grid=100x41 cursor=7,23 +|16: 10 SPC h k Keys +|17: 11 Show what a key sequence runs: the next keys typed are replayed in the tag. +|18: 12 The tag shows `Keys` and the keys as they are typed; a sequence that reaches a leaf unrolls ↩ +|19: its level under the tag with the leaf on the cursor and its documentation beside it, and Ent↩ +|20: er runs it. Every root answers: SPC, g, m, z, Z, [, ], window mode's C-w. A sequence nothing↩ +|21: is bound to is shown struck, `runs nothing`. Esc leaves it. +|22: 13 +|23: 14 SPC h m Messages +|24: 15 Show the messages said so far in a +Messages. +|25: 16 +|26: 17 SPC h t Tutor topbar +|27: 18 Open the tutor, a document to work through. +|28: 19 +|29: ~ +== snap tutor grid=100x41 cursor=7,24 +|3: 1 Help Help h Help t Help c Help l |6: 1 pardes builtins under SPC h Tutor -|22: /tmp/pardes-snap/leader/cwd/+Tutor Save Term Collapse Follow Del -|23: 1 -|24: 2 PARDES TUTOR -|25: 3 -|26: 4 This pane is +Tutor, a copy: edit it freely; there is no need to -|27: 5 Save it (a bare Save asks for a path to write a copy to). -|28: 6 `Del` in its tag closes it; once you have edited it, `Del` refuses -|29: 7 once and the second `Del` discards. `Tutor` or SPC h t opens a -|30: 8 fresh copy. -|31: 9 -|32: 10 The guide (docs/typ/guide.typ) explains; this is the hands-on part. -|33: 11 Each lesson is a few things to do, then names its guide section. -|34: 12 Words in backticks, like `Save`, are builtins. -|35: 13 `Exec` (B2) runs the builtin a word names, or else runs it as a -|36: 14 shell line; `Look` (B3) opens what the text names, or else finds -|37: 15 it. Type a builtin in any tag and `Exec` it. Lines starting with -|38: 16 "| " are tags. -|39: 17 -|40: 18 Press j until you reach part 1. +|23: /tmp/pardes-snap/leader/cwd/+Tutor Save Term Collapse Follow Del +|24: 1 +|25: 2 PARDES TUTOR +|26: 3 +|27: 4 This pane is +Tutor, a copy: edit it freely; there is no need to +|28: 5 Save it (a bare Save asks for a path to write a copy to). +|29: 6 `Del` in its tag closes it; once you have edited it, `Del` refuses +|30: 7 once and the second `Del` discards. `Tutor` or SPC h t opens a +|31: 8 fresh copy. +|32: 9 +|33: 10 The guide (docs/typ/guide.typ) explains; this is the hands-on part. +|34: 11 Each lesson is a few things to do, then names its guide section. +|35: 12 Words in backticks, like `Save`, are builtins. +|36: 13 `Exec` (B2) runs the builtin a word names, or else runs it as a +|37: 14 shell line; `Look` (B3) opens what the text names, or else finds +|38: 15 it. Type a builtin in any tag and `Exec` it. Lines starting with +|39: 16 "| " are tags. +|40: 17 == snap deleted grid=100x41 cursor=7,3 |5: |6: @@ -67,25 +88,26 @@ |20: |21: |22: -|23: -|24: /tmp/pardes-snap/leader/cwd/+Help Save Term Collapse Follow Del -|25: 1 pardes builtins under SPC h -|26: 2 -|27: 3 SPC h b Build -|28: 4 Show this build in a +Build: its version, compiler, optimize mode, target and dependencies. -|29: 5 A stamped build's (a release, or the ~/.local install) commit, jj change and build time too,↩ -|30: its platform, its grammars, and whether the addons are compiled in. -|31: 6 -|32: 7 SPC h c Changelog topbar -|33: 8 Show this build's version and what changed to reach it, in a +Changelog. -|34: 9 -|35: 10 SPC h m Messages -|36: 11 Show the messages said so far in a +Messages. -|37: 12 -|38: 13 SPC h t Tutor topbar -|39: 14 Open the tutor, a document to work through. -|40: 15 +|23: /tmp/pardes-snap/leader/cwd/+Help Save Term Collapse Follow Del +|24: 1 pardes builtins under SPC h +|25: 2 +|26: 3 SPC h b Build +|27: 4 Show this build in a +Build: its version, compiler, optimize mode, target and dependencies. +|28: 5 A stamped build's (a release, or the ~/.local install) commit, jj change and build time too,↩ +|29: its platform, its grammars, and whether the addons are compiled in. +|30: 6 +|31: 7 SPC h c Changelog topbar +|32: 8 Show this build's version and what changed to reach it, in a +Changelog. +|33: 9 +|34: 10 SPC h k Keys +|35: 11 Show what a key sequence runs: the next keys typed are replayed in the tag. +|36: 12 The tag shows `Keys` and the keys as they are typed; a sequence that reaches a leaf unrolls ↩ +|37: its level under the tag with the leaf on the cursor and its documentation beside it, and Ent↩ +|38: er runs it. Every root answers: SPC, g, m, z, Z, [, ], window mode's C-w. A sequence nothing↩ +|39: is bound to is shown struck, `runs nothing`. Esc leaves it. +|40: 13 == snap help-column grid=100x41 cursor=7,6 +|3: 1 Help Help h Help t Help c Help l Help |5: /tmp/pardes-snap/leader/cwd/+Help Save Term Collapse Follow Del |6: 1 pardes builtins under SPC c |7: 2 @@ -158,6 +180,7 @@ |39: 31 |40: 32 SPC l i Lspinfo == snap del-output grid=100x41 cursor=7,3 +|3: 1 Help Help h Help t Help c Help l |5: |6: |7: diff --git a/test/snapshots/ttyhelp.golden b/test/snapshots/ttyhelp.golden index de9471a9..04cbb2a1 100644 --- a/test/snapshots/ttyhelp.golden +++ b/test/snapshots/ttyhelp.golden @@ -40,5 +40,21 @@ |18: 7 SPC P ClipPasteBefore |19: 8 Paste the system clipboard before the selection. |20: 9 -== snap leaderworks grid=100x31 cursor=7,6 +== snap leaderworks grid=100x31 cursor=47,5 |3: $ +|5: ^ /tmp/pardes-snap/ttyhelp/cwd/+Help Help tutor 1/133 +|6: ▶ SPC h t · Tutor · help│ t Tutor +|7: │ Open the tutor, a document to work through. +|8: │ keys SPC h t +|9: │ +|10: 1 pardes builtins: each one's keys and its name, then what it does. Run one by its keys, or by↩ +|11: its name anywhere: B2 on the word, Exec <name>, a line of a ctl file, or `pardes do <name>`↩ +|12: from a shell. `Help <name>` shows one builtin alone; `Help <keys>` (or SPC, those keys, the↩ +|13: n ?) the builtins under SPC and those keys. +|14: 2 +|15: 3 SPC ? Help topbar +|16: 4 Show every builtin with its keys and documentation, or one builtin's alone. +|17: 5 `Help <name>`: that builtin alone, its keys spelled out, what it acts on and its line for a ↩ +|18: shell (`Help Diff`); a setting or an addon's word the same. `Help <keys>`: the builtins unde↩ +|19: r SPC and those keys (`Help l`, as `SPC l ?` shows them). Each fills the one +Help: a second↩ +|20: Help replaces its text. |
