diff options
| -rw-r--r-- | core/Band.zig | 2 | ||||
| -rw-r--r-- | core/Command.zig | 18 | ||||
| -rw-r--r-- | core/Core.zig | 5 | ||||
| -rw-r--r-- | core/Pick.zig | 5 | ||||
| -rw-r--r-- | core/Prompt.zig | 22 | ||||
| -rw-r--r-- | core/TagState.zig | 38 | ||||
| -rw-r--r-- | core/Trail.zig | 93 | ||||
| -rw-r--r-- | core/bindings.zig | 10 | ||||
| -rw-r--r-- | core/draw.zig | 11 | ||||
| -rw-r--r-- | core/layout.zig | 2 | ||||
| -rw-r--r-- | core/lsp/Ask.zig | 2 | ||||
| -rw-r--r-- | core/tagline.zig | 51 | ||||
| -rw-r--r-- | test/behaviour/keys.zig | 5 | ||||
| -rw-r--r-- | test/snapshots/find.golden | 84 | ||||
| -rw-r--r-- | test/snapshots/fsearch.golden | 42 | ||||
| -rw-r--r-- | test/snapshots/leader.golden | 22 | ||||
| -rw-r--r-- | test/snapshots/lsp.golden | 51 | ||||
| -rw-r--r-- | test/snapshots/msg.golden | 8 | ||||
| -rw-r--r-- | test/snapshots/pipe.golden | 4 | ||||
| -rw-r--r-- | test/snapshots/selregex.golden | 16 | ||||
| -rw-r--r-- | test/snapshots/ttyhelp.golden | 4 |
21 files changed, 289 insertions, 206 deletions
diff --git a/core/Band.zig b/core/Band.zig index 835c249f..2fcf4a3b 100644 --- a/core/Band.zig +++ b/core/Band.zig @@ -555,7 +555,7 @@ test "SPC Down unrolls the level into a band under the tag's text, the body push for (s.cells[@as(usize, layer.viewport.y) * s.cols ..][layer.viewport.x..][0..layer.viewport.w]) |cell| try grid.appendSlice(frame.allocator(), cell.grapheme()); try std.testing.expect(std.mem.indexOf(u8, grid.items, "▶ b buffer…") != null); // The head names the level and says how to roll it up. - try std.testing.expect(std.mem.endsWith(u8, try tagline.tagText(p, frame.allocator(), pane), " ␣ SPC ↑ roll up · ? field · esc")); + try std.testing.expect(std.mem.endsWith(u8, try tagline.tagText(p, frame.allocator(), pane), "␣ SPC ↑ roll up · ? field · esc")); // Down moves the cursor; Up back to the first row, then rolls up. p.update(.{ .key = .{ .cp = Key.down } }); try std.testing.expectEqual(@as(u8, 'c'), p.view().tag_state.hi); diff --git a/core/Command.zig b/core/Command.zig index 55c336f1..334d49a2 100644 --- a/core/Command.zig +++ b/core/Command.zig @@ -685,7 +685,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), " : 16 commands Tab complete · ⏎ run · C-r history · esc")); + try std.testing.expect(has(try tagOf(p), ": 16 commands Tab complete · ⏎ run · C-r history · esc")); // 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 ")); @@ -700,7 +700,7 @@ test ": opens a field in the tag after its key cell: the tag's own words first, try std.testing.expect(has(first[7].text, "theme") and has(first[7].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 tagOf(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. @@ -708,7 +708,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 tagOf(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); @@ -718,7 +718,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 tagOf(p), ": sort = Exec Edit |sort 1 command")); p.update(.{ .key = .{ .cp = Key.enter } }); var asked: ?u32 = null; while (p.nextEffect()) |effect| if (effect == .pipe) { @@ -727,7 +727,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 tagOf(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 @@ -819,9 +819,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 tagOf(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 tagOf(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); @@ -843,7 +843,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 tagOf(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); @@ -885,7 +885,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 tagOf(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); diff --git a/core/Core.zig b/core/Core.zig index 2c04cc64..e43f9e83 100644 --- a/core/Core.zig +++ b/core/Core.zig @@ -2010,7 +2010,10 @@ pub fn sync(p: *Pardes) void { var wrap_fba = std.heap.FixedBufferAllocator.init(&wrap_room); const wa = wrap_fba.allocator(); const prefix: ?[]const u8 = tagline.prefixIn(p, wa, pane) catch null; - const lead = if (prefix) |made| made.len else pane.tag_lead; + // The tag's cursor and selections are offsets in its text at rest: + // a head shown over its own text moves none of them (UX D1). + const at_rest = if (pardes.Trail.outOfRest(p, pane)) tagline.restPrefix(p, wa, pane) catch null else prefix; + const lead = if (at_rest) |made| made.len else pane.tag_lead; if (lead != pane.tag_lead) { const t = &pane.tag; const old: i32 = @intCast(pane.tag_lead); diff --git a/core/Pick.zig b/core/Pick.zig index 3bab0970..f4e26527 100644 --- a/core/Pick.zig +++ b/core/Pick.zig @@ -566,7 +566,6 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?TagState.Head { const s = &p.view().tag_state; var text: std.ArrayList(u8) = .empty; var spans: std.ArrayList(TagState.Span) = .empty; - try text.append(arena, ' '); var cells: [4][2]u32 = undefined; var ncells: usize = 0; // SPC's cell, then its keys': `␣ f`. @@ -1528,7 +1527,9 @@ test "a picker from a held pane unrolls in a reader made for it: its rows in the defer frame.deinit(); const a = frame.allocator(); const tag = try tagOf(p, a, reader); - try std.testing.expect(std.mem.indexOf(u8, tag, " ␣ f Find pick 1/1\n") != null); + // Out of rest no path (UX D1): not the previewed file's, not Keep; + // the head starts the tag's text. + try std.testing.expect(std.mem.startsWith(u8, tag, "␣ f Find pick 1/1\n")); try std.testing.expect(std.mem.indexOf(u8, tag, "│ Walk Look Split Newcol Grep Edit Copy Keep Drop | Grep Recent Panes Symbols All Jumplist") != null); // The body previews the row's file, after a frame of its own. p.update(.tick); diff --git a/core/Prompt.zig b/core/Prompt.zig index 64e030e0..10886606 100644 --- a/core/Prompt.zig +++ b/core/Prompt.zig @@ -809,8 +809,9 @@ pub fn execWord(p: *Pardes, id: usize) void { /// The span of pane `pane`'s tag its search word takes while its places no /// longer light it (the first Esc cleared them): drawn dimmed (draw.zig). pub fn unlit(p: *const Pardes, pane: *Pane) ?[2]usize { + if (Trail.outOfRest(p, pane)) return null; const t = &pane.trail; - const whole = Trail.folded(p, pane); + const whole = Trail.shown_steps; for (t.steps[0..t.cur], 0..) |*step, i| if (step.* == .search) { if (lights(pane, &step.search) or t.cur - i > whole) return null; return t.spanOf(i, whole); @@ -1056,14 +1057,13 @@ fn strike(p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect, line: i32, lo_: } } -/// The head of the prompt's tag: ` s self▌ = Exec Edit x/self/ 4 +/// The head of the prompt's tag: `s self▌ = Exec Edit x/self/ 4 /// selections in 6 lines ⏎ select · M-⏎ as a list · C-r history · esc`. pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !TagState.Head { const s = &p.view().tag_state; const pr = &s.prompt; var text: std.ArrayList(u8) = .empty; var spans: std.ArrayList(TagState.Span) = .empty; - try text.append(arena, ' '); try styled(arena, &text, &spans, info.get(pr.op).cell, .key); try text.append(arena, ' '); const caret: u32 = @intCast(text.items.len + s.field.caret); @@ -1269,9 +1269,9 @@ test "s asks in the tag's head: its key cell, the field, the plain word and the try std.testing.expectEqual(TagState.Kind.prompt, p.view().tag_state.kind); // No chip on the notice band: the prompt is the tag's. try std.testing.expectEqual(Pane.Prompt.none, pane.prompt); - try std.testing.expect(std.mem.endsWith(u8, try tagOf(p), " s ⏎ select · M-⏎ as a list · C-r history · esc")); + try std.testing.expect(std.mem.endsWith(u8, try tagOf(p), "s ⏎ select · M-⏎ as a list · C-r history · esc")); typeKeys(p, "self"); - try std.testing.expect(has(try tagOf(p), " s self = Exec Edit x/self/ 2 selections in 3 lines ⏎ select")); + try std.testing.expect(has(try tagOf(p), "s self = Exec Edit x/self/ 2 selections in 3 lines ⏎ select")); try std.testing.expectEqual(@as(u16, 1), pane.body.nsel); try std.testing.expect(selecting(p, pane).?.dim == false); // No match: 0, and the selection it began with. @@ -1310,10 +1310,10 @@ test "Enter keeps what s found, the pattern in / and in the history Up brings ba typeKeys(p, "K"); p.update(.{ .key = .{ .cp = Key.up } }); try std.testing.expectEqualStrings("self..", p.view().tag_state.field.text()); - try std.testing.expect(has(try tagOf(p), " K self.. = Exec Edit g/self../ keeps 2 of 2")); + try std.testing.expect(has(try tagOf(p), "K self.. = Exec Edit g/self../ keeps 2 of 2")); p.update(.{ .key = .{ .cp = Key.down } }); typeKeys(p, "b"); - try std.testing.expect(has(try tagOf(p), " K b = Exec Edit g/b/ keeps 1 of 2 ⏎ keep")); + try std.testing.expect(has(try tagOf(p), "K b = Exec Edit g/b/ keeps 1 of 2 ⏎ keep")); // Ctrl-r: the history under the tag, a row a line. p.update(.{ .key = .{ .cp = 'r', .ctrl = true } }); try std.testing.expectEqual(@as(u16, 1), Band.takes(p, p.view().active)); @@ -1325,7 +1325,7 @@ test "Enter keeps what s found, the pattern in / and in the history Up brings ba typeKeys(p, "|"); try std.testing.expectEqual(Pane.Prompt.none, pane.prompt); p.update(.{ .key = .{ .cp = 't', .text = "tr a-z A-Z" } }); - try std.testing.expect(has(try tagOf(p), " | tr a-z A-Z = Exec Edit |tr a-z A-Z ⋯ ⏎ replace")); + try std.testing.expect(has(try tagOf(p), "| tr a-z A-Z = Exec Edit |tr a-z A-Z ⋯ ⏎ replace")); p.update(.{ .key = .{ .cp = Key.enter } }); try std.testing.expectEqualStrings("tr a-z A-Z", p.registers.value('|', 0).?); var asked: ?u32 = null; @@ -1362,7 +1362,7 @@ test "/ searches the body as it is typed: the current place selected, the gutter pane.body.cur_row = 2; pane.body.cur_col = 6; typeKeys(p, "/dirty"); - try std.testing.expect(has(try tagOf(p), " / dirty = Look /dirty/ 3/7 · 5 lines ⏎ land · M-⏎ as a list")); + try std.testing.expect(has(try tagOf(p), "/ dirty = Look /dirty/ 3/7 · 5 lines ⏎ land · M-⏎ as a list")); try std.testing.expectEqual(@as(?usize, 2), pane.places.current); try std.testing.expectEqualStrings("▪", try gutterAt(p, frame.allocator(), 0)); try std.testing.expectEqualStrings(" ", try gutterAt(p, frame.allocator(), 1)); @@ -1409,7 +1409,7 @@ test "? searches back from the caret; no match is 0; a pattern that is no regex pane.body.cur_col = 6; const was = pane.body.primaryRange(pane.file.?.content, 0); typeKeys(p, "?dirty"); - try std.testing.expect(has(try tagOf(p), " ? dirty = Look ?dirty? 2/7 · 5 lines ⏎ land")); + try std.testing.expect(has(try tagOf(p), "? dirty = Look ?dirty? 2/7 · 5 lines ⏎ land")); typeKeys(p, "x"); try std.testing.expect(has(try tagOf(p), "= Look ?dirtyx? 0 ⏎ land")); try std.testing.expectEqualDeep(was, pane.body.primaryRange(pane.file.?.content, 0)); @@ -1497,7 +1497,7 @@ test "a pipe prompt runs a known filter live, a run a selection: the outputs gho p.update(.{ .key = .{ .cp = Key.enter } }); typeKeys(p, "|"); p.update(.{ .key = .{ .cp = 't', .text = "tr a-z A-Z" } }); - try std.testing.expect(has(try tagOf(p), " | tr a-z A-Z = Exec Edit |tr a-z A-Z ⋯ ⏎ replace")); + try std.testing.expect(has(try tagOf(p), "| tr a-z A-Z = Exec Edit |tr a-z A-Z ⋯ ⏎ replace")); const first = lastPipe(p) orelse return error.MissingLiveRun; const asked = p.pipe.pipeRequest(first).?; try std.testing.expectEqual(@as(usize, 2), asked.inputs.len); diff --git a/core/TagState.zig b/core/TagState.zig index 3bd79176..938a45d1 100644 --- a/core/TagState.zig +++ b/core/TagState.zig @@ -497,9 +497,10 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?Head { switch (s.kind) { .rest => {}, // `Help`, its scope's keys, the field, its count: - // ` Help ␣ l hov 2/17`. + // `Help ␣ l hov 2/17` (out of rest the head starts the tag's + // text, after the owner's and the newest step's words: UX D1). .help => { - try b.put(" Help "); + try b.put("Help "); if (s.scope_root) |r| try b.keyCells(r, s.scope[0..s.scope_n]); var h = b.done(); h.caret = @intCast(b.text.items.len + s.field.caret); @@ -512,7 +513,7 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?Head { // `Keys`, then the keys replayed: `Keys g ▸ d Def`; struck, // `runs nothing`. .describe => { - try b.put(" Keys "); + try b.put("Keys "); if (s.missed) { var buf: [64]u8 = undefined; const keys = if (s.scope_root) |r| bindings.chord(r, s.scope[0..s.scope_n], &buf) else bindings.keyName(s.scope[0]); @@ -540,9 +541,9 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?Head { .pick => return @import("Pick.zig").head(p, arena, pane), .prompt => return try Prompt.head(p, arena, pane), // `Rename`, the name under the caret struck, the new one typed: - // ` Rename best → top▌ ⏎ rename · esc` (SPEC §3.5). + // `Rename best → top▌ ⏎ rename · esc` (SPEC §3.5). .rename => { - try b.put(" Rename "); + try b.put("Rename "); try b.styled(Ask.renamedWord(pane) orelse "", .strike); try b.put(" → "); var h = b.done(); @@ -555,7 +556,6 @@ pub fn head(p: *Pardes, arena: std.mem.Allocator, pane: *Pane) !?Head { }, } const cur = current(p, v) orelse return null; - try b.put(" "); try b.keyCells(cur.root, cur.path); if (!shown(p, v)) { try b.put("…"); @@ -628,7 +628,7 @@ test "SPC writes its key cell at once and its level 250 ms on; g changes nothing const rest = try a.dupe(u8, try testTag(p, a)); // SPC: its cell at once, the own words gone under the head. p.update(.{ .key = .{ .cp = ' ' } }); - try std.testing.expect(std.mem.endsWith(u8, try testTag(p, a), " ␣ …")); + try std.testing.expect(std.mem.eql(u8, try testTag(p, a), "␣ …")); // Its time is the next advance's; the level waits 250 ms from it, and // the loop wakes for it then. try std.testing.expectEqual(asked, p.view().tag_state.due_ns); @@ -638,15 +638,15 @@ test "SPC writes its key cell at once and its level 250 ms on; g changes nothing const woken = p.nextWake().?; try std.testing.expect(woken >= due and woken < due + pardes.frame_ns); p.clock.now_ns = due - 1; - try std.testing.expect(std.mem.endsWith(u8, try testTag(p, a), " ␣ …")); + try std.testing.expect(std.mem.eql(u8, try testTag(p, a), "␣ …")); p.clock.now_ns = due; const level = try testTag(p, a); - try std.testing.expect(std.mem.indexOf(u8, level, " ␣ ▸ b buffer…") != null); + try std.testing.expect(std.mem.indexOf(u8, level, "␣ ▸ b buffer…") != null); try std.testing.expect(std.mem.indexOf(u8, level, "l lsp…") != null); try std.testing.expect(std.mem.endsWith(u8, level, "↓ unroll · ? help")); // Down a level: its keys, its children. p.update(.{ .key = .{ .cp = 'l' } }); - try std.testing.expect(std.mem.indexOf(u8, try testTag(p, a), " ␣ l ▸ a CodeAction b Callstack") != null); + try std.testing.expect(std.mem.startsWith(u8, try testTag(p, a), "␣ l ▸ a CodeAction b Callstack")); // Esc: rest, the tag as it was. p.update(.{ .key = .{ .cp = Key.escape } }); try std.testing.expectEqualStrings(rest, try testTag(p, a)); @@ -662,7 +662,7 @@ test "SPC writes its key cell at once and its level 250 ms on; g changes nothing p.clock.now_ns = g_due - 1; try std.testing.expectEqualStrings(rest, try testTag(p, a)); p.clock.now_ns = g_due; - try std.testing.expect(std.mem.indexOf(u8, try testTag(p, a), " g ▸ ") != null); + try std.testing.expect(std.mem.indexOf(u8, try testTag(p, a), "g ▸ ") != null); try std.testing.expect(std.mem.indexOf(u8, try testTag(p, a), "d Def") != null); p.update(.{ .key = .{ .cp = Key.escape } }); try std.testing.expectEqualStrings(rest, try testTag(p, a)); @@ -750,7 +750,7 @@ test "SPC ? is Help over every root's leaves: typed in its head, filtered by the var buf: [row_max]u8 = undefined; try std.testing.expectEqualStrings("SPC t w · Wrap · view", helpLeaf(p, s.hits[0], &buf).row); const tag = try testTag(p, a); - try std.testing.expect(std.mem.indexOf(u8, tag, " Help wrap ") != null); + try std.testing.expect(std.mem.indexOf(u8, tag, "Help wrap ") != null); // Its box says it is typed in; the band holds its rows and a doc. _ = try p.render(a); const r = p.view().rects[p.view().active]; @@ -804,10 +804,10 @@ test "SPC h k is describe-key: g d replays `g ▸ d Def` with its level and doc for (" hk") |c| p.update(.{ .key = .{ .cp = c } }); const s = &p.view().tag_state; try std.testing.expectEqual(Kind.describe, s.kind); - try std.testing.expect(std.mem.indexOf(u8, try testTag(p, a), " Keys …") != null); + try std.testing.expect(std.mem.startsWith(u8, try testTag(p, a), "Keys …")); for ("gd") |c| p.update(.{ .key = .{ .cp = c } }); try std.testing.expect(s.found); - try std.testing.expect(std.mem.indexOf(u8, try testTag(p, a), " Keys g ▸ d Def") != null); + try std.testing.expect(std.mem.startsWith(u8, try testTag(p, a), "Keys g ▸ d Def")); // The level unrolled under the tag, the leaf on the cursor, its doc. try std.testing.expect(pane.band_rows >= 4); _ = try p.render(a); @@ -818,9 +818,9 @@ test "SPC h k is describe-key: g d replays `g ▸ d Def` with its level and doc try std.testing.expect(std.mem.indexOf(u8, text.items, "keys g d") != null); // Another sequence from the next key: ] f, then SPC l r. for ("]f") |c| p.update(.{ .key = .{ .cp = c } }); - try std.testing.expect(std.mem.indexOf(u8, try testTag(p, a), " Keys ] ▸ f function") != null); + try std.testing.expect(std.mem.startsWith(u8, try testTag(p, a), "Keys ] ▸ f function")); for (" lr") |c| p.update(.{ .key = .{ .cp = c } }); - try std.testing.expect(std.mem.indexOf(u8, try testTag(p, a), " Keys ␣ l ▸ r Rename") != null); + try std.testing.expect(std.mem.startsWith(u8, try testTag(p, a), "Keys ␣ l ▸ r Rename")); // Unbound: struck, runs nothing. for ("gq") |c| p.update(.{ .key = .{ .cp = c } }); try std.testing.expect(s.missed); @@ -848,14 +848,14 @@ test "C-w's level is window mode's, shown at once and kept while its keys move t const a = frame.allocator(); p.update(.{ .key = .{ .cp = 'w', .ctrl = true } }); try std.testing.expect(p.view().window_pick != null); - try std.testing.expect(std.mem.endsWith(u8, try testTag(p, a), " C-w …")); + try std.testing.expect(std.mem.endsWith(u8, try testTag(p, a), "C-w …")); p.advance(p.clock.now_ns); p.clock.now_ns = p.view().tag_state.due_ns; - try std.testing.expect(std.mem.indexOf(u8, try testTag(p, a), " C-w ▸ c Collapse d Del h Left j Down k Up l Right") != null); + try std.testing.expect(std.mem.indexOf(u8, try testTag(p, a), "C-w ▸ c Collapse d Del h Left j Down k Up l Right") != null); // Sticky: a move keeps the level. p.update(.{ .key = .{ .cp = 'k' } }); try std.testing.expect(p.view().window_pick != null); - try std.testing.expect(std.mem.indexOf(u8, try testTag(p, a), " C-w ▸ ") != null); + try std.testing.expect(std.mem.indexOf(u8, try testTag(p, a), "C-w ▸ ") != null); p.update(.{ .key = .{ .cp = Key.enter } }); try std.testing.expect(p.view().window_pick == null); try std.testing.expect(p.view().tag_state.root == null); diff --git a/core/Trail.zig b/core/Trail.zig index 9223d1d3..58a72256 100644 --- a/core/Trail.zig +++ b/core/Trail.zig @@ -15,6 +15,7 @@ const config = @import("config.zig"); const layout = @import("layout.zig"); const panes = @import("panes.zig"); const look = @import("look.zig"); +const modal = @import("modal.zig"); const Pardes = pardes.Pardes; const Pane = panes.Pane; const Spot = look.Spot; @@ -27,7 +28,8 @@ pub const max_steps = 16; /// The bytes of a step's path or word. A jump to a longer path is no step: /// it opens a pane as `Jumps new-pane` does (look.zig open). pub const max_text = 256; -/// The newest back steps written whole; older ones fold to `·` (§6.3). +/// The newest back steps written whole at rest; older ones fold to `·` +/// (§6.3). Out of rest the owner's and the newest alone (`.newest`). pub const shown_steps = 3; /// `cur` held to the steps there are (walk.zig `.place`). @@ -311,7 +313,9 @@ pub fn walkBy(p: *Pardes, id: usize, delta: i32) bool { // ---- the words ---- -pub const Part = enum { back, forward }; +/// `newest`: out of rest (UX D1), the owner's word and the newest back +/// step's alone, each with the separator after it. +pub const Part = enum { back, forward, newest }; /// Step `i`'s word: `‹@p3`, `rank.zig:14`, a list's, search's or recipe's /// own text; `·` when it is folded. @@ -331,19 +335,43 @@ const sep = " › "; /// The steps a part writes. fn range(t: *const Trail, part: Part) [2]usize { return switch (part) { - .back => .{ 0, t.cur }, + .back, .newest => .{ 0, t.cur }, .forward => .{ @min(t.n, t.cur + 1), t.n }, }; } +/// Whether step `i` is in what `part` writes: out of rest the owner and +/// the newest back step only. +fn writes(t: *const Trail, part: Part, i: usize) bool { + return part != .newest or t.steps[i] == .owner or i + 1 == t.cur; +} + +/// The cells of the newest step's word out of rest: a longer one is cut +/// in its middle (UX D1: `Find pick…3/6`). +const newest_cells = 24; + +/// Step `i`'s word as `part` writes it: out of rest a word longer than +/// `newest_cells` keeps its first and last cells around a `…`. +fn shownWord(t: *const Trail, part: Part, i: usize, whole: usize, buf: *[max_text + 16]u8, cut: *[max_text + 16]u8) []const u8 { + const word = wordOf(t, i, whole, buf); + if (part != .newest or word.len <= newest_cells) return word; + const tab = 8; // a step's word holds no tab + if (panes.File.displayWidth(tab, word) <= newest_cells) return word; + const head = panes.File.byteAtDisplay(tab, word, newest_cells / 2); + var tail = word.len; + while (tail > head and panes.File.displayWidth(tab, word[tail..]) < newest_cells / 2 - 1) tail = modal.prevGrapheme(word, tail); + return std.fmt.bufPrint(cut, "{s}…{s}", .{ word[0..head], word[tail..] }) catch word; +} + /// The back steps' words, each with the separator after it (before the /// path), or the forward steps', each with one before it (after the path): /// the newest `whole` back steps whole, older ones `·` (`folded`). pub fn write(t: *const Trail, part: Part, whole: usize, w: *std.Io.Writer) std.Io.Writer.Error!void { var buf: [max_text + 16]u8 = undefined; + var cut: [max_text + 16]u8 = undefined; const r = range(t, part); - for (r[0]..r[1]) |i| switch (part) { - .back => try w.print("{s}" ++ sep, .{wordOf(t, i, whole, &buf)}), + for (r[0]..r[1]) |i| if (writes(t, part, i)) switch (part) { + .back, .newest => try w.print("{s}" ++ sep, .{shownWord(t, part, i, whole, &buf, &cut)}), .forward => try w.print(sep ++ "{s}", .{wordOf(t, i, whole, &buf)}), }; } @@ -351,18 +379,21 @@ pub fn write(t: *const Trail, part: Part, whole: usize, w: *std.Io.Writer) std.I /// The bytes `write` writes for `part`. pub fn bytes(t: *const Trail, part: Part, whole: usize) usize { var buf: [max_text + 16]u8 = undefined; + var cut: [max_text + 16]u8 = undefined; var n: usize = 0; const r = range(t, part); - for (r[0]..r[1]) |i| n += wordOf(t, i, whole, &buf).len + sep.len; + for (r[0]..r[1]) |i| if (writes(t, part, i)) { + n += shownWord(t, part, i, whole, &buf, &cut).len + sep.len; + }; return n; } -/// The back steps pane `pane`'s tag writes whole: `shown_steps` at rest, -/// the newest alone while its tag is out of rest (SPEC §3.4.3), so a -/// state's head and the band's spines keep their room. -pub fn folded(p: *const Pardes, pane: *const Pane) usize { - const host = TagState.hostOf(p) orelse return shown_steps; - return if (p.panes[host] == pane) 1 else shown_steps; +/// Whether pane `pane`'s tag is out of rest in the live view (UX D1: its +/// path, its forward steps and its own words hidden, the owner and the +/// newest step before the head). Asking is rest. +pub fn outOfRest(p: *const Pardes, pane: *const Pane) bool { + const host = TagState.hostOf(p) orelse return false; + return p.panes[host] == pane; } /// Where back step `i`'s word is in what `write` writes for the back @@ -378,14 +409,16 @@ pub fn spanOf(t: *const Trail, i: usize, whole: usize) [2]usize { /// for it, null on a separator or past them. pub fn stepAt(t: *const Trail, part: Part, whole: usize, off: usize) ?u8 { var buf: [max_text + 16]u8 = undefined; + var cut: [max_text + 16]u8 = undefined; var x: usize = 0; const r = range(t, part); for (r[0]..r[1]) |i| { + if (!writes(t, part, i)) continue; if (part == .forward) x += sep.len; - const n = wordOf(t, i, whole, &buf).len; + const n = shownWord(t, part, i, whole, &buf, &cut).len; if (off >= x and off < x + n) return @intCast(i); x += n; - if (part == .back) x += sep.len; + if (part != .forward) x += sep.len; } return null; } @@ -841,12 +874,38 @@ test "Enter on a word of the walk, the keyboard in the tag, goes back to its ste var at: [64]u8 = undefined; const rest = try std.fmt.bufPrint(&buf, "‹@p{d} › rank.zig:10 › rank.zig:20 › {s}/rank.zig Keep", .{ owner, f.dir }); try std.testing.expect(std.mem.startsWith(u8, try tagOf(p, pane), rest)); - // SPC: out of rest, the older steps are `·`, the owner and the newest - // whole; back at rest, as they were. + // SPC, its level shown: out of rest the tag is the owner, the newest + // step and the head (UX D1): no older step, no path, no Keep, none of + // its own words; back at rest, as they were. + const whole_rest = try p.gpa.dupe(u8, try tagOf(p, pane)); + defer p.gpa.free(whole_rest); p.update(.{ .key = .{ .cp = ' ' } }); + p.advance(p.clock.now_ns); + p.clock.now_ns = p.view().tag_state.due_ns; + p.sync(); var folded_buf: [4096 + 128]u8 = undefined; - try std.testing.expect(std.mem.startsWith(u8, try tagOf(p, pane), try std.fmt.bufPrint(&folded_buf, "‹@p{d} › · › rank.zig:20 › {s}/rank.zig", .{ owner, f.dir }))); + const out = try tagOf(p, pane); + try std.testing.expect(std.mem.startsWith(u8, out, try std.fmt.bufPrint(&folded_buf, "‹@p{d} › rank.zig:20 › ␣ ▸ ", .{owner}))); + try std.testing.expect(std.mem.indexOf(u8, out, "rank.zig:10") == null and std.mem.indexOf(u8, out, f.dir) == null and std.mem.indexOf(u8, out, "Keep") == null); + // Look on the newest step's word is that step. + try std.testing.expectEqual(@as(?u8, pane.trail.cur - 1), pardes.tagline.trailAt(p, pane, std.mem.indexOf(u8, out, "rank.zig:20").? + 3)); + try std.testing.expectEqual(@as(?u8, 0), pardes.tagline.trailAt(p, pane, 1)); + p.update(.{ .key = .{ .cp = pardes.Key.escape } }); + try std.testing.expectEqualStrings(whole_rest, try tagOf(p, pane)); + // Back a step (a forward step after the path at rest): out of rest the + // forward step is hidden as the path is. + pardes.Trail.lookStep(p, r, pane.trail.cur - 1); + p.sync(); + try std.testing.expect(std.mem.indexOf(u8, try tagOf(p, pane), "rank.zig:30") != null); + p.update(.{ .key = .{ .cp = ' ' } }); + p.advance(p.clock.now_ns); + p.clock.now_ns = p.view().tag_state.due_ns; + p.sync(); + try std.testing.expect(std.mem.startsWith(u8, try tagOf(p, pane), try std.fmt.bufPrint(&folded_buf, "‹@p{d} › rank.zig:10 › ␣ ▸ ", .{owner}))); + try std.testing.expect(std.mem.indexOf(u8, try tagOf(p, pane), "rank.zig:30") == null); p.update(.{ .key = .{ .cp = pardes.Key.escape } }); + pardes.Trail.lookStep(p, r, pane.trail.cur + 1); + p.sync(); try std.testing.expect(std.mem.startsWith(u8, try tagOf(p, pane), rest)); // The keyboard in the tag, its cursor on `rank.zig:10`: Enter goes back // to that step, the keyboard in the body again. diff --git a/core/bindings.zig b/core/bindings.zig index 2df51945..43145b15 100644 --- a/core/bindings.zig +++ b/core/bindings.zig @@ -568,12 +568,12 @@ test "\" shows the registers rolled, each its first line; Down unrolls them besi p.sync(); // Its key cell at once, the level 300 ms on. p.update(.{ .key = .{ .cp = '"' } }); - try std.testing.expect(std.mem.endsWith(u8, try tagline.tagText(p, a, pane), " \" …")); + try std.testing.expect(std.mem.endsWith(u8, try tagline.tagText(p, a, pane), "\" …")); p.advance(p.clock.now_ns); try std.testing.expectEqual(p.clock.now_ns + 300 * std.time.ns_per_ms, p.view().tag_state.due_ns); p.clock.now_ns = p.view().tag_state.due_ns; const rolled = try tagline.tagText(p, a, pane); - try std.testing.expect(std.mem.indexOf(u8, rolled, " \" ▸ \" self.dirty = true; a const best = rank(q, nam… / —") != null); + try std.testing.expect(std.mem.indexOf(u8, rolled, "\" ▸ \" self.dirty = true; a const best = rank(q, nam… / —") != null); try std.testing.expect(std.mem.indexOf(u8, rolled, "% /test.txt . o # 1 _ —") != null); // Down unrolls: a row each, the cursor on the default, its value // beside them. @@ -596,13 +596,13 @@ test "\" shows the registers rolled, each its first line; Down unrolls them besi try std.testing.expect(std.mem.indexOf(u8, band.items, "return best;") != null); // Enter chooses it: its verbs, rolled. p.update(.{ .key = .{ .cp = Key.enter } }); - try std.testing.expect(std.mem.indexOf(u8, try tagline.tagText(p, a, pane), " \" a ▸ p after P before R replace y into") != null); + try std.testing.expect(std.mem.indexOf(u8, try tagline.tagText(p, a, pane), "\" a ▸ p after P before R replace y into") != null); try std.testing.expect(!p.view().tag_state.unrolled); // Backspace: the registers again; a register's own key goes down too. p.update(.{ .key = .{ .cp = Key.backspace } }); - try std.testing.expect(std.mem.indexOf(u8, try tagline.tagText(p, a, pane), " \" ▸ \" self.dirty") != null); + try std.testing.expect(std.mem.indexOf(u8, try tagline.tagText(p, a, pane), "\" ▸ \" self.dirty") != null); p.update(.{ .key = .{ .cp = 'a' } }); - try std.testing.expect(std.mem.indexOf(u8, try tagline.tagText(p, a, pane), " \" a ▸ p after") != null); + try std.testing.expect(std.mem.indexOf(u8, try tagline.tagText(p, a, pane), "\" a ▸ p after") != null); // p pastes it after the selection, and the tag is at rest. p.update(.{ .key = .{ .cp = 'p' } }); try std.testing.expect(std.mem.indexOf(u8, pane.file.?.content, "const best = rank(q, name) orelse continue;") != null); diff --git a/core/draw.zig b/core/draw.zig index 68778667..179b7cfc 100644 --- a/core/draw.zig +++ b/core/draw.zig @@ -690,6 +690,8 @@ fn joinCells(s: *Surface, x: u16, y: u16, cells: []const Cell, from: usize, w: u } fn tagTintRange(p: *const Pardes, pane: *const Pane, tag: []const u8, prefix_len: usize) ?struct { lo: usize, hi: usize } { + // Out of rest no name is shown (UX D1). + if (pardes.Trail.outOfRest(p, pane)) return null; if (pane.isTerminal()) { // `tag` is the first row; a prefix longer than it ran to a second. var words = std.mem.tokenizeAny(u8, tag[@min(prefix_len, tag.len)..], " \t\r\n"); @@ -700,7 +702,7 @@ fn tagTintRange(p: *const Pardes, pane: *const Pane, tag: []const u8, prefix_len } return null; } - var start: usize = tagline.nameAt(p, pane); + var start: usize = tagline.nameAt(pane); const name = if (pane.file) |file| if (pane.prompt == .name) pane.input.own orelse file.path else file.path else if (pane.addon) |k| blk: { @@ -1013,7 +1015,7 @@ fn paintPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, else if (pane.prompt == .name) caret: { // A drafted name is the prefix: its caret is on row 0 of the tag, // the rows it wrapped onto included. - const at = modal.positionAt(shown.text, shown.fromReal(tagline.nameAt(p, pane) + @as(usize, @intCast(@max(0, pane.input.cur_col))))); + const at = modal.positionAt(shown.text, shown.fromReal(tagline.nameAt(pane) + @as(usize, @intCast(@max(0, pane.input.cur_col))))); if (at.row < top or at.row >= top + rows) break :caret null; break :caret .{ .row = at.row - top, .at = @min(lines[at.row - top].len, at.col) }; } else if (pane.focus == .tag and pane.prompt == .none and head == null) caret: { @@ -1031,8 +1033,9 @@ fn paintPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, _ = s.print(tx, tag_y + @as(u16, @intCast(row)), tw, line[start..], tag_style); } // The pane's progress at its first row's right end, where the row has - // room for it (SPEC §10.2). - if (top == 0 and rows > 0) for (p.messages.live[0..p.messages.live_len]) |*said| { + // room for it (SPEC §10.2); out of rest the head's right block is + // there (UX D1). + if (top == 0 and rows > 0 and !pardes.Trail.outOfRest(p, pane)) for (p.messages.live[0..p.messages.live_len]) |*said| { if (said.kind != .progress or said.pane != pane.serial) continue; var buf: [Messages.LoggedMessage.cap + 8]u8 = undefined; const text = std.fmt.bufPrint(&buf, "{s} {s}", .{ Messages.Kind.progress.glyph(), said.words() }) catch break; diff --git a/core/layout.zig b/core/layout.zig index c0d21d6d..0a773cab 100644 --- a/core/layout.zig +++ b/core/layout.zig @@ -594,7 +594,7 @@ pub fn wantedTagRows(p: *Pardes, id: usize) u16 { var wrap_room: [32 * 1024]u8 = undefined; var wrap_fba = std.heap.FixedBufferAllocator.init(&wrap_room); const wa = wrap_fba.allocator(); - const prefix = tagline.prefixIn(p, wa, pane) catch return pane.tag_rows; + const prefix = tagline.restPrefix(p, wa, pane) catch return pane.tag_rows; const whole = std.mem.concat(wa, u8, &.{ prefix, tagline.curTail(pane) }) catch return pane.tag_rows; const shown = tagline.wrapTag(p.settings.tab, wa, whole, tagline.tagWidth(p, id)) catch return pane.tag_rows; return @intCast(@max(BOX_H, @min(shown.rows(), MAX_TAG_ROWS))); diff --git a/core/lsp/Ask.zig b/core/lsp/Ask.zig index bb1eccb6..6e6f87e5 100644 --- a/core/lsp/Ask.zig +++ b/core/lsp/Ask.zig @@ -761,7 +761,7 @@ test "SPC l r types the new name in the pane's own tag, the body showing each pl var frame = std.heap.ArenaAllocator.init(std.testing.allocator); defer frame.deinit(); const a = frame.allocator(); - try std.testing.expect(std.mem.indexOf(u8, try pardes.tagline.tagText(p, a, pane), " Rename best → bester") != null); + try std.testing.expect(std.mem.indexOf(u8, try pardes.tagline.tagText(p, a, pane), "Rename best → bester") != null); p.sync(); const sf = try p.render(a); const body = sf.region(.body, id).?.rect; diff --git a/core/tagline.zig b/core/tagline.zig index e95d68de..3256f824 100644 --- a/core/tagline.zig +++ b/core/tagline.zig @@ -124,6 +124,22 @@ fn shownDir(arena: std.mem.Allocator, pane: *Pane) ![]const u8 { /// PDF's page, a terminal's directory -- without the space that parts it /// from the tag's own text. It is never stored, and never edited. pub fn pathPrefix(p: *const Pardes, arena: std.mem.Allocator, pane: *Pane) ![]const u8 { + // Out of rest (UX D1) the owner's word and the newest step's, each with + // its ` › `, before the head: the path, the forward steps and Keep + // hidden until rest (a picker's preview is no name of the pane's). + if (pardes.Trail.outOfRest(p, pane)) { + if (pane.trail.n == 0) return ""; + const room = try arena.alloc(u8, pane.trail.bytes(.newest, 1)); + var w: std.Io.Writer = .fixed(room); + pane.trail.write(.newest, 1, &w) catch return error.OutOfMemory; + return w.buffered(); + } + return restPath(p, arena, pane); +} + +/// The computed start of a pane's tag at rest, whatever its state: what +/// the tag's own text follows. +fn restPath(p: *const Pardes, arena: std.mem.Allocator, pane: *Pane) ![]const u8 { // What is drawn: with no graphics, glyph art whatever `Petscii` says. if (pane.addon != null) return pardes.Kind.prefix(p, arena, pane); // A command pane: its directory, the line it runs, and how that went. @@ -163,7 +179,7 @@ pub fn pathPrefix(p: *const Pardes, arena: std.mem.Allocator, pane: *Pane) ![]co // Its walk's back steps before the name, its forward steps after // it (Trail.zig), in the room `bytes` measures them. const keep_word = if (keep) " Keep" else ""; - const whole = pardes.Trail.folded(p, pane); + const whole = pardes.Trail.shown_steps; const room = try arena.alloc(u8, pane.trail.bytes(.back, whole) + name.len + pane.trail.bytes(.forward, whole) + keep_word.len); var w: std.Io.Writer = .fixed(room); pane.trail.write(.back, whole, &w) catch return error.OutOfMemory; @@ -184,15 +200,15 @@ pub fn pathPrefix(p: *const Pardes, arena: std.mem.Allocator, pane: *Pane) ![]co } /// Where a file's name starts in its tag: after its walk's back steps. -pub fn nameAt(p: *const Pardes, pane: *const Pane) usize { - return if (pane.file != null and pane.trail.n > 0) pane.trail.bytes(.back, pardes.Trail.folded(p, pane)) else 0; +pub fn nameAt(pane: *const Pane) usize { + return if (pane.file != null and pane.trail.n > 0) pane.trail.bytes(.back, pardes.Trail.shown_steps) else 0; } /// The bytes of a file's tag its walk's forward steps take, after its name. pub fn forwardSpan(p: *const Pardes, pane: *const Pane) [2]usize { const f = pane.file orelse return .{ 0, 0 }; - if (pane.trail.n == 0) return .{ 0, 0 }; - const whole = pardes.Trail.folded(p, pane); + if (pane.trail.n == 0 or pardes.Trail.outOfRest(p, pane)) return .{ 0, 0 }; + const whole = pardes.Trail.shown_steps; const name = if (pane.prompt == .name) pane.input.own orelse f.path else f.path; const lo = pane.trail.bytes(.back, whole) + name.len; return .{ lo, lo + pane.trail.bytes(.forward, whole) }; @@ -202,9 +218,10 @@ pub fn forwardSpan(p: *const Pardes, pane: *const Pane) [2]usize { /// text, if one is there. pub fn trailAt(p: *const Pardes, pane: *const Pane, at: usize) ?u8 { if (pane.trail.n == 0 or pane.file == null) return null; - const whole = pardes.Trail.folded(p, pane); + if (pardes.Trail.outOfRest(p, pane)) return pane.trail.stepAt(.newest, 1, at); + const whole = pardes.Trail.shown_steps; const ahead = forwardSpan(p, pane); - if (at < nameAt(p, pane)) return pane.trail.stepAt(.back, whole, at); + if (at < nameAt(pane)) return pane.trail.stepAt(.back, whole, at); if (at >= ahead[0] and at < ahead[1]) return pane.trail.stepAt(.forward, whole, at - ahead[0]); return null; } @@ -227,7 +244,17 @@ pub fn tagPrefix(p: *Pardes, pane: *Pane) ![]u8 { /// The prefix as the tag shows it, built in `arena`. pub fn prefixIn(p: *const Pardes, arena: std.mem.Allocator, pane: *Pane) ![]u8 { - const prefix = try pathPrefix(p, arena, pane); + // Out of rest the head follows: its words end in their own space. + if (pardes.Trail.outOfRest(p, pane)) return arena.dupe(u8, try pathPrefix(p, arena, pane)); + return restPrefix(p, arena, pane); +} + +/// The prefix as the tag has it at rest, whatever its state: what its own +/// text follows, so what its cursor and selections are offsets after +/// (Core.sync's `tag_lead`), and the rows it takes at rest +/// (layout.wantedTagRows). +pub fn restPrefix(p: *const Pardes, arena: std.mem.Allocator, pane: *Pane) ![]u8 { + const prefix = try restPath(p, arena, pane); // The space between the prefix and the tag's own text is the text's // (every default starts with one), but the prefix is computed, so it // cannot trust the text to keep it: with it deleted, Look and Exec @@ -411,13 +438,13 @@ pub fn tagOffsetAt(p: *Pardes, pane: *Pane, row: usize, col: usize) ?modal.Curso /// words; null off it. pub fn onName(p: *const Pardes, pane: *Pane, row: usize, col: usize) ?usize { const tab = p.settings.tab; - if (row + pane.tag_top != 0) return null; + if (row + pane.tag_top != 0 or pardes.Trail.outOfRest(p, pane)) return null; const f = pane.file orelse return null; if (!panes.Output.fileTraits(f.output).saves) return null; const name = if (pane.prompt == .name) pane.input.own orelse f.path else f.path; var room: [pardes.Trail.max_steps * (pardes.Trail.max_text + 32)]u8 = undefined; var w: std.Io.Writer = .fixed(&room); - pane.trail.write(.back, pardes.Trail.folded(p, pane), &w) catch return null; + pane.trail.write(.back, pardes.Trail.shown_steps, &w) catch return null; const lead = panes.File.displayWidth(tab, w.buffered()); if (col < lead or col >= lead + panes.File.displayWidth(tab, name)) return null; return col - lead; @@ -432,8 +459,8 @@ pub fn typedIntoName(p: *Pardes, pane: *Pane, key: pardes.Key) bool { if (!panes.Output.fileTraits(f.output).saves or pane.tag.cur_row != 0) return false; // The name starts after its walk's words. const col: usize = @intCast(@max(0, pane.tag.cur_col)); - if (col < nameAt(p, pane)) return false; - const at = col - nameAt(p, pane); + if (col < nameAt(pane)) return false; + const at = col - nameAt(pane); const back = key.cp == pardes.Key.backspace or pardes.hit(key, config.insert_backspace_alias); const forward = key.cp == pardes.Key.delete or pardes.hit(key, config.insert_delete_alias); const typed = key.text.len > 0 and !key.ctrl and !key.alt; diff --git a/test/behaviour/keys.zig b/test/behaviour/keys.zig index 6a62ccd7..65c52ee7 100644 --- a/test/behaviour/keys.zig +++ b/test/behaviour/keys.zig @@ -25,11 +25,12 @@ test "keys: a prompt's entry and cancellation leave the tag, the body and its cu try s.write(dot, "6 6"); try s.keys(case.keys); // The answer is typed into the tag's head (walk UI), shown in place - // of the tag's own text, which it never touches. + // of the tag's own text, which it never touches; out of rest the + // path is hidden too (UX D1): the head starts the tag. try s.keys("zq"); _ = try s.where(case.shown); const head = try s.read(tag); - try std.testing.expect(std.mem.startsWith(u8, head, "/test.txt") and std.mem.startsWith(u8, head["/test.txt".len..], case.shown)); + try std.testing.expect(std.mem.startsWith(u8, head, case.shown[1..])); try s.keys("\x1b"); try std.testing.expectError(error.NotOnScreen, s.where(case.shown)); try std.testing.expect(std.mem.endsWith(u8, try s.read(s.at("/pane/{d}/ctl", .{n})), " mode:normal ")); diff --git a/test/snapshots/find.golden b/test/snapshots/find.golden index b461c1d8..8cef240d 100644 --- a/test/snapshots/find.golden +++ b/test/snapshots/find.golden @@ -1,8 +1,7 @@ -== snap group grid=120x41 cursor=7,4 +== snap group grid=120x41 cursor=7,3 | 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 Keep ␣ f ▸ c Config f Find g Grep h History n New r Recent s Save ↓ unroll -| · ? help +| ␣ f ▸ c Config f Find g Grep h History n New r Recent s Save ↓ unroll · ? help | 1 Find zqm | | @@ -39,35 +38,31 @@ | | | +| | /tmp/pardes-snap/find/cwd/here.txt:1 -== snap armed grid=120x41 cursor=51,2 -|2: ^ /tmp/pardes-snap/find/cwd/here.txt Keep ␣ f Find 1/5 -|3: │ │ Walk Look Split Newcol Grep Edit Copy Keep Drop | Grep Recent Panes Symbol -|4: s All Jumplist -|5: ▶ here.txt -|6: other.txt -|7: sub/ZQMARK-beta.txt -|8: sub/nest/zqmark-gamma.txt -|9: zqmark-alpha.txt -|10: 1 Find zqm +== snap armed grid=120x41 cursor=11,2 +|2: ^ ␣ f Find 1/5 +|3: │ │ Walk Look Split Newcol Grep Edit Copy Keep Drop | Grep Recent Panes Symbols All Jumplist +|4: │ │ ▶ here.txt +|5: │ │ other.txt +|6: │ │ sub/ZQMARK-beta.txt +|7: │ │ sub/nest/zqmark-gamma.txt +|8: │ │ zqmark-alpha.txt +|9: 1 Find zqm |40: ✓ /tmp/pardes-snap/find/cwd/here.txt Find 1 message · SPC h m -== snap typing grid=120x41 cursor=57,2 -|2: ^ /tmp/pardes-snap/find/cwd/zqmark-alpha.txt ␣ f Find zqm 1/3 -|3: │ │ Walk Look Split Newcol Grep Edit Copy Keep Drop | Grep Recent Panes Sym -|4: bols All Jumplist -|5: ▶ zqmark-alpha.txt -|6: sub/ZQMARK-beta.txt -|7: sub/nest/zqmark-gamma.txt -|8: -|9: -|10: 1 alpha body -== snap next grid=120x41 cursor=60,2 -|2: ^ /tmp/pardes-snap/find/cwd/sub/ZQMARK-beta.txt ␣ f Find zqm 2/3 -|3: │ │ Walk Look Split Newcol Grep Edit Copy Keep Drop | Grep Recent Panes -|4: Symbols All Jumplist -|5: zqmark-alpha.txt -|6: ▶ sub/ZQMARK-beta.txt -|10: 1 beta body +== snap typing grid=120x41 cursor=14,2 +|2: ^ ␣ f Find zqm 1/3 +|4: │ │ ▶ zqmark-alpha.txt +|5: │ │ sub/ZQMARK-beta.txt +|6: │ │ sub/nest/zqmark-gamma.txt +|7: │ │ +|8: │ │ +|9: 1 alpha body +== snap next grid=120x41 cursor=14,2 +|2: ^ ␣ f Find zqm 2/3 +|4: │ │ zqmark-alpha.txt +|5: │ │ ▶ sub/ZQMARK-beta.txt +|9: 1 beta body == snap promoted grid=120x41 cursor=7,3 |2: here.txt:1 › Find zqm 2/3 › /tmp/pardes-snap/find/cwd/sub/ZQMARK-beta.txt Keep Save Term Collapse Follow Del |3: 1 beta body @@ -75,24 +70,25 @@ |5: |6: |7: -|10: -== snap nomatch grid=120x41 cursor=85,2 -|2: ^ · › Find zqm 2/3 › /tmp/pardes-snap/find/cwd/sub/ZQMARK-beta.txt Keep ␣ f Find zzqq 0/0 -|3: │ │ Walk Look Split Newcol Grep Edit Copy Keep D -|4: rop | Grep Recent Panes Symbols All Jumplist -|5: nothing matches -|7: 1 beta body +|8: +|9: +== snap nomatch grid=120x41 cursor=30,2 +|2: ^ Find zqm 2/3 › ␣ f Find zzqq 0/0 +|3: │ │ Walk Look Split Newcol Grep Edit Copy Keep Drop | Grep Recent Panes Symbols All Jumplist +|4: │ │ nothing matches +|5: │ │ +|6: 1 beta body |40: ✓ /tmp/pardes-snap/find/cwd/sub/ZQMARK-beta.txt Find 2 messages · SPC h m == snap cancel grid=120x41 cursor=7,3 |2: here.txt:1 › Find zqm 2/3 › /tmp/pardes-snap/find/cwd/sub/ZQMARK-beta.txt Keep Save Term Collapse Follow Del |3: 1 beta body |4: |5: -|7: -== snap topbar grid=120x41 cursor=84,2 -|2: ^ · › Find zqm 2/3 › /tmp/pardes-snap/find/cwd/sub/ZQMARK-beta.txt Keep ␣ f Find bod 0/0 -|3: │ │ Walk Look Split Newcol Grep Edit Copy Keep D -|4: rop | Grep Recent Panes Symbols All Jumplist -|5: nothing matches -|7: 1 beta body +|6: +== snap topbar grid=120x41 cursor=29,2 +|2: ^ Find zqm 2/3 › ␣ f Find bod 0/0 +|3: │ │ Walk Look Split Newcol Grep Edit Copy Keep Drop | Grep Recent Panes Symbols All Jumplist +|4: │ │ nothing matches +|5: │ │ +|6: 1 beta body |40: ✓ /tmp/pardes-snap/find/cwd/sub/ZQMARK-beta.txt Find ×2 2 messages · SPC h m diff --git a/test/snapshots/fsearch.golden b/test/snapshots/fsearch.golden index 7d0c1efe..450ea298 100644 --- a/test/snapshots/fsearch.golden +++ b/test/snapshots/fsearch.golden @@ -30,27 +30,23 @@ | 12 l12 | | · @p1 a copy of the terminal's text: Tab or B2 runs it; what the program draws next replaces it (Ctrl-b types to the program) 1 message · SPC h m -== snap slash grid=180x31 cursor=141,16 -|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › /tmp/pardes-snap/fsearch/cwd/g.txt Keep / ⏎ land · M-⏎ as a list · C-r history -|17: ls · esc +== snap slash grid=180x31 cursor=101,16 +|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › / ⏎ land · M-⏎ as a list · C-r history · esc +== snap typing grid=180x31 cursor=105,16 +|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › / MARK = Look /MARK/ 1/3 · 3 lines ⏎ land · M-⏎ as a list · C-r history · es +|17: ls c |18: g.txt 1 l1 -|19: 2 MARK a +|19: 2▸MARK a |20: 3 l3 |21: 4 l4 |22: 5 l5 -|23: 6 MARK b +|23: 6▪MARK b |24: 7 l7 |25: 8 l8 |26: 9 l9 -|27: 10 MARK c +|27: 10▪MARK c |28: 11 l11 |29: 12 l12 -== snap typing grid=180x31 cursor=145,16 -|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › /tmp/pardes-snap/fsearch/cwd/g.txt Keep / MARK = Look /MARK/ 1/3 · 3 lines ⏎ -|17: ls land · M-⏎ as a list · C-r history · esc -|19: 2▸MARK a -|23: 6▪MARK b -|27: 10▪MARK c == style typing grid=180x31 |0: 0-1 d,#1d2824, 2-179 #b2c3b8,#1d2824, |1: 0-1 d,#887455, 2-89 #b2c3b8,#1d2824, 90-91 #b2c3b8,#887455, 92-179 #becfc4,#314738, @@ -68,8 +64,8 @@ |13: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269,f 91-179 d,#0d1410,f |14: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269,f 91-179 d,#0d1410,f |15: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269,f 91-179 d,#0d1410,f -|16: 0-1 d,#496656,f 2-30 #b2c3b8,#1d2824,f 31-40 #d3b0d9,#1d2824,f 41-89 #b2c3b8,#1d2824,f 90-91 #000000,#add38a, 92-127 #becfc4,#2c2819, 128-133 #dfbce5,#2c2819, 134-138 #becfc4,#2c2819, 139-139 #add38a,#2c2819,b 140-140 #add38a,#2c2819, 141-144 #becfc4,#2c2819, 145-152 #becfc4,#2c2819,f 153-178 #becfc4,#2c2819, 179-179 #becfc4,#2c2819,f -|17: 0-0 d,#608269,f 1-1 d,#0d1410,f 2-89 #e5eee5,#0d1410,f 90-91 #e5eee5,#2c2819, 92-92 #e5eee5,#2c2819,f 93-132 #becfc4,#2c2819,f 133-179 #becfc4,#2c2819, +|16: 0-1 d,#496656,f 2-30 #b2c3b8,#1d2824,f 31-40 #d3b0d9,#1d2824,f 41-89 #b2c3b8,#1d2824,f 90-91 #000000,#add38a, 92-98 #becfc4,#2c2819, 99-99 #add38a,#2c2819,b 100-100 #add38a,#2c2819, 101-104 #becfc4,#2c2819, 105-112 #becfc4,#2c2819,f 113-138 #becfc4,#2c2819, 139-179 #becfc4,#2c2819,f +|17: 0-0 d,#608269,f 1-1 d,#0d1410,f 2-89 #e5eee5,#0d1410,f 90-91 #e5eee5,#2c2819, 92-92 #becfc4,#2c2819,f 93-179 #becfc4,#2c2819, |18: 0-0 d,#608269,f 1-1 d,#0d1410,f 2-89 #e5eee5,#0d1410,f 90-90 #e5eee5,#e5eee5, 91-94 #e5eee5,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, |19: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269, 91-91 d,#0d1410, 92-94 d,#0d1410,b 95-95 #616f64,#0d1410,b 96-96 #add38a,#0d1410,b 97-100 #f5f7ee,#3c614a, 101-101 #f5f7ee,#0d1410, 102-179 #e5eee5,#0d1410, |20: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269, 91-94 d,#0d1410, 95-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, @@ -83,10 +79,10 @@ |28: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269, 91-93 d,#0d1410, 94-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, |29: 0-0 d,#608269,f 1-89 d,#0d1410,f 90-90 d,#608269, 91-93 d,#0d1410, 94-96 #59675c,#0d1410, 97-179 #e5eee5,#0d1410, |30: 0-1 d,#1d2824, 2-179 #67756e,#1d2824, -== snap list grid=180x31 cursor=150,16 -|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › /tmp/pardes-snap/fsearch/cwd/g.txt Keep ␣ l /MARK/ 1/3 -|17: ls │ │ Walk Look Split Newcol Grep Edit Copy -|18: g.txt Keep Drop | Find Grep Recent Panes Symbols All Jumplist +== snap list grid=180x31 cursor=110,16 +|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › ␣ l /MARK/ 1/3 +|17: ls │ │ Walk Look Split Newcol Grep Edit Copy Keep Drop | Find Grep Recent Panes Symb +|18: g.txt ols All Jumplist |19: ▶ /tmp/pardes-snap/fsearch/cwd/g.txt:2:1: MARK a |20: /tmp/pardes-snap/fsearch/cwd/g.txt:6:1: MARK b |21: /tmp/pardes-snap/fsearch/cwd/g.txt:10:1: MARK c @@ -98,8 +94,8 @@ |27: 6 MARK b |28: 7 l7 |29: 8 l8 -== snap ctrln grid=180x31 cursor=150,16 -|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › /tmp/pardes-snap/fsearch/cwd/g.txt Keep ␣ l /MARK/ 2/3 +== snap ctrln grid=180x31 cursor=110,16 +|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › ␣ l /MARK/ 2/3 |19: /tmp/pardes-snap/fsearch/cwd/g.txt:2:1: MARK a |20: ▶ /tmp/pardes-snap/fsearch/cwd/g.txt:6:1: MARK b |22: 2 MARK a @@ -142,6 +138,6 @@ == snap N grid=180x31 cursor=97,23 |16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ‹@p1 › g.txt:1 › /MARK/ 2/3 › /tmp/pardes-snap/fsearch/cwd/g.txt Keep Save Term Collapse == snap cancel grid=180x31 cursor=97,23 -== snap nomatch grid=180x31 cursor=162,16 -|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › · › /MARK/ 2/3 › /tmp/pardes-snap/fsearch/cwd/g.txt Keep / zzqq = Look /zzqq/ -|17: ls 0 ⏎ land · M-⏎ as a list · C-r history · esc +== snap nomatch grid=180x31 cursor=118,16 +|16: /tmp/pardes-snap/fsearch/cwd Term+bash Save Mode Filter Collapse Del ^ ‹@p1 › /MARK/ 2/3 › / zzqq = Look /zzqq/ 0 ⏎ land · M-⏎ as a list · C-r history · e +|17: ls sc diff --git a/test/snapshots/leader.golden b/test/snapshots/leader.golden index c6a5460e..b93030e8 100644 --- a/test/snapshots/leader.golden +++ b/test/snapshots/leader.golden @@ -1,9 +1,9 @@ == 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 Keep ␣ ▸ b buffer… c column… f file… h help… j jump… l l -| sp… n new… s session… t view… ' Resume / All ? Help d Del e Message p ClipPaste P ClipPa -| steBefore q Exit R ClipReplace w Window y ClipYank Y ClipYankMain ↓ unroll · ? help +| ␣ ▸ b buffer… c column… f file… h help… j jump… l lsp… n new… s session… t view… ' Resume +| / All ? Help d Del e Message p ClipPaste P ClipPasteBefore q Exit R ClipReplace w Window +| y ClipYank Y ClipYankMain ↓ unroll · ? help | 1 Help Help h Help t Help c Help l | | @@ -40,19 +40,17 @@ | | | /tmp/pardes-snap/leader/cwd/cmds.txt:1 -== snap spc-h grid=100x41 cursor=7,4 -|2: /tmp/pardes-snap/leader/cwd/cmds.txt Keep ␣ h ▸ b Build c Changelog k Keys m Messages t Tutor -|3: ↓ unroll · ? help -|4: 1 Help Help h Help t Help c Help l +== snap spc-h grid=100x41 cursor=7,3 +|2: ␣ h ▸ b Build c Changelog k Keys m Messages t Tutor ↓ unroll · ? help +|3: 1 Help Help h Help t Help c Help l +|4: |5: == snap abandoned grid=100x41 cursor=7,3 |2: /tmp/pardes-snap/leader/cwd/cmds.txt Keep 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 Keep ␣ ▸ b buffer… c column… f file… h help… j jump… l l -|3: sp… n new… s session… t view… ' Resume / All ? Help d Del e Message p ClipPaste P ClipPa -|4: steBefore q Exit R ClipReplace w Window y ClipYank Y ClipYankMain x ↓ unroll · ? help +|2: ␣ ▸ b buffer… c column… f file… h help… j jump… l lsp… n new… s session… t view… ' Resume +|3: / All ? Help d Del e Message p ClipPaste P ClipPasteBefore q Exit R ClipReplace w Window +|4: 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 Keep Save Term Collapse Follow Del diff --git a/test/snapshots/lsp.golden b/test/snapshots/lsp.golden index 6a53098e..445c5d4b 100644 --- a/test/snapshots/lsp.golden +++ b/test/snapshots/lsp.golden @@ -56,30 +56,29 @@ |13: 9 } |14: ~ |40: ✓ /tmp/pardes-snap/lsp/cwd/a.zig Hover 1 message · SPC h m -== snap symbols grid=120x41 cursor=60,2 -|2: ^ a.zig:8 › /tmp/pardes-snap/lsp/cwd/a.zig Keep ␣ l Symbols 1/3 -|3: │ │ Walk Look Split Newcol Grep Edit Copy Keep Drop | Find Grep Recent P -|4: anes Symbols All Jumplist -|5: ▶ a.zig:1:7-9 std -|6: a.zig:3:4-9 helper -|7: a.zig:7:8-11 main -|8: 1 const std = @import("std"); -|9: 2 -|10: 3 fn helper(x: u32) u32 { -|11: fn helper(x: u32) u32 -|12: (fn (u32) u32) -|13: 4 return x + 1; -|14: 5 } -|15: 6 -|16: 7 pub fn main() void { -|17: 8 _ = helper(41); -|18: 9 } -|19: ~ +== snap symbols grid=120x41 cursor=24,2 +|2: ^ a.zig:8 › ␣ l Symbols 1/3 +|3: │ │ Walk Look Split Newcol Grep Edit Copy Keep Drop | Find Grep Recent Panes Symbols All Jumplist +|4: │ │ ▶ a.zig:1:7-9 std +|5: │ │ a.zig:3:4-9 helper +|6: │ │ a.zig:7:8-11 main +|7: 1 const std = @import("std"); +|8: 2 +|9: 3 fn helper(x: u32) u32 { +|10: fn helper(x: u32) u32 +|11: (fn (u32) u32) +|12: 4 return x + 1; +|13: 5 } +|14: 6 +|15: 7 pub fn main() void { +|16: 8 _ = helper(41); +|17: 9 } +|18: ~ |40: ✓ /tmp/pardes-snap/lsp/cwd/a.zig Symbols 2 messages · SPC h m -== snap step grid=120x41 cursor=63,2 -|2: ^ a.zig:8 › /tmp/pardes-snap/lsp/cwd/a.zig Keep ␣ l Symbols jn 0/0 -|5: nothing matches -|6: -|7: -== snap nothing grid=120x41 cursor=65,2 -|2: ^ a.zig:8 › /tmp/pardes-snap/lsp/cwd/a.zig Keep ␣ l Symbols jngd 0/0 +== snap step grid=120x41 cursor=27,2 +|2: ^ a.zig:8 › ␣ l Symbols jn 0/0 +|4: │ │ nothing matches +|5: │ │ +|6: │ │ +== snap nothing grid=120x41 cursor=29,2 +|2: ^ a.zig:8 › ␣ l Symbols jngd 0/0 diff --git a/test/snapshots/msg.golden b/test/snapshots/msg.golden index a53cb8d3..7e622261 100644 --- a/test/snapshots/msg.golden +++ b/test/snapshots/msg.golden @@ -47,12 +47,12 @@ |8: |9: |16: · reloaded /tmp/pardes-snap/msg/cwd/a.txt 5 messages · SPC h m -== snap prompt grid=70x17 cursor=43,2 -|2: ^ /tmp/pardes-snap/msg/cwd/a.txt Keep s EXT = Exec Edit x/EXT/ 0 -|3: ⏎ select · M-⏎ as a list · C-r history · esc +== snap prompt grid=70x17 cursor=7,2 +|2: ^ s EXT = Exec Edit x/EXT/ 0 ⏎ select · M-⏎ as a list · C-r histo +|3: ry · esc |4: 1 EXTERNAL |5: ~ -== snap prompt-wins grid=70x17 cursor=43,2 +== snap prompt-wins grid=70x17 cursor=7,2 |4: 1 AGAIN |16: · reloaded /tmp/pardes-snap/msg/cwd/a.txt ×2 5 messages · SPC h m == snap esc grid=70x17 cursor=7,4 diff --git a/test/snapshots/pipe.golden b/test/snapshots/pipe.golden index faa16bc3..a8d2aa31 100644 --- a/test/snapshots/pipe.golden +++ b/test/snapshots/pipe.golden @@ -1,7 +1,7 @@ -== snap prompt grid=180x13 cursor=54,2 +== snap prompt grid=180x13 cursor=14,2 | Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config History Debug Exit | New Term Find Grep Joincol Delcol -|^ /tmp/pardes-snap/pipe/cwd/pipe.txt Keep | tr a-z A-Z = Exec Edit |tr a-z A-Z 1 line → 1 · exit 0 ⏎ replace · C-r history · esc +|^ | tr a-z A-Z = Exec Edit |tr a-z A-Z 1 line → 1 · exit 0 ⏎ replace · C-r history · esc | 1 alpha beta | ALPHA BETA | 2 gamma delta diff --git a/test/snapshots/selregex.golden b/test/snapshots/selregex.golden index 0cf3abed..df68f85a 100644 --- a/test/snapshots/selregex.golden +++ b/test/snapshots/selregex.golden @@ -1,7 +1,7 @@ -== snap prompt-armed grid=160x25 cursor=45,2 +== snap prompt-armed grid=160x25 cursor=4,2 | Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config History Debug Exit | New Term Find Grep Joincol Delcol -|^ /tmp/pardes-snap/selregex/cwd/m.zig Keep s ⏎ select · M-⏎ as a list · C-r history · esc +|^ s ⏎ select · M-⏎ as a list · C-r history · esc | 1┃const one = 1; | 2┃const two = 2; | 3┃const three = 3; @@ -24,13 +24,13 @@ | | | /tmp/pardes-snap/selregex/cwd/m.zig:3 -== snap preview grid=160x25 cursor=50,2 -|2: ^ /tmp/pardes-snap/selregex/cwd/m.zig Keep s const = Exec Edit x/const/ 3 selections in 3 lines ⏎ select · M-⏎ as a list · C-r history · esc +== snap preview grid=160x25 cursor=9,2 +|2: ^ s const = Exec Edit x/const/ 3 selections in 3 lines ⏎ select · M-⏎ as a list · C-r history · esc |24: /tmp/pardes-snap/selregex/cwd/m.zig:1 == style preview grid=160x25 |0: 0-1 d,#1d2824, 2-159 #b2c3b8,#1d2824, |1: 0-1 d,#887455, 2-159 #becfc4,#314738, -|2: 0-1 #000000,#add38a, 2-31 #becfc4,#2c2819, 32-37 #dfbce5,#2c2819, 38-42 #becfc4,#2c2819, 43-43 #add38a,#2c2819,b 44-44 #add38a,#2c2819, 45-49 #becfc4,#2c2819, 50-57 #becfc4,#2c2819,f 58-100 #becfc4,#2c2819, 101-144 #becfc4,#2c2819,f 145-159 #becfc4,#2c2819, +|2: 0-1 #000000,#add38a, 2-2 #add38a,#2c2819,b 3-3 #add38a,#2c2819, 4-8 #becfc4,#2c2819, 9-16 #becfc4,#2c2819,f 17-59 #becfc4,#2c2819, 60-103 #becfc4,#2c2819,f 104-159 #becfc4,#2c2819, |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-5 #616f64,#0d1410,b 6-6 #add38a,#0d1410,b 7-10 #f5f7ee,#3c614a, 11-11 #3c614a,#f5f7ee, 12-12 #3c614a,#0d1410, 13-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-159 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-4 d,#0d1410, 5-5 #59675c,#0d1410, 6-6 #add38a,#0d1410, 7-10 #f5f7ee,#243a2d, 11-11 #3c614a,#f5f7ee, 12-12 #3c614a,#0d1410, 13-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-159 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-4 d,#0d1410, 5-5 #59675c,#0d1410, 6-6 #add38a,#0d1410, 7-10 #f5f7ee,#243a2d, 11-11 #3c614a,#f5f7ee, 12-12 #3c614a,#0d1410, 13-20 #e5eee5,#0d1410, 21-21 #f8c082,#0d1410, 22-159 #e5eee5,#0d1410, @@ -63,13 +63,13 @@ |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-11 #f5f7ee,#3c614a, 12-12 #f5f7ee,#0d1410, 13-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-159 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-10 #f5f7ee,#243a2d, 11-11 #3c614a,#f5f7ee, 12-12 #3c614a,#0d1410, 13-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-159 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-10 #f5f7ee,#243a2d, 11-11 #3c614a,#f5f7ee, 12-12 #3c614a,#0d1410, 13-20 #e5eee5,#0d1410, 21-21 #f8c082,#0d1410, 22-159 #e5eee5,#0d1410, -== snap narrowed grid=160x25 cursor=62,2 -|2: ^ Edit x/const/ › /tmp/pardes-snap/selregex/cwd/m.zig Keep s t = Exec Edit x/t/ 3 selections in 3 lines ⏎ select · M-⏎ as a list · C-r history · esc +== snap narrowed grid=160x25 cursor=21,2 +|2: ^ Edit x/const/ › s t = Exec Edit x/t/ 3 selections in 3 lines ⏎ select · M-⏎ as a list · C-r history · esc |3: 1┃const one = 1; |4: 2┃const two = 2; |5: 3┃const three = 3; == style narrowed grid=160x25 -|2: 0-1 #000000,#add38a, 2-47 #becfc4,#2c2819, 48-53 #dfbce5,#2c2819, 54-58 #becfc4,#2c2819, 59-59 #add38a,#2c2819,b 60-60 #add38a,#2c2819, 61-61 #becfc4,#2c2819, 62-69 #becfc4,#2c2819,f 70-108 #becfc4,#2c2819, 109-152 #becfc4,#2c2819,f 153-159 #becfc4,#2c2819, +|2: 0-1 #000000,#add38a, 2-17 #becfc4,#2c2819, 18-18 #add38a,#2c2819,b 19-19 #add38a,#2c2819, 20-20 #becfc4,#2c2819, 21-28 #becfc4,#2c2819,f 29-67 #becfc4,#2c2819, 68-111 #becfc4,#2c2819,f 112-159 #becfc4,#2c2819, |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-5 #616f64,#0d1410,b 6-6 #add38a,#0d1410,b 7-10 #e5eee5,#0d1410, 11-11 #3c614a,#f5f7ee, 12-12 #3c614a,#0d1410, 13-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-159 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-4 d,#0d1410, 5-5 #59675c,#0d1410, 6-6 #add38a,#0d1410, 7-10 #e5eee5,#0d1410, 11-11 #3c614a,#f5f7ee, 12-12 #3c614a,#0d1410, 13-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-159 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-4 d,#0d1410, 5-5 #59675c,#0d1410, 6-6 #add38a,#0d1410, 7-10 #e5eee5,#0d1410, 11-11 #3c614a,#f5f7ee, 12-12 #3c614a,#0d1410, 13-20 #e5eee5,#0d1410, 21-21 #f8c082,#0d1410, 22-159 #e5eee5,#0d1410, diff --git a/test/snapshots/ttyhelp.golden b/test/snapshots/ttyhelp.golden index 200aab50..3eb84714 100644 --- a/test/snapshots/ttyhelp.golden +++ b/test/snapshots/ttyhelp.golden @@ -48,8 +48,8 @@ |19: shell (`Help Diff`); a setting or an addon's word the same. `Help <keys>`: the builtins unde↩ |20: r SPC and those keys (`Help l`, as `SPC l ?` shows them). Each fills the one +Help: a second |30: ✓ @p1 Help 1 message · SPC h m -== snap leaderworks grid=100x31 cursor=47,5 -|5: ^ /tmp/pardes-snap/ttyhelp/cwd/+Help Help tutor 1/136 +== snap leaderworks grid=100x31 cursor=12,5 +|5: ^ Help tutor 1/136 |6: ▶ SPC h t · Tutor · help│ t Tutor |7: │ Open the tutor, a document to work through. |8: │ keys SPC h t |
