From 046979b877f02a91cf52cc86b84c5619cb9363d3 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 6 Oct 2026 19:06:32 -0300 Subject: Def and Refs in a language-served file's tag, a diff viewer's tinted word edits, context rows that hold still under a scroll, and the pardes skill Def and Refs (gd, gr, Ctrl-click; chorded 2-1 at the selection) for a file a language server speaks for; hunks.zig stacks a unified diff as a diff viewer does, its changed words on a tinted ground as delta's do; the tree-sitter context rows stay put while the body glides under a scroll; .agents/skills gains the pardes skill beside pardes-9p. --- docs/typ/builtins-gui.json | 6 +++++- docs/typ/builtins-tty.json | 6 +++++- docs/typ/guide.typ | 15 +++++++++++++-- docs/typ/reference.typ | 27 +++++++++++++++------------ docs/typ/setup.typ | 2 +- 5 files changed, 39 insertions(+), 17 deletions(-) (limited to 'docs/typ') diff --git a/docs/typ/builtins-gui.json b/docs/typ/builtins-gui.json index b42f9c72..83a410dc 100644 --- a/docs/typ/builtins-gui.json +++ b/docs/typ/builtins-gui.json @@ -20,12 +20,15 @@ {"name": "Crt", "leader": "SPC t r", "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off, 0-3", "doc": "The bundled CRT post pass over the window, on or off."}, {"name": "CursorBlink", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "The cursor blinks, solid while typing, on or off."}, {"name": "Debug", "leader": "SPC t d", "also": ["topbar"], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "A small box of frame statistics at the top right, on or off."}, + {"name": "Def", "leader": null, "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Go to the definition of the symbol under the cursor; with an argument (a 2-1 chord's selection), of that symbol, where it is nearest."}, {"name": "Del", "leader": "SPC d", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Close the pane."}, {"name": "DelAbove", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Close the pane, giving its rows to the pane above it."}, {"name": "DelBelow", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Close the pane, giving its rows to the pane below it."}, {"name": "Delcol", "leader": "SPC c d", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Close this column and its panes, refusing once over unsaved text."}, {"name": "Detach", "leader": "SPC s D", "also": [], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "Detach this pardes from its terminal, leaving the session running."}, {"name": "Diagnostics", "leader": "SPC l d", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "List the file's diagnostics from the language server."}, + {"name": "Diff", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Stack a diff's hunks as a diff viewer shows them, each under its place and the declarations around it, in a +Diff; on a +Diff, show the diff itself as text."}, + {"name": "DiffLook", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "hunks, text", "doc": "A .diff or .patch looked at: hunks, a +Diff stacking its hunks, or text, the file itself; Diff goes from one to the other."}, {"name": "DirLook", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "pane, terminal", "doc": "A directory looked at: pane, a pane listing it as acme's directory window, or terminal, ls in a terminal there."}, {"name": "Down", "leader": "SPC w j", "also": ["C-w j", "C-w down"], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Move the keyboard to the pane below, off a tag onto the pane under it."}, {"name": "Dump", "leader": "SPC s d", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "Write the session's panes and layout to a dump file, for Restore."}, @@ -36,7 +39,7 @@ {"name": "EffectCode", "leader": null, "also": [], "arg": true, "scope": "root", "setting": false, "choices": null, "doc": "Open the source of a panel transition or post shader, by name."}, {"name": "Exec", "leader": null, "also": ["tab", "middle-click"], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Execute its argument as a middle click on it would, a builtin or a shell command."}, {"name": "Exit", "leader": "SPC q", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "Quit the editor, refusing once while a pane holds unsaved text: an Exit with nothing edited since discards it."}, - {"name": "Filter", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Recolour a terminal's program colours to the theme, or show them as sent, flipping between them."}, + {"name": "Filter", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Recolour a terminal's or a +Pager's program colours to the theme, or show them as sent, flipping between them."}, {"name": "Find", "leader": "SPC f f", "also": ["topbar"], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "List the files below this pane's directory whose names hold its argument, in a +Search."}, {"name": "FocusTint", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "The focused pane's and column's tags are tinted, on or off."}, {"name": "Font", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "The body font, by name or path, and its size."}, @@ -103,6 +106,7 @@ {"name": "Putall", "leader": null, "also": [], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "acme's Putall: every pane holding unsaved edits to a file is saved, each as its own Save; one that is refused (changed on disk since, a write that fails) says so and the rest are saved all the same."}, {"name": "Recent", "leader": "SPC f r", "also": [], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "List the files opened lately, closed ones too, each a place to open again."}, {"name": "Redo", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Redo the last undone edit."}, + {"name": "Refs", "leader": null, "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "List the references to the symbol under the cursor; with an argument (a 2-1 chord's selection), to that symbol, where it is nearest."}, {"name": "Rename", "leader": "SPC l r", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Rename the symbol under the cursor everywhere, to its argument."}, {"name": "Repl", "leader": null, "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Binds this terminal as a language's REPL, so an exec on that language's files is typed into it instead of run."}, {"name": "Restore", "leader": "SPC s r", "also": [], "arg": true, "scope": "root", "setting": false, "choices": null, "doc": "Replace every pane with those of a dump file, the last one Dump wrote when bare."}, diff --git a/docs/typ/builtins-tty.json b/docs/typ/builtins-tty.json index 53bcf033..35e12875 100644 --- a/docs/typ/builtins-tty.json +++ b/docs/typ/builtins-tty.json @@ -17,12 +17,15 @@ {"name": "Colors", "leader": "SPC t c", "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "Syntax colours in text panes, on or off."}, {"name": "Config", "leader": "SPC f c", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "Open the startup file, `init`, in a pane: its pane when it is open, else the file, else a pane of that name for Save to make it and its directory."}, {"name": "Debug", "leader": "SPC t d", "also": ["topbar"], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "A small box of frame statistics at the top right, on or off."}, + {"name": "Def", "leader": null, "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Go to the definition of the symbol under the cursor; with an argument (a 2-1 chord's selection), of that symbol, where it is nearest."}, {"name": "Del", "leader": "SPC d", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Close the pane."}, {"name": "DelAbove", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Close the pane, giving its rows to the pane above it."}, {"name": "DelBelow", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Close the pane, giving its rows to the pane below it."}, {"name": "Delcol", "leader": "SPC c d", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Close this column and its panes, refusing once over unsaved text."}, {"name": "Detach", "leader": "SPC s D", "also": [], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "Detach this pardes from its terminal, leaving the session running."}, {"name": "Diagnostics", "leader": "SPC l d", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "List the file's diagnostics from the language server."}, + {"name": "Diff", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Stack a diff's hunks as a diff viewer shows them, each under its place and the declarations around it, in a +Diff; on a +Diff, show the diff itself as text."}, + {"name": "DiffLook", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "hunks, text", "doc": "A .diff or .patch looked at: hunks, a +Diff stacking its hunks, or text, the file itself; Diff goes from one to the other."}, {"name": "DirLook", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "pane, terminal", "doc": "A directory looked at: pane, a pane listing it as acme's directory window, or terminal, ls in a terminal there."}, {"name": "Down", "leader": "SPC w j", "also": ["C-w j", "C-w down"], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Move the keyboard to the pane below, off a tag onto the pane under it."}, {"name": "Dump", "leader": "SPC s d", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "Write the session's panes and layout to a dump file, for Restore."}, @@ -33,7 +36,7 @@ {"name": "EffectCode", "leader": null, "also": [], "arg": true, "scope": "root", "setting": false, "choices": null, "doc": "Open the source of a panel transition or post shader, by name."}, {"name": "Exec", "leader": null, "also": ["tab", "middle-click"], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Execute its argument as a middle click on it would, a builtin or a shell command."}, {"name": "Exit", "leader": "SPC q", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "Quit the editor, refusing once while a pane holds unsaved text: an Exit with nothing edited since discards it."}, - {"name": "Filter", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Recolour a terminal's program colours to the theme, or show them as sent, flipping between them."}, + {"name": "Filter", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Recolour a terminal's or a +Pager's program colours to the theme, or show them as sent, flipping between them."}, {"name": "Find", "leader": "SPC f f", "also": ["topbar"], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "List the files below this pane's directory whose names hold its argument, in a +Search."}, {"name": "FocusTint", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "The focused pane's and column's tags are tinted, on or off."}, {"name": "Forward", "leader": "SPC j i", "also": ["C-i"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "Ctrl-i: one step forward again, up to wherever Back started."}, @@ -90,6 +93,7 @@ {"name": "Putall", "leader": null, "also": [], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "acme's Putall: every pane holding unsaved edits to a file is saved, each as its own Save; one that is refused (changed on disk since, a write that fails) says so and the rest are saved all the same."}, {"name": "Recent", "leader": "SPC f r", "also": [], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "List the files opened lately, closed ones too, each a place to open again."}, {"name": "Redo", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Redo the last undone edit."}, + {"name": "Refs", "leader": null, "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "List the references to the symbol under the cursor; with an argument (a 2-1 chord's selection), to that symbol, where it is nearest."}, {"name": "Rename", "leader": "SPC l r", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Rename the symbol under the cursor everywhere, to its argument."}, {"name": "Repl", "leader": null, "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Binds this terminal as a language's REPL, so an exec on that language's files is typed into it instead of run."}, {"name": "Restore", "leader": "SPC s r", "also": [], "arg": true, "scope": "root", "setting": false, "choices": null, "doc": "Replace every pane with those of a dump file, the last one Dump wrote when bare."}, diff --git a/docs/typ/guide.typ b/docs/typ/guide.typ index 90e72303..89323766 100644 --- a/docs/typ/guide.typ +++ b/docs/typ/guide.typ @@ -202,8 +202,8 @@ takes the rows: #key("k") above, #key("j") below. = Reviewing diffs -`git diff` run as a command, or a `.diff` or `.patch` opened, is drawn as -a diff, each hunk in its file's language. #btn("B3") on: +`git diff` run as a command, or a `.diff` or `.patch` shown as text (below), +is drawn as a diff, each hunk in its file's language. #btn("B3") on: #pairs( [`diff --git`, `---`, `+++`], [the file], @@ -211,6 +211,17 @@ a diff, each hunk in its file's language. #btn("B3") on: [a line's `+`, `-` or space], [that line in the new file], ) +A `.diff` or `.patch` looked at, and a diff paged (`git show`), opens as +a `+Diff`, stacked as delta shows one: each hunk under its `path:line` +(`n`/`N` step through them, #btn("B3") opens it) and the declarations +around it, a `+`/`-` before each line, the words a changed line changed +tinted and a line added or removed whole faintly. A mailed patch keeps its +message and diffstat above. The files are found from the diff's directory +or one above it. #word("Diff") on a `+Diff` shows the diff itself as +text (a paged one's `+Pager` is folded under it), and on the text stacks +it again; #word("DiffLook") `text` in the startup file opens the text +first. + = `pardes FILE` and `--wait` In a pane's shell: diff --git a/docs/typ/reference.typ b/docs/typ/reference.typ index ed88905a..909c1e1a 100644 --- a/docs/typ/reference.typ +++ b/docs/typ/reference.typ @@ -22,7 +22,7 @@ index a line per pane: serial kind dirty name column @ru status pid, version, panes @other-files look write a line: a #word("Look") at the pane with the keyboard; read: the serials touched @look-and-exec exec write a line: an #word("Exec") there; read: the serials touched @look-and-exec -pager write a directory: its one +Pager, made or emptied; read: its serial @pardes-stdin +pager write a directory: a new +Pager there; read: its serial @pardes-stdin log the event log; write follow to wait for more @log screen the rendered screen as JSON @on-screen listeners dial addresses @other-files @@ -252,7 +252,9 @@ A line written to #file("exec") is #word("Exec"): silently, here and in every ctl. - The language server's words ask about a file pane's text at its cursor (set it with #file("addr") and `dot=addr` first): #word("Hover") fills - `+Hover`; #word("Rename") `new` renames the symbol in the file and says how many + `+Hover`; #word("Def") and #word("Refs"), in the tag of a file a server + speaks for, are `gd` and `gr`, and given a symbol (a 2-1 chord's + selection) ask at its occurrence nearest the cursor; #word("Rename") `new` renames the symbol in the file and says how many ranges it changed (on the message row, and so in the log) without listing them, and fails when there is nothing to rename. One that reaches other files applies nothing: it opens a `+Search` preview of the edits, which @@ -457,7 +459,7 @@ may lower the contrast of text, the selection or a focus indicator. build embeds them. Resting the pointer on text for about 32 ms (`look_preview_delay_frames`, -2 frames, in `src/config.zig`; `null` turns it off) tints what #word("Look") would take, with no other effect. A terminal's +2 frames, in `src/config.zig`; `null` turns it off) tints what #word("Look") would take, with no other effect. A terminal's or a `+Pager`'s #word("Filter") keeps each foreground at least `tty_filter_min_contrast` (WCAG 1.5, `src/config.zig`) against its background. @@ -889,10 +891,10 @@ at 200, ending in `…`. Control characters become spaces. line is the session's; one not there is refused ENOENT, a relative one EINVAL, one you may not write `permission denied`, a regular file `not a directory`, ENOTDIR), one line; what follows that line, on the same open, is the text to - page, escapes and all. A read of that open answers the serial of the - directory's one `+Pager`, made or emptied for it, once the text is in. This is what - `pardes -` uses; from a directory you may not write, it pages into the - session's `+Pager`. + page, escapes and all. A read of that open answers the serial of a new + `+Pager` in the directory, once the text is in. This is what + `pardes -` uses; from a directory you may not write, it pages into a + `+Pager` of the session's. - #file("/listeners"): the session's dial addresses, a line each (#doc("building", section: "listeners")). - #file("/os/"): existing regular files take read, write and truncation to @@ -993,12 +995,13 @@ it was. = pardes - -`pardes -` reads stdin to its end and shows it in the directory's one -`+Pager` pane, made or emptied for it and left clean, opening at its top; -the next paged text refills it. The session parses the text with +`pardes -` reads stdin to its end and shows it in a new `+Pager` pane of +the directory, left clean, opening at its top, with no line numbers; a +`+Pager` already there keeps its page. The session parses the text with ghostty-vt: SGR colours become the `+Pager`'s own display, never part of -its body or any read (#word("PagerColor") `off` pages plain), and every other -escape is dropped; a carriage return keeps a progress line's last state, +its body or any read (#word("PagerColor") `off` pages plain), mapped +through the theme as a terminal's are until its #word("Filter") shows them +as sent; every other escape is dropped; a carriage return keeps a progress line's last state, and CRLF becomes LF. Empty stdin shows nothing. Inside a pardes pane it returns at once; a text the session cannot take is printed to stderr with why, and the exit is 1. From a directory whose name holds a newline or control byte, the pane is the session diff --git a/docs/typ/setup.typ b/docs/typ/setup.typ index df99a45f..f49c9075 100644 --- a/docs/typ/setup.typ +++ b/docs/typ/setup.typ @@ -59,7 +59,7 @@ fi = A pager -#cmd("ls --color=always | pardes - # into the directory's +Pager, colours kept") +#cmd("ls --color=always | pardes - # into a new +Pager there, colours kept") With #word("Pager") `pardes` (the default) a terminal's shell gets `PAGER`, `GIT_PAGER` and `SYSTEMD_PAGER` set to it (and -- cgit v1.3 From 13d5613b77c62c425c3a124a34c0c2528cc6251f Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 8 Oct 2026 12:00:28 -0300 Subject: Follow Helix search registers for n/N; keep Look navigation as named builtins --- docs/helix-keys.md | 19 ++--- docs/typ/guide.typ | 7 +- src/CHANGELOG.md | 6 ++ src/Registers.zig | 1 + src/builtins.zig | 32 +++++--- src/config.zig | 4 + src/look.zig | 14 +++- src/modal.zig | 23 +++++- src/normal.zig | 168 +++++++++++++++++++++++++++++++++++++++- src/pdf_view.zig | 2 +- src/tutor.txt | 7 +- test/hxcases/cases.jsonl | 64 +++++++++++++++ test/hxcases/goldens.jsonl | 64 +++++++++++++++ test/hxcases/golf-waivers.jsonl | 7 -- test/output.zig | 65 +++++++++------- test/snapshots/builtins.snap | 2 +- test/snapshots/find.snap | 10 +-- test/snapshots/fsearch.snap | 8 +- test/snapshots/grep.snap | 8 +- test/snapshots/jumps.snap | 10 +-- test/snapshots/lookrange.snap | 4 +- test/snapshots/lsp-client.snap | 4 +- test/snapshots/lsp.snap | 2 +- test/snapshots/lspcomplete.snap | 2 +- test/snapshots/lsprelpath.snap | 4 +- test/snapshots/psearch.snap | 6 +- test/snapshots/stepgrain.snap | 10 +-- test/snapshots/themesel.snap | 42 +++++----- test/snapshots/ttylook.snap | 12 +-- 29 files changed, 473 insertions(+), 134 deletions(-) (limited to 'docs/typ') diff --git a/docs/helix-keys.md b/docs/helix-keys.md index 6249fc15..ddbab93b 100644 --- a/docs/helix-keys.md +++ b/docs/helix-keys.md @@ -48,7 +48,7 @@ at the bottom. collapse) — the checked-in helix goldens are the ground truth, verified case-by-case by `zig build hxdiff`. Motion-created ranges live in `pane.vsel` marked IMPLICIT (`vsel.explicit = false`); `v` extend mode, - `x`/`X` and `n`/`N` (the look-ring walk, `lookWalk`) set EXPLICIT ones. + `x`/`X` and search `n`/`N` set EXPLICIT ones. `d`/`c`/`y`/`~`/… act on the active selection either way — that is the point of the model. The pardes-specific chords (normal-mode Enter look / Tab execute) @@ -134,13 +134,14 @@ language-backend queries, and the shell pipe. | `Space` (normal, body) | starts the pardes LEADER: a key path runs the same builtin words used by tags and the topbar. The main groups are `f` files, `h` docs, `c` columns, `t` toggles/effects, `a` panel animations, `s` session, `j` jumps, `l` language, and `w` directional focus; `SPC ?` lists every path and ` ?` lists one group in `+Help`. Neither `Exit` (quits the editor, acme's Exit) nor `Kill` (stops the commands pardes typed into terminals, acme's Kill) has a leader path: both are the topbar's and the root `ctl`'s. The pending path appears on the active pane's transient body/message row. Esc or an unmapped key abandons it. Paths, Help rows, and dispatch are all generated from the builtin registry at comptime; the leader applies only to a BODY in normal mode because tags and tty programs own their input | pardes-specific; helix spends Space on pickers/LSP (section C), while pardes uses acme-style executable words | | `SPC y` `SPC Y` `SPC p` `SPC P` `SPC R` | helix's clipboard menu on helix's own letters: yank the selection to the system clipboard (`ClipYank`) or the PRIMARY selection alone (`ClipYankMain`), paste the system clipboard after (`ClipPaste`) / before (`ClipPasteBefore`) the selection, replace the selection with it (`ClipReplace`) | the same as `"+y`, `"+p`, `"+P`, `"+R`: register `+` (and `*`) IS the desktop's clipboard, the only register that reaches it. `SPC y` writes `+` alone, as helix's does, not the default register too. Builtins rather than bare chords because a leader path names a builtin: they land in Help's index and are executable words like every other verb. The clipboard holds one text, so N values go out joined by newlines, as helix sends them. On a tty the write is OSC 52 out and the READ is OSC 52 back, which many terminals refuse or gate — so `SPC y` works there and `SPC p` can be a no-op | out of corpus | | a paste from the OUTER terminal | one `Event.paste`, spliced in at the cursor | the tty shell enables bracketed paste and coalesces `paste_start`..`paste_end` into a single event; before that the bytes arrived as individual key presses and normal mode RAN them, which is how a pasted `d` deleted a line. The bytes deliberately never enter the yank register — clipboard and default register are separate stores in both directions | pardes-specific | -| `/` (any pane) | pardes' own plain-substring search into a `+Search` output buffer: the pattern is typed on a line of its own on the pane's notice band, Enter fills the buffer, and its rows are ordinary look targets. Enter also GOES to the first row — the buffer is focused and then the step `n` is and the look Enter is run in it (`Pardes.lookFirstHit`), so `/foo` lands on the first hit with the matched span selected. A pattern that matched nothing opens its empty buffer and moves nothing | KEEP, do not touch; not in the corpus (helix `/` is regex search). Find and Grep answer with OTHER files and deliberately do NOT jump. The stepping half is the next row | pardes-specific | -| `n` / `N` (any pane) | MOTION, not a jump: move the SELECTION to the next / previous look-able text and open NOTHING. Enter — the look chord — on what it leaves selected is what opens it | KEEP, do not touch; not in the corpus (helix's `n`/`N` walk regex search hits). What a step selects is the pane's GRAIN (`output_pane.Grain`, read in `Pardes.lookSpanIn`): in FREE TEXT — a terminal, a file, a PDF, a prose answer buffer — the largest whitespace-delimited run `look.resolve` can act on (`look.lookableSpan`, wrapper punctuation peeled off both ends), several to a line; in a RESULTS BUFFER one stop per ROW, the largest run its head resolves as (`look.lookableLineSpan`), because a row there IS one location and the words after it are the match rather than a second place to go; in a COMMAND list the whole line. The walk is a RING across PANES: every pane that has performed a Look, most recent first (`Pardes.look_src`), then the output buffers that have not, newest first, and only when both are empty the active pane. Exhausting a pane enters the next at its first (forward) / last (backward) span and the end wraps to the start, so `N` is the exact inverse of `n`. What it lands on becomes an EXPLICIT `vsel` with the cursor on its FIRST column, in the pane the walk focuses. ONE motion in every pane kind and every buffer kind — a PDF steps the `+Search` buffer its own search filled, `n` to select the row and Enter to jump. The single thing a buffer may change is that grain, and it changes it by BEING a kind of buffer rather than by a branch: `output_pane.Traits.steps` (a list of locations) makes a step take one row at a time, and `Traits.commands` makes it take the WHOLE LINE, because a command list (`Themes`/`Fonts`) holds words to run and there is no path inside `Theme gruvbox` to pick out. Tab on what `n` selected wears the theme, which is the same middle click on the row is. `]d`/`[d` are helix's diagnostic motions, a different binding, and they do still jump to each diagnostic (`docs/typ/guide.typ`, Keys) | pardes-specific | +| `/` (any pane) | pardes' own plain-substring search into a `+Search` output buffer: the pattern is typed on a line of its own on the pane's notice band, Enter fills the buffer, and its rows are ordinary look targets. Enter also goes to the first row using `Pardes.lookFirstHit`, so `/foo` lands on the first hit with the matched span selected. A pattern that matched nothing opens its empty buffer and moves nothing | kept as-is; not in the corpus (helix `/` is regex search). Find and Grep answer with other files and deliberately do not jump. `LookNext` / `LookPrev` select subsequent result rows | pardes-specific | +| `n` / `N` | next / previous regex match in the current text, using the last search register; counts repeat and ends wrap | only the primary selection is replaced; in select mode each match is added and becomes primary. Named registers work. `*` sets the pattern from selections with word boundaries, `Alt-*` without. The former Look ring is `LookNext` / `LookPrev`, `SPC j n` / `SPC j p`. The change is bookmarked `pardes-nN-helix`; its predecessor is `pardes-nN-before-helix`. PDFs retain their location-result navigation | helix-verified | + | insert: printable text | file: real edit; terminal: typed run splice | | helix-verified (file) | | insert: `Enter` | newline; keeps the current full indent levels and adds one 4-space logical tab when the text before the cursor ends in `(`, `[`, `{`, or `)` (including `})`) | plain lines match `insert_newline`; delimiter heuristic is pardes-specific | helix-verified (plain) / pardes-specific (delimiter) | | insert: `Backspace` (+ `Shift-Backspace`) | delete prev char, joins lines at col 0; in a line's leading blanks, back to the previous 4-column indent stop (a whole unit when on one; a tab still goes alone) | matches `delete_char_backward` and its dedent; `Ctrl-h` alias in B | helix-verified | | insert: `Up` `Down` `Left` `Right` | move cursor | matches helix's "not recommended" insert arrows | helix-verified | -| `gd` `gD` `gy` `gi` `gr` | LSP definition / declaration / type-definition / implementation / references. ONE answer jumps straight there; several fill `+Search`, where n/N walk and Enter opens | in-process ZLS (`src/lsp/lsp_zls.zig`), `.zig` only — on a file the backend does not speak these do nothing at all, with no error row. Ctrl+left-click is the mouse spelling of `gd` | out of corpus | +| `gd` `gD` `gy` `gi` `gr` | LSP definition / declaration / type-definition / implementation / references. One answer jumps straight there; several fill `+Search`, where `LookNext` / `LookPrev` walk and Enter opens | Ctrl+left-click is the mouse spelling of `gd`; language support depends on the configured backend | out of corpus | | `]d` `[d` / `]D` `[D` | step the diagnostics list / go to its last or first; if no list is up, asking the backend for one is part of the press | | out of corpus | | `=` | `format_selections` — writes a `- old` / `+ new` diff into `+Lsp` | deliberate divergence: the seam returns ROWS, not edits, so this SHOWS the formatting instead of applying it. Not in the corpus, so there is no waiver to name — the query leaves the core as an effect the headless harness has no shell to perform | out of corpus | | `Ctrl-o` / `Ctrl-i` | jumplist back / forward (also Mouse4 / Mouse5 in SDL, macOS and web); successful navigation clears selections in both panes and places the cursor at the saved location; raw tty forwards both to the child — the `Back` / `Forward` builtins, also on `SPC j o` / `SPC j i`, with `SPC j l` rendering the stack as a buffer; a closed file's entry stays, marked `(closed)`, and a jump to it opens the file again at its place | helix binds both keys (`jump_backward` / `jump_forward`) but to a POSITION jumplist; pardes' stack is over panes and focus, so the keys agree and the semantics do not. `Ctrl-i` and Tab are the same byte under the legacy encoding; there Tab keeps meaning execute, and the pair only separates where the host speaks the kitty keyboard protocol | pardes-specific | @@ -352,7 +353,7 @@ text. | Key(s) | Helix behavior | Reason | | --- | --- | --- | -| `?`, `*`, `Alt-*` | rsearch / selection-as-pattern | search — pardes has its own `/` (plain substring into an output buffer, kept as-is) and an `n`/`N` that SELECTS the next look-able text instead of walking match hits; helix regex search machinery not wanted | +| `?` | reverse search prompt | pardes keeps its own `/` plain substring search into an output buffer. `*`, `Alt-*` and search-repeat `n`/`N` are implemented and verified above | | `Space` mode: `f F e . b j g G ' w c C Alt-c / ?` | pickers, global search, palette | pickers and the command palette do not exist here — but the KEY is taken: pardes' own leader runs the acme builtins (section A). Two halves of helix's space mode DO exist and are in section A: the clipboard menu (`y Y p P R`, helix's letters on helix's leader) and the LSP menu, moved one prefix deeper to `SPC l k/r/a/h/s/S/d/D` because `d`, `k`, `s` and `h` were already pardes' most-pressed keys | | Popup `Ctrl-u`/`Ctrl-d`, Completion menu, Signature help tables | LSP popups | LSP | | Picker table (all rows), Prompt table (all rows) | picker / prompt internals | pickers — pardes' tag line is its own one-line editor | @@ -364,7 +365,7 @@ text. | `:` | command mode | side-effects/file-ops — pardes builtins live in the tag, and `:` is bound to focusing it (section A) | | `gf` | goto file under selection | covered by pardes Enter-look | | `Ctrl-z` | suspend | pardes IS the terminal multiplexer | -| Select/extend mode section (prose) | `v` turns all motions into extenders, `n`/`N` keep selections | implemented for motions (phase 5: `pane.select` + the fixed anchor, differential-verified — see the `v` row in A); helix's search-`n`/`N` extension doesn't apply (pardes' `n`/`N` is the look-ring motion, which REPLACES the selection with the span it lands on) | +| Select/extend mode section (prose) | `v` turns all motions into extenders, `n`/`N` keep selections | implemented for motions (phase 5: `pane.select` + the fixed anchor, differential-verified — see the `v` row in A); search `n`/`N` add matches in select mode, as in helix | ## Differential testing (phase 5) @@ -421,9 +422,9 @@ Files (all in `test/hxcases/`): of the command from helix's own text there, so a later step is still tested when an earlier one misses. The goldens are `hx-harness test/hxcases/golf.jsonl`; `zig build hxgolf` runs them. - `golf-waivers.jsonl` pins the seven `reverse_golf_example` steps from `""N` - on: they walk the search register with `*`, `N` and `n`, which in pardes - are the acme look ring, by decision. All ten examples reproduce their published result in hx 25.07.1 under + `golf-waivers.jsonl` is empty: all 124 cases pass, including the + search-register steps of `reverse_golf_example`. All ten examples + reproduce their published result in hx 25.07.1 under the site's own conditions (a file of the example's language, auto-pairs on). Under the harness two do not, and their goldens are the harness's anyway, which pardes follows: `csv_to_sql` needs auto-pairs (off in the diff --git a/docs/typ/guide.typ b/docs/typ/guide.typ index 89323766..55f8a4f0 100644 --- a/docs/typ/guide.typ +++ b/docs/typ/guide.typ @@ -167,7 +167,7 @@ the #word("Look") came from, then of each pane on the jump list, most recent first. #pairs( - [#key("/") `TODO` #key("Enter")], [a `+Search` of the lines holding `TODO`, the cursor on the first; #keys("n", "N") step through], + [#key("/") `TODO` #key("Enter")], [a `+Search` of the lines holding `TODO`, the cursor on the first; #keys("n", "N") select the next or previous match], [#word("Find") `conf`], [a `+Search` of the files below the pane's directory with `conf` in their names], [#word("Grep") `TODO`], [a `+Search` of the lines holding `TODO`, literally, under every pane's directory], ) @@ -213,7 +213,7 @@ is drawn as a diff, each hunk in its file's language. #btn("B3") on: A `.diff` or `.patch` looked at, and a diff paged (`git show`), opens as a `+Diff`, stacked as delta shows one: each hunk under its `path:line` -(`n`/`N` step through them, #btn("B3") opens it) and the declarations +(`Space j n`/`Space j p` step through them, #btn("B3") opens it) and the declarations around it, a `+`/`-` before each line, the words a changed line changed tinted and a line added or removed whole faintly. A mailed patch keeps its message and diffstat above. The files are found from the diff's directory @@ -241,7 +241,8 @@ refusals and `--nested` are in the reference. [#key("w") #key("d")], [select a word, delete it: motions select, edits act on the selection], [#key("x"), #key("v"), #key(";")], [select the line; extend; collapse to the cursor], [#key("s")], [a cursor per regex match; every edit acts at each], - [#key("/"), #keys("n", "N")], [substring search; step through everything #word("Look") would open, across panes], + [#key("/"), #keys("n", "N")], [substring search; repeat the search in the current text, wrapping at the ends], + [#keys("Space j n", "Space j p")], [#word("LookNext") / #word("LookPrev"): select locations across panes; #key("Enter") opens one], [#key("g l")], [line end], [`12G`], [line 12; a bare #key("G") does nothing], [#key("SPC ?")], [#word("Help"): every builtin, with its leader path and keys; `SPC w ?` only the paths under `SPC w`; #word("Tutor") (#key("SPC h t")) practises them], diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index ce2cedc8..e15faca7 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +- n/N follow Helix search registers, counts, wrapping and select mode. + `*` sets a search from the selection; `Alt-*` omits word boundaries. + The location ring remains as LookNext/LookPrev (Space j n/p). + ## 0.23 - A file a language server speaks for (by its extension) has `Def` and diff --git a/src/Registers.zig b/src/Registers.zig index d2a42434..3f2486cd 100644 --- a/src/Registers.zig +++ b/src/Registers.zig @@ -9,6 +9,7 @@ const std = @import("std"); const Registers = @This(); list: std.ArrayList(Reg) = .empty, +last_search: u21 = '/', pub const Reg = struct { name: u21, diff --git a/src/builtins.zig b/src/builtins.zig index c1424b2f..ef769b48 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -744,15 +744,15 @@ pub const Restore = struct { // so a Restore that could never happen spends no warning. if (comptime pardes.hosted) { const bytes = @import("fs.zig").readRestore(c.p.gpa, path, c.p.settings.dump_dir.get()) catch |err| { - var buf: [limits.host_path_cap + 64]u8 = undefined; - var words: [128]u8 = undefined; - const why = switch (err) { - error.FileNotFound => "no such file", - error.PermissionDenied => "permission denied", - error.IsDirectory => "a directory, not a dump", - else => pardes.Messages.errorWords(err, &words), - }; - return c.p.reportFailure(c.id, std.fmt.bufPrint(&buf, "Restore: {s}: {s}", .{ path, why }) catch "Restore: cannot read the dump"); + var buf: [limits.host_path_cap + 64]u8 = undefined; + var words: [128]u8 = undefined; + const why = switch (err) { + error.FileNotFound => "no such file", + error.PermissionDenied => "permission denied", + error.IsDirectory => "a directory, not a dump", + else => pardes.Messages.errorWords(err, &words), + }; + return c.p.reportFailure(c.id, std.fmt.bufPrint(&buf, "Restore: {s}: {s}", .{ path, why }) catch "Restore: cannot read the dump"); }; defer c.p.gpa.free(bytes); // Nor does a file that is not a dump, before any warning. @@ -1837,6 +1837,20 @@ pub const Forward = struct { } }; +/// Select the next Look location across panes; Enter opens it. +pub const LookNext = struct { + pub fn run(c: Ctx) void { + look.lookWalk(c.p, 1); + } +}; + +/// Select the previous Look location across panes; Enter opens it. +pub const LookPrev = struct { + pub fn run(c: Ctx) void { + look.lookWalk(c.p, -1); + } +}; + /// Go back to the last place jumped from in another pane. pub const Last = struct { pub fn run(c: Ctx) void { diff --git a/src/config.zig b/src/config.zig index c2f51b36..fb34b746 100644 --- a/src/config.zig +++ b/src/config.zig @@ -47,6 +47,8 @@ pub const leader_path = paths: { .Callees = "lC", .Supertypes = "lt", .Subtypes = "lT", + .LookNext = "jn", + .LookPrev = "jp", .Del = "d", .DelAbove = null, .DelBelow = null, @@ -331,6 +333,8 @@ pub const command_line: []const Chord = &.{.{ .cp = ':' }}; pub const search: []const Chord = &.{.{ .cp = '/' }}; pub const search_next: []const Chord = &.{.{ .cp = 'n' }}; pub const search_prev: []const Chord = &.{.{ .cp = 'N' }}; +pub const search_selection: []const Chord = &.{.{ .cp = '*', .alt = true }}; +pub const search_selection_word: []const Chord = &.{.{ .cp = '*' }}; pub const pipe_selection: []const Chord = &.{.{ .cp = '|' }}; pub const pipe_selection_to: []const Chord = &.{.{ .cp = '|', .alt = true }}; pub const insert_output: []const Chord = &.{.{ .cp = '!' }}; diff --git a/src/look.zig b/src/look.zig index 6ba6a8d0..5795979f 100644 --- a/src/look.zig +++ b/src/look.zig @@ -542,7 +542,10 @@ pub fn submitSearch(p: *Pardes, id: usize) void { const pane = p.panes[id] orelse return; if (normal.selRegexArmed(pane)) |a| { // helix keeps the pattern in `/` - if (a.pat.len > 0) p.registers.put(p.gpa, '/', a.pat, 0, 1, true); + if (a.pat.len > 0) { + p.registers.put(p.gpa, '/', a.pat, 0, 1, true); + p.registers.last_search = '/'; + } return if (p.promptTarget(pane)) |t| normal.applySelRegex(p, pane, t, a.pat, a.mode); } const armed = pane.promptText() orelse return; @@ -556,7 +559,13 @@ pub fn submitSearch(p: *Pardes, id: usize) void { else .text; _ = runSearch(p, id, armed[slash + 1 ..], kind, .top, true) catch |err| return p.reportError(id, "search", err); - if (kind == .text) lookFirstHit(p, id); + if (kind == .text) { + var pattern: std.ArrayList(u8) = .empty; + normal.appendSearchLiteral(&pattern, p.scratch.allocator(), armed[slash + 1 ..]) catch return; + p.registers.put(p.gpa, '/', pattern.items, 0, 1, true); + p.registers.last_search = '/'; + lookFirstHit(p, id); + } } fn lookFirstHit(p: *Pardes, id: usize) void { @@ -2752,7 +2761,6 @@ test "Look on a diff under each git prefix opens the repository's file, and a re } } - test "Look on a diff line is the look of the address it names, selected by hand: a cached patch, the checkout elsewhere" { if (!platform_has_fs) return; const io = std.testing.io; diff --git a/src/modal.zig b/src/modal.zig index 316a66fa..548524ae 100644 --- a/src/modal.zig +++ b/src/modal.zig @@ -157,6 +157,8 @@ pub const Normal = struct { search, search_next, search_prev, + search_selection, + search_selection_word, }; pub const Input = struct { @@ -355,7 +357,8 @@ pub const Normal = struct { command_line, pipe_selection: PipeBehavior, search, - search_step: Direction, + search_step: struct { direction: Direction, count: u32 }, + search_selection: bool, goto_word, macro_record, macro_replay: u32, @@ -373,6 +376,7 @@ pub const Normal = struct { .pipe_selection, .search, .search_step, + .search_selection, .macro_record, .macro_replay, .node, @@ -676,8 +680,10 @@ pub const Normal = struct { if (key.has(.macro_replay)) return resultAction(.{ .macro_replay = count }); if (key.has(.repeat_insert)) return resultAction(.{ .repeat_insert = count }); if (key.has(.search)) return resultAction(.search); - if (key.has(.search_next)) return resultAction(.{ .search_step = .forward }); - if (key.has(.search_prev)) return resultAction(.{ .search_step = .backward }); + if (key.has(.search_selection)) return resultAction(.{ .search_selection = false }); + if (key.has(.search_selection_word)) return resultAction(.{ .search_selection = true }); + if (key.has(.search_next)) return resultAction(.{ .search_step = .{ .direction = .forward, .count = count } }); + if (key.has(.search_prev)) return resultAction(.{ .search_step = .{ .direction = .backward, .count = count } }); return .unbound; } @@ -1420,6 +1426,17 @@ fn wordClassAt(text: []const u8, off: usize) WordClass { }; } +pub fn searchWordAt(text: []const u8, off: usize) bool { + return off < text.len and wordClassAt(text, off) == .word; +} + +pub fn searchWordBefore(text: []const u8, off: usize) bool { + if (off == 0) return false; + var previous = off - 1; + while (previous > 0 and text[previous] & 0xc0 == 0x80) previous -= 1; + return searchWordAt(text, previous); +} + fn isWordWhitespace(c: WordClass) bool { // Rust char::is_whitespace (includes line endings) return c == .ws or c == .eol; } diff --git a/src/normal.zig b/src/normal.zig index aec6b983..fad1836b 100644 --- a/src/normal.zig +++ b/src/normal.zig @@ -168,6 +168,168 @@ pub fn applySelRegex(p: *Pardes, pane: *Pane, t: *Text, pat: []const u8, mode: m t.setRanges(text, out[0..m], &.{}, 0, true); // helix keeps primary 0 (its own TODO) } +/// Search only the primary range, as Helix does. Select mode adds a new +/// match and makes it primary; normal mode replaces only the primary. +fn searchStep(p: *Pardes, t: *Text, text: []const u8, direction: modal.Normal.Direction, count: u32) void { + const name = if (p.register != 0) p.register else p.registers.last_search; + const pat = p.registers.value(name, 0) orelse return; + var re = SearchRegex.compile(p.scratch.allocator(), pat) catch { + p.setMessage(p.active, "invalid search pattern"); + return; + }; + var hay = text; + if (for (pat) |c| { + if (std.ascii.isUpper(c)) break false; + } else true) { + const lower = p.scratch.allocator().dupe(u8, text) catch return; + for (lower) |*c| c.* = std.ascii.toLower(c.*); + hay = lower; + } + for (0..count) |_| { + var ranges: [Text.max_selections]modal.Selection = undefined; + const got = t.ranges(text, 0, &ranges); + const old = ranges[got.pri]; + const from = @min(old.anchor, old.head); + const to = @max(old.anchor, old.head); + var wrapped = false; + const found = (if (direction == .forward) blk: { + if (tryFind(&re, hay, to, hay.len)) |h| break :blk h; + wrapped = true; + break :blk tryFind(&re, hay, 0, hay.len); + } else blk: { + if (lastMatch(&re, hay, 0, from)) |h| break :blk h; + wrapped = true; + break :blk lastMatch(&re, hay, from, hay.len); + }) orelse { + p.setMessage(p.active, "no more matches"); + return; + }; + if (found.end == 0) return; + const next: modal.Selection = if (old.anchor > old.head) + .{ .anchor = found.end, .head = found.start } + else + .{ .anchor = found.start, .head = found.end }; + if (t.select and got.n < ranges.len) { + ranges[got.n] = next; + t.setRanges(text, ranges[0 .. got.n + 1], &.{}, got.n, true); + } else { + ranges[got.pri] = next; + t.setRanges(text, ranges[0..got.n], &.{}, got.pri, true); + } + if (wrapped) p.setMessage(p.active, "wrapped around document"); + } + t.show(); +} + +fn tryFind(re: *SearchRegex, hay: []const u8, from: usize, to: usize) ?regexp.Regex.Match { + return re.find(hay, @min(from, hay.len), to); +} + +fn lastMatch(re: *SearchRegex, hay: []const u8, from: usize, to: usize) ?regexp.Regex.Match { + var last: ?regexp.Regex.Match = null; + var at = from; + while (at <= to) { + const found = tryFind(re, hay, at, to) orelse break; + last = found; + at = if (found.end > found.start) found.end else modal.nextGrapheme(hay, found.end); + if (at <= found.start) break; + } + return last; +} + +pub fn searchSelection(p: *Pardes, t: *Text, text: []const u8, boundary: bool) void { + var ranges: [Text.max_selections]modal.Selection = undefined; + const got = t.ranges(text, 0, &ranges); + var pattern: std.ArrayList(u8) = .empty; + const arena = p.scratch.allocator(); + for (ranges[0..got.n], 0..) |r, i| { + const from = @min(r.anchor, r.head); + const to = @min(text.len, @max(r.anchor, r.head)); + if (i > 0) pattern.append(arena, '|') catch return; + if (boundary and modal.searchWordAt(text, from) and !modal.searchWordBefore(text, from)) pattern.appendSlice(arena, "\\b") catch return; + appendSearchLiteral(&pattern, arena, text[from..to]) catch return; + if (boundary and to < text.len and modal.searchWordBefore(text, to) and !modal.searchWordAt(text, to)) pattern.appendSlice(arena, "\\b") catch return; + } + const name = if (p.register != 0) p.register else '/'; + p.registers.put(p.gpa, name, pattern.items, 0, 1, true); + p.registers.last_search = name; +} + +// mvzr's word boundary is ASCII-only. Strip outer boundaries and check +// them against Unicode characters for search-selection patterns. +const SearchRegex = struct { + const Branch = struct { re: regexp.Regex, start_word: bool, end_word: bool }; + branches: []Branch, + + fn compile(arena: std.mem.Allocator, pattern: []const u8) !SearchRegex { + if (std.mem.indexOf(u8, pattern, "\\b") == null) { + const branches = try arena.alloc(Branch, 1); + branches[0] = try branch(pattern); + return .{ .branches = branches }; + } + var branches: std.ArrayList(Branch) = .empty; + var from: usize = 0; + var depth: usize = 0; + var escaped = false; + var in_class = false; + for (pattern, 0..) |c, i| { + if (escaped) { + escaped = false; + continue; + } + if (c == '\\') { + escaped = true; + continue; + } + if (c == '[') in_class = true else if (c == ']') in_class = false; + if (in_class) continue; + if (c == '(') depth += 1 else if (c == ')') depth -|= 1; + if (c == '|' and depth == 0) { + try branches.append(arena, try branch(pattern[from..i])); + from = i + 1; + } + } + try branches.append(arena, try branch(pattern[from..])); + for (branches.items) |*b| b.re.steps = regexp.Regex.budget / branches.items.len; + return .{ .branches = branches.items }; + } + + fn branch(pattern: []const u8) !Branch { + var pat = pattern; + const start = std.mem.startsWith(u8, pat, "\\b"); + if (start) pat = pat[2..]; + const end = std.mem.endsWith(u8, pat, "\\b") and !std.mem.endsWith(u8, pat, "\\\\b"); + if (end) pat = pat[0 .. pat.len - 2]; + return .{ .re = try regexp.Regex.compile(pat), .start_word = start, .end_word = end }; + } + + fn find(self: *SearchRegex, hay: []const u8, from: usize, to: usize) ?regexp.Regex.Match { + var best: ?regexp.Regex.Match = null; + for (self.branches) |*b| { + var at = from; + while (at <= to) { + const found = (b.re.find(hay, at, to, to) catch break) orelse break; + if ((!b.start_word or modal.searchWordBefore(hay, found.start) != modal.searchWordAt(hay, found.start)) and + (!b.end_word or modal.searchWordBefore(hay, found.end) != modal.searchWordAt(hay, found.end))) + { + if (best == null or found.start < best.?.start) best = found; + break; + } + at = modal.nextGrapheme(hay, found.start); + if (at <= found.start) break; + } + } + return best; + } +}; + +pub fn appendSearchLiteral(out: *std.ArrayList(u8), arena: std.mem.Allocator, text: []const u8) !void { + for (text) |c| { + if (std.mem.indexOfScalar(u8, "\\^$.[]()|*+?{}", c) != null) try out.append(arena, '\\'); + if (c == '\n') try out.appendSlice(arena, "\\n") else try out.append(arena, c); + } +} + /// The file's parse, made on the first key that walks it after an edit and /// kept until the next: never made again for a key that changed nothing. pub fn fileTree(p: *Pardes, f: *panes.File.State) ?*anyopaque { @@ -766,10 +928,8 @@ fn executeNormalAction(p: *Pardes, t: *Text, semantic: modal.Normal.Action) void }, .pipe_selection => |how| return p.startPrompt(pane, t, .{ .pipe = how }), .search => return p.startPrompt(pane, &pane.body, .{ .search = config.search_marker }), - .search_step => |direction| return look.lookWalk( - p, - if (direction == .forward) @as(i32, 1) else -1, - ), + .search_step => |step| return searchStep(p, t, text, step.direction, step.count), + .search_selection => |boundary| return searchSelection(p, t, text, boundary), .node => |walk| return nodeSelect(p, pane, t, walk), .goto_word => return startJump(p, pane, t), .object_jump => |jump| return objectJump(p, pane, t, text, range, jump.object, jump.direction == .forward, jump.count), diff --git a/src/pdf_view.zig b/src/pdf_view.zig index d5769ad3..567117bb 100644 --- a/src/pdf_view.zig +++ b/src/pdf_view.zig @@ -1843,7 +1843,7 @@ pub fn applyNormal( .leader => result.host = .leader, .command_line => result.host = .command_line, .search => result.host = .search, - .search_step => |direction| result.host = if (direction == .forward) + .search_step => |step| result.host = if (step.direction == .forward) .search_forward else .search_backward, diff --git a/src/tutor.txt b/src/tutor.txt index 7492b058..8f5cf241 100644 --- a/src/tutor.txt +++ b/src/tutor.txt @@ -97,7 +97,7 @@ 1. `Look` :20 here: the cursor goes to line 20 of this pane. 2. `Look` :/UNSAVED/ to go to the next match of UNSAVED. 3. Press /, type keys, press Enter: a +Search lists the lines with - keys and the cursor goes to the first. n and N step through. + keys and the cursor goes to the first. n and N select search matches. -> Guide: Look @@ -256,7 +256,8 @@ typed | filter every selection through the shell / case-insensitive SUBSTRING search, one hit a line; the regex lives on s and S - n / N the next/previous text `Look` would open, as above + n / N next/previous search match (Helix); v adds matches + SPC j n/p `LookNext`/`LookPrev`: select locations; Enter opens Ctrl-c comment or uncomment the lines VIEWPORT @@ -341,7 +342,7 @@ typed SPC is the leader (SPC ? is `Help`) vs HELIX selection is LINE-first (x), v for characters; / is a - substring search; n/N walk what `Look` would open. + substring search; n/N repeat it in the current text. vs VIM no verb+noun: the motion already selected, so wd is what dw was; Esc goes back a pane; bare G does nothing. vs BOTH a terminal is just a pane, and the session can outlive diff --git a/test/hxcases/cases.jsonl b/test/hxcases/cases.jsonl index f36afe11..b7fdc4c9 100644 --- a/test/hxcases/cases.jsonl +++ b/test/hxcases/cases.jsonl @@ -592,3 +592,67 @@ {"name": "comment-then-insert", "pane": "file", "text": "alpha\n", "keys": "iz"} {"name": "comment-after-sel-regex", "pane": "file", "text": "alpha\nbeta\ngamma\n", "keys": "%sa"} {"name": "comment-after-split-regex", "pane": "file", "text": "a,b\nc,d\n", "keys": "%S,"} +{"name": "search-repeat-next", "pane": "file", "text": "one one one\n", "keys": "w*n"} +{"name": "search-repeat-next-tty", "pane": "tty", "text": "one one one\n", "keys": "w*n"} +{"name": "search-repeat-prev", "pane": "file", "text": "one one one\n", "keys": "w*N"} +{"name": "search-repeat-prev-tty", "pane": "tty", "text": "one one one\n", "keys": "w*N"} +{"name": "search-repeat-wrap", "pane": "file", "text": "one one one\n", "keys": "w*3n"} +{"name": "search-repeat-wrap-tty", "pane": "tty", "text": "one one one\n", "keys": "w*3n"} +{"name": "search-repeat-count", "pane": "file", "text": "one one one\n", "keys": "w*2n"} +{"name": "search-repeat-count-tty", "pane": "tty", "text": "one one one\n", "keys": "w*2n"} +{"name": "search-repeat-reverse-count", "pane": "file", "text": "one one one\n", "keys": "w*2N"} +{"name": "search-repeat-reverse-count-tty", "pane": "tty", "text": "one one one\n", "keys": "w*2N"} +{"name": "search-repeat-select", "pane": "file", "text": "one one one\n", "keys": "w*vn"} +{"name": "search-repeat-select-tty", "pane": "tty", "text": "one one one\n", "keys": "w*vn"} +{"name": "search-repeat-select-count", "pane": "file", "text": "one one one\n", "keys": "w*v2n"} +{"name": "search-repeat-select-count-tty", "pane": "tty", "text": "one one one\n", "keys": "w*v2n"} +{"name": "search-repeat-select-back", "pane": "file", "text": "one one one\n", "keys": "w*vN"} +{"name": "search-repeat-select-back-tty", "pane": "tty", "text": "one one one\n", "keys": "w*vN"} +{"name": "search-repeat-keep-secondary", "pane": "file", "text": "one one one\n", "keys": "%sonen"} +{"name": "search-repeat-keep-secondary-tty", "pane": "tty", "text": "one one one\n", "keys": "%sonen"} +{"name": "search-repeat-reverse-selection", "pane": "file", "text": "one one one\n", "keys": "w*n"} +{"name": "search-repeat-reverse-selection-tty", "pane": "tty", "text": "one one one\n", "keys": "w*n"} +{"name": "search-repeat-smart-case", "pane": "file", "text": "one ONE one\n", "keys": "%sone,n"} +{"name": "search-repeat-smart-case-tty", "pane": "tty", "text": "one ONE one\n", "keys": "%sone,n"} +{"name": "search-repeat-upper-case", "pane": "file", "text": "one ONE ONE\n", "keys": "%sONE,n"} +{"name": "search-repeat-upper-case-tty", "pane": "tty", "text": "one ONE ONE\n", "keys": "%sONE,n"} +{"name": "search-repeat-named", "pane": "file", "text": "one one one\n", "keys": "w\"a*\"an"} +{"name": "search-repeat-named-tty", "pane": "tty", "text": "one one one\n", "keys": "w\"a*\"an"} +{"name": "search-repeat-remember-named", "pane": "file", "text": "one one one\n", "keys": "w\"a*n"} +{"name": "search-repeat-remember-named-tty", "pane": "tty", "text": "one one one\n", "keys": "w\"a*n"} +{"name": "search-repeat-literal", "pane": "file", "text": "a.b a.b axb\n", "keys": "3ln"} +{"name": "search-repeat-literal-tty", "pane": "tty", "text": "a.b a.b axb\n", "keys": "3ln"} +{"name": "search-repeat-newline", "pane": "file", "text": "alpha\nbeta\nalpha\nbeta\n", "keys": "%salpha,n"} +{"name": "search-repeat-newline-tty", "pane": "tty", "text": "alpha\nbeta\nalpha\nbeta\n", "keys": "%salpha,n"} +{"name": "search-repeat-no-reg", "pane": "file", "text": "one one one\n", "keys": "n"} +{"name": "search-repeat-no-reg-tty", "pane": "tty", "text": "one one one\n", "keys": "n"} +{"name": "search-repeat-missing", "pane": "file", "text": "one one one\n", "keys": "\"an"} +{"name": "search-repeat-missing-tty", "pane": "tty", "text": "one one one\n", "keys": "\"an"} +{"name": "search-repeat-regexp", "pane": "file", "text": "a1 a2 a3\n", "keys": "%sa[0-9],n"} +{"name": "search-repeat-regexp-tty", "pane": "tty", "text": "a1 a2 a3\n", "keys": "%sa[0-9],n"} +{"name": "search-repeat-zero", "pane": "file", "text": "abc abc\n", "keys": "%s$,n"} +{"name": "search-repeat-zero-tty", "pane": "tty", "text": "abc abc\n", "keys": "%s$,n"} +{"name": "search-repeat-unicode", "pane": "file", "text": "界 界 界\n", "keys": "w*n"} +{"name": "search-repeat-unicode-tty", "pane": "tty", "text": "界 界 界\n", "keys": "w*n"} +{"name": "search-repeat-combining", "pane": "file", "text": "á á á\n", "keys": "w*n"} +{"name": "search-repeat-combining-tty", "pane": "tty", "text": "á á á\n", "keys": "w*n"} +{"name": "search-repeat-word-boundary", "pane": "file", "text": "one oneself one\n", "keys": "en"} +{"name": "search-repeat-word-boundary-tty", "pane": "tty", "text": "one oneself one\n", "keys": "en"} +{"name": "search-repeat-word-normal", "pane": "file", "text": "one oneself one\n", "keys": "e*n"} +{"name": "search-repeat-word-normal-tty", "pane": "tty", "text": "one oneself one\n", "keys": "e*n"} +{"name": "search-repeat-word-extend-wrap", "pane": "file", "text": "one one one\n", "keys": "e*v4n"} +{"name": "search-repeat-word-extend-wrap-tty", "pane": "tty", "text": "one one one\n", "keys": "e*v4n"} +{"name": "search-repeat-word-reverse-wrap", "pane": "file", "text": "one one one\n", "keys": "e*4N"} +{"name": "search-repeat-word-reverse-wrap-tty", "pane": "tty", "text": "one one one\n", "keys": "e*4N"} +{"name": "search-repeat-unicode-boundary", "pane": "file", "text": "界 界界 界\n", "keys": "e*n"} +{"name": "search-repeat-unicode-boundary-tty", "pane": "tty", "text": "界 界界 界\n", "keys": "e*n"} +{"name": "search-repeat-unicode-alternatives", "pane": "file", "text": "界 語 界 語\n", "keys": "%s[界語]*n"} +{"name": "search-repeat-unicode-alternatives-tty", "pane": "tty", "text": "界 語 界 語\n", "keys": "%s[界語]*n"} +{"name": "search-repeat-multisel-extend", "pane": "file", "text": "one two one two\n", "keys": "%sone|two*vn"} +{"name": "search-repeat-multisel-extend-tty", "pane": "tty", "text": "one two one two\n", "keys": "%sone|two*vn"} +{"name": "search-repeat-backward-zero", "pane": "file", "text": "abc abc\n", "keys": "%s$,2N"} +{"name": "search-repeat-backward-zero-tty", "pane": "tty", "text": "abc abc\n", "keys": "%s$,2N"} +{"name": "search-repeat-adjacent", "pane": "file", "text": "aaa\n", "keys": "*2n"} +{"name": "search-repeat-adjacent-tty", "pane": "tty", "text": "aaa\n", "keys": "*2n"} +{"name": "search-repeat-direction-extend", "pane": "file", "text": "one one one\n", "keys": "e*vn"} +{"name": "search-repeat-direction-extend-tty", "pane": "tty", "text": "one one one\n", "keys": "e*vn"} diff --git a/test/hxcases/goldens.jsonl b/test/hxcases/goldens.jsonl index 2dab15c0..bfa479be 100644 --- a/test/hxcases/goldens.jsonl +++ b/test/hxcases/goldens.jsonl @@ -592,3 +592,67 @@ {"name":"comment-then-insert","text":"# zalpha\n","mode":"normal","cursor":{"row":0,"col":3},"anchor":{"row":0,"col":3}} {"name":"comment-after-sel-regex","text":"# alpha\n# beta\n# gamma\n","mode":"normal","cursor":{"row":0,"col":2},"anchor":{"row":0,"col":2},"sels":[{"cursor":{"row":0,"col":2},"anchor":{"row":0,"col":2}},{"cursor":{"row":0,"col":6},"anchor":{"row":0,"col":6}},{"cursor":{"row":1,"col":5},"anchor":{"row":1,"col":5}},{"cursor":{"row":2,"col":3},"anchor":{"row":2,"col":3}},{"cursor":{"row":2,"col":6},"anchor":{"row":2,"col":6}}],"primary":0} {"name":"comment-after-split-regex","text":"# a,b\n# c,d\n","mode":"normal","cursor":{"row":0,"col":2},"anchor":{"row":0,"col":2},"sels":[{"cursor":{"row":0,"col":2},"anchor":{"row":0,"col":2}},{"cursor":{"row":1,"col":2},"anchor":{"row":0,"col":4}},{"cursor":{"row":1,"col":5},"anchor":{"row":1,"col":4}}],"primary":0} +{"name":"search-repeat-next","text":"one one one\n","mode":"normal","cursor":{"row":0,"col":7},"anchor":{"row":0,"col":4}} +{"name":"search-repeat-next-tty","text":"one one one\n","mode":"normal","cursor":{"row":0,"col":7},"anchor":{"row":0,"col":4}} +{"name":"search-repeat-prev","text":"one one one\n","mode":"normal","cursor":{"row":0,"col":7},"anchor":{"row":0,"col":4}} +{"name":"search-repeat-prev-tty","text":"one one one\n","mode":"normal","cursor":{"row":0,"col":7},"anchor":{"row":0,"col":4}} +{"name":"search-repeat-wrap","text":"one one one\n","mode":"normal","cursor":{"row":0,"col":7},"anchor":{"row":0,"col":4}} +{"name":"search-repeat-wrap-tty","text":"one one one\n","mode":"normal","cursor":{"row":0,"col":7},"anchor":{"row":0,"col":4}} +{"name":"search-repeat-count","text":"one one one\n","mode":"normal","cursor":{"row":0,"col":3},"anchor":{"row":0,"col":0}} +{"name":"search-repeat-count-tty","text":"one one one\n","mode":"normal","cursor":{"row":0,"col":3},"anchor":{"row":0,"col":0}} +{"name":"search-repeat-reverse-count","text":"one one one\n","mode":"normal","cursor":{"row":0,"col":3},"anchor":{"row":0,"col":0}} +{"name":"search-repeat-reverse-count-tty","text":"one one one\n","mode":"normal","cursor":{"row":0,"col":3},"anchor":{"row":0,"col":0}} +{"name":"search-repeat-select","text":"one one one\n","mode":"select","cursor":{"row":0,"col":7},"anchor":{"row":0,"col":4},"sels":[{"cursor":{"row":0,"col":3},"anchor":{"row":0,"col":0}},{"cursor":{"row":0,"col":7},"anchor":{"row":0,"col":4}}],"primary":1} +{"name":"search-repeat-select-tty","text":"one one one\n","mode":"select","cursor":{"row":0,"col":7},"anchor":{"row":0,"col":4},"sels":[{"cursor":{"row":0,"col":3},"anchor":{"row":0,"col":0}},{"cursor":{"row":0,"col":7},"anchor":{"row":0,"col":4}}],"primary":1} +{"name":"search-repeat-select-count","text":"one one one\n","mode":"select","cursor":{"row":0,"col":3},"anchor":{"row":0,"col":0},"sels":[{"cursor":{"row":0,"col":3},"anchor":{"row":0,"col":0}},{"cursor":{"row":0,"col":7},"anchor":{"row":0,"col":4}}],"primary":0} +{"name":"search-repeat-select-count-tty","text":"one one one\n","mode":"select","cursor":{"row":0,"col":3},"anchor":{"row":0,"col":0},"sels":[{"cursor":{"row":0,"col":3},"anchor":{"row":0,"col":0}},{"cursor":{"row":0,"col":7},"anchor":{"row":0,"col":4}}],"primary":0} +{"name":"search-repeat-select-back","text":"one one one\n","mode":"select","cursor":{"row":0,"col":7},"anchor":{"row":0,"col":4},"sels":[{"cursor":{"row":0,"col":3},"anchor":{"row":0,"col":0}},{"cursor":{"row":0,"col":7},"anchor":{"row":0,"col":4}}],"primary":1} +{"name":"search-repeat-select-back-tty","text":"one one one\n","mode":"select","cursor":{"row":0,"col":7},"anchor":{"row":0,"col":4},"sels":[{"cursor":{"row":0,"col":3},"anchor":{"row":0,"col":0}},{"cursor":{"row":0,"col":7},"anchor":{"row":0,"col":4}}],"primary":1} +{"name":"search-repeat-keep-secondary","text":"one one one\n","mode":"normal","cursor":{"row":0,"col":6},"anchor":{"row":0,"col":4},"sels":[{"cursor":{"row":0,"col":6},"anchor":{"row":0,"col":4}},{"cursor":{"row":0,"col":10},"anchor":{"row":0,"col":8}}],"primary":0} +{"name":"search-repeat-keep-secondary-tty","text":"one one one\n","mode":"normal","cursor":{"row":0,"col":6},"anchor":{"row":0,"col":4},"sels":[{"cursor":{"row":0,"col":6},"anchor":{"row":0,"col":4}},{"cursor":{"row":0,"col":10},"anchor":{"row":0,"col":8}}],"primary":0} +{"name":"search-repeat-reverse-selection","text":"one one one\n","mode":"normal","cursor":{"row":0,"col":4},"anchor":{"row":0,"col":7}} +{"name":"search-repeat-reverse-selection-tty","text":"one one one\n","mode":"normal","cursor":{"row":0,"col":4},"anchor":{"row":0,"col":7}} +{"name":"search-repeat-smart-case","text":"one ONE one\n","mode":"normal","cursor":{"row":0,"col":6},"anchor":{"row":0,"col":4}} +{"name":"search-repeat-smart-case-tty","text":"one ONE one\n","mode":"normal","cursor":{"row":0,"col":6},"anchor":{"row":0,"col":4}} +{"name":"search-repeat-upper-case","text":"one ONE ONE\n","mode":"normal","cursor":{"row":0,"col":10},"anchor":{"row":0,"col":8}} +{"name":"search-repeat-upper-case-tty","text":"one ONE ONE\n","mode":"normal","cursor":{"row":0,"col":10},"anchor":{"row":0,"col":8}} +{"name":"search-repeat-named","text":"one one one\n","mode":"normal","cursor":{"row":0,"col":7},"anchor":{"row":0,"col":4}} +{"name":"search-repeat-named-tty","text":"one one one\n","mode":"normal","cursor":{"row":0,"col":7},"anchor":{"row":0,"col":4}} +{"name":"search-repeat-remember-named","text":"one one one\n","mode":"normal","cursor":{"row":0,"col":7},"anchor":{"row":0,"col":4}} +{"name":"search-repeat-remember-named-tty","text":"one one one\n","mode":"normal","cursor":{"row":0,"col":7},"anchor":{"row":0,"col":4}} +{"name":"search-repeat-literal","text":"a.b a.b axb\n","mode":"normal","cursor":{"row":0,"col":7},"anchor":{"row":0,"col":7}} +{"name":"search-repeat-literal-tty","text":"a.b a.b axb\n","mode":"normal","cursor":{"row":0,"col":7},"anchor":{"row":0,"col":7}} +{"name":"search-repeat-newline","text":"alpha\nbeta\nalpha\nbeta\n","mode":"normal","cursor":{"row":2,"col":4},"anchor":{"row":2,"col":0}} +{"name":"search-repeat-newline-tty","text":"alpha\nbeta\nalpha\nbeta\n","mode":"normal","cursor":{"row":2,"col":4},"anchor":{"row":2,"col":0}} +{"name":"search-repeat-no-reg","text":"one one one\n","mode":"normal","cursor":{"row":0,"col":0},"anchor":{"row":0,"col":0}} +{"name":"search-repeat-no-reg-tty","text":"one one one\n","mode":"normal","cursor":{"row":0,"col":0},"anchor":{"row":0,"col":0}} +{"name":"search-repeat-missing","text":"one one one\n","mode":"normal","cursor":{"row":0,"col":0},"anchor":{"row":0,"col":0}} +{"name":"search-repeat-missing-tty","text":"one one one\n","mode":"normal","cursor":{"row":0,"col":0},"anchor":{"row":0,"col":0}} +{"name":"search-repeat-regexp","text":"a1 a2 a3\n","mode":"normal","cursor":{"row":0,"col":4},"anchor":{"row":0,"col":3}} +{"name":"search-repeat-regexp-tty","text":"a1 a2 a3\n","mode":"normal","cursor":{"row":0,"col":4},"anchor":{"row":0,"col":3}} +{"name":"search-repeat-zero","text":"abc abc\n","mode":"normal","cursor":{"row":1,"col":0},"anchor":{"row":1,"col":0}} +{"name":"search-repeat-zero-tty","text":"abc abc\n","mode":"normal","cursor":{"row":1,"col":0},"anchor":{"row":1,"col":0}} +{"name":"search-repeat-unicode","text":"界 界 界\n","mode":"normal","cursor":{"row":0,"col":7},"anchor":{"row":0,"col":4}} +{"name":"search-repeat-unicode-tty","text":"界 界 界\n","mode":"normal","cursor":{"row":0,"col":7},"anchor":{"row":0,"col":4}} +{"name":"search-repeat-combining","text":"á á á\n","mode":"normal","cursor":{"row":0,"col":7},"anchor":{"row":0,"col":4}} +{"name":"search-repeat-combining-tty","text":"á á á\n","mode":"normal","cursor":{"row":0,"col":7},"anchor":{"row":0,"col":4}} +{"name":"search-repeat-word-boundary","text":"one oneself one\n","mode":"normal","cursor":{"row":0,"col":6},"anchor":{"row":0,"col":4}} +{"name":"search-repeat-word-boundary-tty","text":"one oneself one\n","mode":"normal","cursor":{"row":0,"col":6},"anchor":{"row":0,"col":4}} +{"name":"search-repeat-word-normal","text":"one oneself one\n","mode":"normal","cursor":{"row":0,"col":14},"anchor":{"row":0,"col":12}} +{"name":"search-repeat-word-normal-tty","text":"one oneself one\n","mode":"normal","cursor":{"row":0,"col":14},"anchor":{"row":0,"col":12}} +{"name":"search-repeat-word-extend-wrap","text":"one one one\n","mode":"select","cursor":{"row":0,"col":6},"anchor":{"row":0,"col":4},"sels":[{"cursor":{"row":0,"col":2},"anchor":{"row":0,"col":0}},{"cursor":{"row":0,"col":6},"anchor":{"row":0,"col":4}},{"cursor":{"row":0,"col":10},"anchor":{"row":0,"col":8}}],"primary":1} +{"name":"search-repeat-word-extend-wrap-tty","text":"one one one\n","mode":"select","cursor":{"row":0,"col":6},"anchor":{"row":0,"col":4},"sels":[{"cursor":{"row":0,"col":2},"anchor":{"row":0,"col":0}},{"cursor":{"row":0,"col":6},"anchor":{"row":0,"col":4}},{"cursor":{"row":0,"col":10},"anchor":{"row":0,"col":8}}],"primary":1} +{"name":"search-repeat-word-reverse-wrap","text":"one one one\n","mode":"normal","cursor":{"row":0,"col":10},"anchor":{"row":0,"col":8}} +{"name":"search-repeat-word-reverse-wrap-tty","text":"one one one\n","mode":"normal","cursor":{"row":0,"col":10},"anchor":{"row":0,"col":8}} +{"name":"search-repeat-unicode-boundary","text":"界 界界 界\n","mode":"normal","cursor":{"row":0,"col":7},"anchor":{"row":0,"col":3}} +{"name":"search-repeat-unicode-boundary-tty","text":"界 界界 界\n","mode":"normal","cursor":{"row":0,"col":7},"anchor":{"row":0,"col":3}} +{"name":"search-repeat-unicode-alternatives","text":"界 語 界 語\n","mode":"normal","cursor":{"row":0,"col":4},"anchor":{"row":0,"col":4},"sels":[{"cursor":{"row":0,"col":4},"anchor":{"row":0,"col":4}},{"cursor":{"row":0,"col":8},"anchor":{"row":0,"col":8}},{"cursor":{"row":0,"col":12},"anchor":{"row":0,"col":12}}],"primary":0} +{"name":"search-repeat-unicode-alternatives-tty","text":"界 語 界 語\n","mode":"normal","cursor":{"row":0,"col":4},"anchor":{"row":0,"col":4},"sels":[{"cursor":{"row":0,"col":4},"anchor":{"row":0,"col":4}},{"cursor":{"row":0,"col":8},"anchor":{"row":0,"col":8}},{"cursor":{"row":0,"col":12},"anchor":{"row":0,"col":12}}],"primary":0} +{"name":"search-repeat-multisel-extend","text":"one two one two\n","mode":"select","cursor":{"row":0,"col":6},"anchor":{"row":0,"col":4},"sels":[{"cursor":{"row":0,"col":2},"anchor":{"row":0,"col":0}},{"cursor":{"row":0,"col":6},"anchor":{"row":0,"col":4}},{"cursor":{"row":0,"col":10},"anchor":{"row":0,"col":8}},{"cursor":{"row":0,"col":14},"anchor":{"row":0,"col":12}}],"primary":1} +{"name":"search-repeat-multisel-extend-tty","text":"one two one two\n","mode":"select","cursor":{"row":0,"col":6},"anchor":{"row":0,"col":4},"sels":[{"cursor":{"row":0,"col":2},"anchor":{"row":0,"col":0}},{"cursor":{"row":0,"col":6},"anchor":{"row":0,"col":4}},{"cursor":{"row":0,"col":10},"anchor":{"row":0,"col":8}},{"cursor":{"row":0,"col":14},"anchor":{"row":0,"col":12}}],"primary":1} +{"name":"search-repeat-backward-zero","text":"abc abc\n","mode":"normal","cursor":{"row":0,"col":7},"anchor":{"row":0,"col":7}} +{"name":"search-repeat-backward-zero-tty","text":"abc abc\n","mode":"normal","cursor":{"row":0,"col":7},"anchor":{"row":0,"col":7}} +{"name":"search-repeat-adjacent","text":"aaa\n","mode":"normal","cursor":{"row":0,"col":0},"anchor":{"row":0,"col":0}} +{"name":"search-repeat-adjacent-tty","text":"aaa\n","mode":"normal","cursor":{"row":0,"col":0},"anchor":{"row":0,"col":0}} +{"name":"search-repeat-direction-extend","text":"one one one\n","mode":"select","cursor":{"row":0,"col":4},"anchor":{"row":0,"col":6},"sels":[{"cursor":{"row":0,"col":0},"anchor":{"row":0,"col":2}},{"cursor":{"row":0,"col":4},"anchor":{"row":0,"col":6}}],"primary":1} +{"name":"search-repeat-direction-extend-tty","text":"one one one\n","mode":"select","cursor":{"row":0,"col":4},"anchor":{"row":0,"col":6},"sels":[{"cursor":{"row":0,"col":0},"anchor":{"row":0,"col":2}},{"cursor":{"row":0,"col":4},"anchor":{"row":0,"col":6}}],"primary":1} diff --git a/test/hxcases/golf-waivers.jsonl b/test/hxcases/golf-waivers.jsonl index eb1f824b..e69de29b 100644 --- a/test/hxcases/golf-waivers.jsonl +++ b/test/hxcases/golf-waivers.jsonl @@ -1,7 +0,0 @@ -{"name":"golf-reverse-golf-example-07","reason":"pardes n/N/* are the acme look ring, by decision: \"\"N, n and * do not walk the search register","reference":{"name":"golf-reverse-golf-example-07","text":"# snake_case to snake_case\n\nRename all fields to be camelCase.\n\n## Before\n\n```js\nconst user_profile = {first_name: \"John\"};\n```\n\n## After\n\n```js\nconst userProfile = {firstName: \"John\"};\n```\n","mode":"select","cursor":{"row":0,"col":2},"anchor":{"row":0,"col":11},"sels":[{"cursor":{"row":0,"col":2},"anchor":{"row":0,"col":11}},{"cursor":{"row":0,"col":16},"anchor":{"row":0,"col":25}}],"primary":0},"expected":{"name":"golf-reverse-golf-example-07","text":"# snake_case to snake_case\n\nRename all fields to be camelCase.\n\n## Before\n\n```js\nconst user_profile = {first_name: \"John\"};\n```\n\n## After\n\n```js\nconst userProfile = {firstName: \"John\"};\n```\n","mode":"select","cursor":{"row":0,"col":16},"anchor":{"row":0,"col":25}}} -{"name":"golf-reverse-golf-example-08","reason":"pardes n/N/* are the acme look ring, by decision: \"\"N, n and * do not walk the search register","reference":{"name":"golf-reverse-golf-example-08","text":"# snake_case to snake_case\n\nRename all fields to be camelCase.\n\n## Before\n\n```js\nconst user_profile = {first_name: \"John\"};\n```\n\n## After\n\n```js\nconst userProfile = {firstName: \"John\"};\n```\n","mode":"select","cursor":{"row":2,"col":24},"anchor":{"row":2,"col":32},"sels":[{"cursor":{"row":0,"col":2},"anchor":{"row":0,"col":11}},{"cursor":{"row":0,"col":16},"anchor":{"row":0,"col":25}},{"cursor":{"row":2,"col":24},"anchor":{"row":2,"col":32}}],"primary":2},"expected":{"name":"golf-reverse-golf-example-08","text":"# snake_case to snake_case\n\nRename all fields to be camelCase.\n\n## Before\n\n```js\nconst user_profile = {first_name: \"John\"};\n```\n\n## After\n\n```js\nconst userProfile = {firstName: \"John\"};\n```\n","mode":"select","cursor":{"row":0,"col":16},"anchor":{"row":0,"col":25}}} -{"name":"golf-reverse-golf-example-09","reason":"pardes n/N/* are the acme look ring, by decision: \"\"N, n and * do not walk the search register","reference":{"name":"golf-reverse-golf-example-09","text":"# camelCase to snake_case\n\nRename all fields to be snake_case.\n\n## Before\n\n```js\nconst user_profile = {first_name: \"John\"};\n```\n\n## After\n\n```js\nconst userProfile = {firstName: \"John\"};\n```\n","mode":"select","cursor":{"row":0,"col":2},"anchor":{"row":0,"col":10},"sels":[{"cursor":{"row":0,"col":2},"anchor":{"row":0,"col":10}},{"cursor":{"row":0,"col":15},"anchor":{"row":0,"col":24}},{"cursor":{"row":2,"col":24},"anchor":{"row":2,"col":33}}],"primary":0},"expected":{"name":"golf-reverse-golf-example-09","text":"# snake_case to snake_case\n\nRename all fields to be camelCase.\n\n## Before\n\n```js\nconst user_profile = {first_name: \"John\"};\n```\n\n## After\n\n```js\nconst userProfile = {firstName: \"John\"};\n```\n","mode":"select","cursor":{"row":0,"col":16},"anchor":{"row":0,"col":25}}} -{"name":"golf-reverse-golf-example-10","reason":"pardes n/N/* are the acme look ring, by decision: \"\"N, n and * do not walk the search register","reference":{"name":"golf-reverse-golf-example-10","text":"# camelCase to snake_case\n\nRename all fields to be snake_case.\n\n## Before\n\n```js\nconst user_profile = {first_name: \"John\"};\n```\n\n## After\n\n```js\nconst userProfile = {firstName: \"John\"};\n```\n","mode":"select","cursor":{"row":14,"col":3},"anchor":{"row":0,"col":0}},"expected":{"name":"golf-reverse-golf-example-10","text":"# snake_case to snake_case\n\nRename all fields to be camelCase.\n\n## Before\n\n```js\nconst user_profile = {first_name: \"John\"};\n```\n\n## After\n\n```js\nconst userProfile = {firstName: \"John\"};\n```\n","mode":"select","cursor":{"row":14,"col":3},"anchor":{"row":0,"col":0}}} -{"name":"golf-reverse-golf-example-11","reason":"pardes n/N/* are the acme look ring, by decision: \"\"N, n and * do not walk the search register","reference":{"name":"golf-reverse-golf-example-11","text":"# camelCase to snake_case\n\nRename all fields to be snake_case.\n\n## Before\n\n```js\nconst user_profile = {first_name: \"John\"};\n```\n\n## After\n\n```js\nconst userProfile = {firstName: \"John\"};\n```\n","mode":"select","cursor":{"row":6,"col":3},"anchor":{"row":6,"col":0},"sels":[{"cursor":{"row":6,"col":3},"anchor":{"row":6,"col":0}},{"cursor":{"row":12,"col":3},"anchor":{"row":12,"col":0}}],"primary":0},"expected":{"name":"golf-reverse-golf-example-11","text":"# snake_case to snake_case\n\nRename all fields to be camelCase.\n\n## Before\n\n```js\nconst user_profile = {first_name: \"John\"};\n```\n\n## After\n\n```js\nconst userProfile = {firstName: \"John\"};\n```\n","mode":"select","cursor":{"row":6,"col":3},"anchor":{"row":6,"col":0},"sels":[{"cursor":{"row":6,"col":3},"anchor":{"row":6,"col":0}},{"cursor":{"row":12,"col":3},"anchor":{"row":12,"col":0}}],"primary":0}} -{"name":"golf-reverse-golf-example-12","reason":"pardes n/N/* are the acme look ring, by decision: \"\"N, n and * do not walk the search register","reference":{"name":"golf-reverse-golf-example-12","text":"# camelCase to snake_case\n\nRename all fields to be snake_case.\n\n## Before\n\n```js\nconst user_profile = {first_name: \"John\"};\n```\n\n## After\n\n```js\nconst userProfile = {firstName: \"John\"};\n```\n","mode":"select","cursor":{"row":7,"col":41},"anchor":{"row":6,"col":0},"sels":[{"cursor":{"row":7,"col":41},"anchor":{"row":6,"col":0}},{"cursor":{"row":13,"col":39},"anchor":{"row":12,"col":0}}],"primary":0},"expected":{"name":"golf-reverse-golf-example-12","text":"# snake_case to snake_case\n\nRename all fields to be camelCase.\n\n## Before\n\n```js\nconst user_profile = {first_name: \"John\"};\n```\n\n## After\n\n```js\nconst userProfile = {firstName: \"John\"};\n```\n","mode":"select","cursor":{"row":7,"col":41},"anchor":{"row":6,"col":0},"sels":[{"cursor":{"row":7,"col":41},"anchor":{"row":6,"col":0}},{"cursor":{"row":13,"col":39},"anchor":{"row":12,"col":0}}],"primary":0}} -{"name":"golf-reverse-golf-example","reason":"pardes n/N/* are the acme look ring, by decision: \"\"N, n and * do not walk the search register","reference":{"name":"golf-reverse-golf-example","text":"# camelCase to snake_case\n\nRename all fields to be snake_case.\n\n## Before\n\n```js\nconst userProfile = {firstName: \"John\"};\n```\n\n## After\n\n```js\nconst user_profile = {first_name: \"John\"};\n```\n","mode":"select","cursor":{"row":13,"col":41},"anchor":{"row":12,"col":0},"sels":[{"cursor":{"row":7,"col":39},"anchor":{"row":6,"col":0}},{"cursor":{"row":13,"col":41},"anchor":{"row":12,"col":0}}],"primary":1},"expected":{"name":"golf-reverse-golf-example","text":"# snake_case to snake_case\n\nRename all fields to be camelCase.\n\n## Before\n\n```js\nconst userProfile = {firstName: \"John\"};\n```\n\n## After\n\n```js\nconst user_profile = {first_name: \"John\"};\n```\n","mode":"select","cursor":{"row":13,"col":41},"anchor":{"row":12,"col":0},"sels":[{"cursor":{"row":7,"col":39},"anchor":{"row":6,"col":0}},{"cursor":{"row":13,"col":41},"anchor":{"row":12,"col":0}}],"primary":1}} diff --git a/test/output.zig b/test/output.zig index 51d620c0..6ea6f6fa 100644 --- a/test/output.zig +++ b/test/output.zig @@ -219,11 +219,11 @@ test "reference Look selects the next sorted row from the captured request and k try std.testing.expectEqual(results.serial, p.look_walk_owner.?); try std.testing.expectEqual(@as(i32, 3), results.look_at.?.row); const available = p.freeSlot(); - p.update(.{ .key = .{ .cp = 'n' } }); + lookKey(p, 'n'); try std.testing.expectEqual(rid, p.active); try std.testing.expectEqual(@as(i32, 4), results.body.cur_row); try std.testing.expectEqual(available, p.freeSlot()); - p.update(.{ .key = .{ .cp = 'N' } }); + lookKey(p, 'N'); try std.testing.expectEqual(@as(i32, 3), results.body.cur_row); p.active = 0; @@ -791,7 +791,7 @@ fn selectedOutputText(pane: *const pardes.Pane) ?[]const u8 { return line[lo..@min(line.len, hi + 1)]; } -test "n/N in ordinary text skips comment slashes and retains real paths" { +test "LookNext/LookPrev in ordinary text skips comment slashes and retains real paths" { if (platform == .web) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 20 }); defer p.deinit(); @@ -808,7 +808,7 @@ test "n/N in ordinary text skips comment slashes and retains real paths" { .{ .key = 'N', .row = 4, .text = "/tmp" }, .{ .key = 'N', .row = 3, .text = "/" }, }) |step| { - p.update(.{ .key = .{ .cp = step.key } }); + lookKey(p, step.key); try std.testing.expectEqual(@as(usize, 0), p.active); try std.testing.expectEqual(step.row, pane.body.cur_row); try std.testing.expectEqualStrings(step.text, selectedOutputText(pane) orelse ""); @@ -816,7 +816,7 @@ test "n/N in ordinary text skips comment slashes and retains real paths" { } } -test "n/N skips formatted context and selects comment match locations" { +test "LookNext/LookPrev skips formatted context and selects comment match locations" { if (!pardes.syntax.enabled) return error.SkipZigTest; for ([_]panes.Output.Origin{ .search, .{ .query = .references } }) |origin| { for ([_]bool{ false, true }) |tslocations| { @@ -860,7 +860,7 @@ test "n/N skips formatted context and selects comment match locations" { .{ .key = 'N', .match = 1 }, .{ .key = 'N', .match = 0 }, }) |step| { - p.update(.{ .key = .{ .cp = step.key } }); + lookKey(p, step.key); try std.testing.expectEqual(id, p.active); const row = matches[step.match]; try std.testing.expectEqual(@as(i32, @intCast(row)), result.body.cur_row); @@ -876,9 +876,9 @@ test "n/N skips formatted context and selects comment match locations" { // The dot came back on the match it was on (the first), so the // walk goes on from there. try std.testing.expectEqual(@as(i32, @intCast(matches[0])), restored_result.body.cur_row); - restored.update(.{ .key = .{ .cp = 'n' } }); + lookKey(restored, 'n'); try std.testing.expectEqual(@as(i32, @intCast(matches[1])), restored_result.body.cur_row); - restored.update(.{ .key = .{ .cp = 'N' } }); + lookKey(restored, 'N'); try std.testing.expectEqual(@as(i32, @intCast(matches[0])), restored_result.body.cur_row); const restored_file = &restored_result.file.?; const last = modal.lineSlice(restored_file.content, matches[0]); @@ -887,7 +887,7 @@ test "n/N skips formatted context and selects comment match locations" { } } -test "n/N selects one output location per row and opens nothing" { +test "LookNext/LookPrev selects one output location per row and opens nothing" { if (platform == .web) return; var cwd_buf: [4096]u8 = undefined; var path_buf: [4096]u8 = undefined; @@ -900,20 +900,20 @@ test "n/N selects one output location per row and opens nothing" { const results = p.panes[rid].?; const panes_before = p.freeSlot(); - p.update(.{ .key = .{ .cp = 'n' } }); + lookKey(p, 'n'); try std.testing.expectEqual(rid, p.active); try std.testing.expectEqual(panes_before, p.freeSlot()); try std.testing.expect(results.body.vsel.active and results.body.vsel.explicit); try std.testing.expectEqualStrings("build.zig:1:1", selectedOutputText(results) orelse ""); try std.testing.expectEqual(panes.Output.Grain.line, panes.Output.grain(results.file.?.output)); - p.update(.{ .key = .{ .cp = 'n' } }); + lookKey(p, 'n'); try std.testing.expectEqual(@as(i32, 1), results.body.cur_row); try std.testing.expectEqualStrings("mise.toml", selectedOutputText(results) orelse ""); - p.update(.{ .key = .{ .cp = 'n' } }); + lookKey(p, 'n'); try std.testing.expectEqual(@as(i32, 3), results.body.cur_row); // row 2 is not look-able try std.testing.expectEqualStrings("uucode_config.zig:7:1", selectedOutputText(results) orelse ""); - p.update(.{ .key = .{ .cp = 'n' } }); + lookKey(p, 'n'); try std.testing.expectEqual(@as(i32, 0), results.body.cur_row); // ring seam p.update(.{ .key = .{ .cp = Key.enter } }); @@ -922,7 +922,7 @@ test "n/N selects one output location per row and opens nothing" { try std.testing.expectEqual(panes.Output.Grain.word, panes.Output.grain(p.panes[p.active].?.file.?.output)); } -test "n/N resumes the result output whose Look moved focus away" { +test "LookNext/LookPrev resumes the result output whose Look moved focus away" { if (platform == .web) return; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); @@ -945,10 +945,10 @@ test "n/N resumes the result output whose Look moved focus away" { try std.testing.expect(results.look_at != null); try std.testing.expectEqual(results.serial, p.look_walk_owner orelse return error.MissingLookOwner); - p.update(.{ .key = .{ .cp = 'n' } }); + lookKey(p, 'n'); try std.testing.expectEqual(rid, p.active); try std.testing.expectEqual(first + 1, results.body.cur_row); - p.update(.{ .key = .{ .cp = 'N' } }); + lookKey(p, 'N'); try std.testing.expectEqual(first, results.body.cur_row); // A later no-match answer has no position to resume and therefore cannot @@ -965,7 +965,7 @@ test "n/N resumes the result output whose Look moved focus away" { null, ); try std.testing.expectEqual(owner, p.look_walk_owner.?); - p.update(.{ .key = .{ .cp = 'n' } }); + lookKey(p, 'n'); try std.testing.expectEqual(rid, p.active); try std.testing.expectEqual(first + 1, results.body.cur_row); @@ -981,7 +981,7 @@ test "n/N resumes the result output whose Look moved focus away" { try std.testing.expect(p.paneBySerial(owner) == null); } -test "N exactly reverses n across output panes and the ring seam" { +test "LookPrev exactly reverses LookNext across output panes and the ring seam" { if (platform == .web) return; var cwd_buf: [4096]u8 = undefined; var path_buf: [4096]u8 = undefined; @@ -1002,17 +1002,17 @@ test "N exactly reverses n across output panes and the ring seam" { return .{ .pane = pp.active, .row = pane.body.cur_row, .col = pane.body.cur_col }; } }.at; - p.update(.{ .key = .{ .cp = 'n' } }); + lookKey(p, 'n'); const base = here(p); var trail: [12]Mark = undefined; for (&trail) |*mark| { - p.update(.{ .key = .{ .cp = 'n' } }); + lookKey(p, 'n'); mark.* = here(p); } var i = trail.len; while (i > 0) { i -= 1; - p.update(.{ .key = .{ .cp = 'N' } }); + lookKey(p, 'N'); const want = if (i == 0) base else trail[i - 1]; try std.testing.expectEqual(want, here(p)); } @@ -1068,20 +1068,20 @@ test "Themes lists the ring in sections and skips headings in both directions" { // Opening an imported theme's selector must still begin with the natives. // Walk across the section break without selecting or executing a heading. for (pardes.themes[0 .. brk + 1]) |theme| { - p.update(.{ .key = .{ .cp = 'n' } }); + lookKey(p, 'n'); try std.testing.expectEqual(tid, p.active); const selected = selectedOutputText(list) orelse return error.MissingThemeSection; try std.testing.expectEqualStrings(theme.name, selected["Theme ".len..]); try std.testing.expectEqual(original_theme, p.settings.theme); } - p.update(.{ .key = .{ .cp = 'N' } }); + lookKey(p, 'N'); const previous = selectedOutputText(list) orelse return error.MissingThemeSection; try std.testing.expectEqualStrings(pardes.themes[brk - 1].name, previous["Theme ".len..]); p.update(.{ .key = .{ .cp = Key.tab } }); try std.testing.expectEqual(brk - 1, p.settings.theme); } -test "n/N selects command outputs by whole row" { +test "LookNext/LookPrev selects command outputs by whole row" { if (platform == .web) return; var cwd_buf: [4096]u8 = undefined; var path_buf: [4096]u8 = undefined; @@ -1094,18 +1094,18 @@ test "n/N selects command outputs by whole row" { const tid = p.panes[p.active].?.search_pane orelse return error.MissingThemeList; const themes = p.panes[tid].?; try std.testing.expect(panes.Output.fileTraits(themes.file.?.output).commands); - p.update(.{ .key = .{ .cp = 'n' } }); + lookKey(p, 'n'); const row0 = std.mem.trimEnd(u8, modal.lineSlice(themes.file.?.content, 1), " \t\r"); try std.testing.expectEqualStrings(row0, selectedOutputText(themes) orelse ""); const theme_before = p.settings.theme; - p.update(.{ .key = .{ .cp = 'n' } }); + lookKey(p, 'n'); p.update(.{ .key = .{ .cp = Key.tab } }); try std.testing.expect(p.settings.theme != theme_before); try std.testing.expect(p.executeBuiltinLine(0, "Look build.zig")); p.update(.tick); try std.testing.expect(p.active != 0); - p.update(.{ .key = .{ .cp = 'n' } }); + lookKey(p, 'n'); try std.testing.expectEqual(@as(usize, 0), p.active); } @@ -1661,7 +1661,7 @@ test "stacked search and LSP results retain source tint navigation and dump owne pane.body.mode = .normal; pardes.look.armLookWalk(p, id); for ([_]struct { key: u21, match: usize }{ .{ .key = 'n', .match = 0 }, .{ .key = 'n', .match = 1 }, .{ .key = 'N', .match = 0 } }) |step| { - p.update(.{ .key = .{ .cp = step.key } }); + lookKey(p, step.key); try std.testing.expectEqual(@as(i32, @intCast(matches[step.match])), pane.body.cur_row); const row = file.location_rows[matches[step.match]]; const line = modal.lineSlice(file.content, matches[step.match]); @@ -1686,9 +1686,9 @@ test "stacked search and LSP results retain source tint navigation and dump owne // The dot came back on the match it was on; the walk goes on // from it both ways, N wrapping to the last as it does live. try std.testing.expectEqual(@as(i32, @intCast(matches[0])), restored.panes[id].?.body.cur_row); - restored.update(.{ .key = .{ .cp = 'N' } }); + lookKey(restored, 'N'); try std.testing.expectEqual(@as(i32, @intCast(matches[1])), restored.panes[id].?.body.cur_row); - restored.update(.{ .key = .{ .cp = 'n' } }); + lookKey(restored, 'n'); try std.testing.expectEqual(@as(i32, @intCast(matches[0])), restored.panes[id].?.body.cur_row); try std.testing.expectEqualStrings(source_text, source.file.?.content); } @@ -1833,3 +1833,8 @@ test "location cache eviction retains early colors and honors disk and unsaved r try std.testing.expectEqual(@intFromEnum(pardes.syntax.Syn.comment), try Color.valueColor(file)); try std.testing.expectEqualStrings(comment, source.file.?.content); } + +fn lookKey(p: *Pardes, key: u21) void { + for ([_]u21{ ' ', 'j', if (key == 'N') 'p' else 'n' }) |cp| + p.update(.{ .key = .{ .cp = cp } }); +} diff --git a/test/snapshots/builtins.snap b/test/snapshots/builtins.snap index 849c83d3..8ae22a62 100644 --- a/test/snapshots/builtins.snap +++ b/test/snapshots/builtins.snap @@ -37,7 +37,7 @@ wait 10000 Theme stable 700 15000 # n moves through look-able text; it must not execute command names. -key n n n +key space j n space j n space j n wait 10000 Look enter, right-click wait 10000 Exec tab, middle-click key space w ? diff --git a/test/snapshots/find.snap b/test/snapshots/find.snap index 20a5e36f..b2e36973 100644 --- a/test/snapshots/find.snap +++ b/test/snapshots/find.snap @@ -41,25 +41,25 @@ stable 700 15000 snap results # n SELECTS row 1 and Enter looks it — a path, so the file OPENS, under the # list's text, and each file after it under the one before. -key n +key space j n key enter wait 10000 beta body stable 700 15000 snap first snapstyle first -key n +key space j n key enter wait 10000 gamma body stable 700 15000 snap second -key n +key space j n key enter wait 10000 alpha body stable 700 15000 snap third # N walks back up one row; Enter looks it, and the file is already open, so # the look just focuses it -key N +key space j p key enter stable 700 15000 snap back @@ -92,7 +92,7 @@ stable 700 10000 # rather than one buffer's rows: with nothing look-able here it carries on # into the list that DOES have some — the zqm one — and resumes it one row # past where the N above left it. Nothing opens; only the selection moved. -key n +key space j n stable 400 5000 snap nomatch # ... and asking for `zqm` AGAIN re-arms the list it ALREADY filled instead of diff --git a/test/snapshots/fsearch.snap b/test/snapshots/fsearch.snap index b050f1db..431e7126 100644 --- a/test/snapshots/fsearch.snap +++ b/test/snapshots/fsearch.snap @@ -49,16 +49,16 @@ snap results snapstyle results # n/N walk on from there, one row of the list per press, Enter looking what # the step selected -key n +key space j n key enter stable 700 15000 snap second -key n +key space j n key enter stable 700 15000 snap third # N walks back up to result 2 (line 6), Enter looks it -key N +key space j p key enter stable 700 15000 snap back @@ -75,6 +75,6 @@ key / text zzqq key enter stable 700 10000 -key n +key space j n stable 400 5000 snap nomatch diff --git a/test/snapshots/grep.snap b/test/snapshots/grep.snap index 07777e67..b3ce2947 100644 --- a/test/snapshots/grep.snap +++ b/test/snapshots/grep.snap @@ -55,16 +55,16 @@ stable 700 15000 snap results # n selects the first row and Enter looks it: absolute path, line 1, columns # 7..12 (`TARGET`), and those six cells come up selected -key n +key space j n key enter stable 700 15000 snap first # ...and stepping on into sub/b.txt, then looking it, opens the file nothing # had open -key n +key space j n key enter stable 700 15000 -key n +key space j n key enter wait 10000 TARGET inside sub stable 700 15000 @@ -88,7 +88,7 @@ stable 400 5000 text zzqq key enter stable 700 10000 -key n +key space j n stable 400 5000 snap nomatch # the acme chord: a builtin executed with a SELECTION held takes it as the diff --git a/test/snapshots/jumps.snap b/test/snapshots/jumps.snap index 9ba0139d..f8d69d2a 100644 --- a/test/snapshots/jumps.snap +++ b/test/snapshots/jumps.snap @@ -85,26 +85,26 @@ snap jumplist # An `@pN` row moves focus like any other, which it did not use to: the STEP # only selects now, and the look Enter runs goes to the pane by the same route # a path takes. -key n +key space j n key enter stable 700 15000 snap step1-shell snapstyle step1-shell # on to row 2 — one press, the directory on row 1 is no longer a stop of its own -key n +key space j n key enter stable 700 15000 snap step2-file # row 3 is the shell again, then row 4 -key n +key space j n stable 400 5000 -key n +key space j n key enter stable 700 15000 snap step4-line100 # N is the exact inverse: one press back onto row 3's location, and Enter # follows it to the shell -key N +key space j p key enter stable 700 15000 snap step-back diff --git a/test/snapshots/lookrange.snap b/test/snapshots/lookrange.snap index 50ef9ad3..eb1db60a 100644 --- a/test/snapshots/lookrange.snap +++ b/test/snapshots/lookrange.snap @@ -65,13 +65,13 @@ stable 700 15000 snap hit1 snapstyle hit1 # n selects the next row, and the Enter after it goes to that hit -key n +key space j n key enter stable 700 15000 snap hit2 snapstyle hit2 # N walks back onto the first hit; Enter looks it, still selected -key N +key space j p key enter stable 700 15000 snap back diff --git a/test/snapshots/lsp-client.snap b/test/snapshots/lsp-client.snap index 541e7c7f..db94525e 100644 --- a/test/snapshots/lsp-client.snap +++ b/test/snapshots/lsp-client.snap @@ -27,11 +27,11 @@ wait 10000 add(3, 4) stable 700 15000 snap gr-list # step from the selected middle row to the last hit, then return -key n +key space j n key enter stable 700 15000 snap gr-opened -key N +key space j p key enter stable 700 15000 snap gr-back diff --git a/test/snapshots/lsp.snap b/test/snapshots/lsp.snap index 97fcf7ed..123fad93 100644 --- a/test/snapshots/lsp.snap +++ b/test/snapshots/lsp.snap @@ -43,7 +43,7 @@ key l key s stable 700 15000 snap symbols -key n +key space j n key enter stable 700 15000 snap step diff --git a/test/snapshots/lspcomplete.snap b/test/snapshots/lspcomplete.snap index e25c6525..5c76aac8 100644 --- a/test/snapshots/lspcomplete.snap +++ b/test/snapshots/lspcomplete.snap @@ -93,7 +93,7 @@ settle 100 # jump the way a goto with one row does. The first step selects row 1, and the # Enter after it looks that row and lands SELECTING `verdigris` on line 2 of # a.zig. -key n +key space j n key enter stable 700 15000 snap step diff --git a/test/snapshots/lsprelpath.snap b/test/snapshots/lsprelpath.snap index 667c2fc8..a83abf46 100644 --- a/test/snapshots/lsprelpath.snap +++ b/test/snapshots/lsprelpath.snap @@ -46,7 +46,7 @@ key esc settle 100 # An absolute row has to keep resolving — it is the spelling every row had # before this, and the one every hit outside the tree still has. -key n +key space j n key enter stable 700 15000 snap abslook @@ -65,7 +65,7 @@ stable 700 15000 snap subrow key esc settle 100 -key n +key space j n key enter stable 700 15000 snap sublook diff --git a/test/snapshots/psearch.snap b/test/snapshots/psearch.snap index 6e463119..d55fe833 100644 --- a/test/snapshots/psearch.snap +++ b/test/snapshots/psearch.snap @@ -41,12 +41,12 @@ stable 700 15000 snap results snapstyle results # n walks on to the next row, Enter looks it -key n +key space j n key enter stable 700 15000 snap second # N walks back one row, Enter looks it -key N +key space j p key enter stable 700 15000 snap back @@ -58,7 +58,7 @@ key / text zzqq key enter stable 700 10000 -key n +key space j n stable 400 5000 snap nomatch # right-clicking a word that names no file is the same search (acme button 3), diff --git a/test/snapshots/stepgrain.snap b/test/snapshots/stepgrain.snap index 3c4d3e4c..0f555ff8 100644 --- a/test/snapshots/stepgrain.snap +++ b/test/snapshots/stepgrain.snap @@ -36,21 +36,21 @@ wait 10000 sub/b.txt:1:1 stable 700 15000 snap results # one press, one row: the head of row 1... -key n +key space j n stable 400 5000 snap step-row1 snapstyle step-row1 # ...the head of row 2, and NOT the `sub/b.txt` sitting in its matched text — # the cursor column is the assertion -key n +key space j n stable 400 5000 snap step-row2 snapstyle step-row2 # ...row 3, and then the ring comes round to row 1 again -key n +key space j n stable 400 5000 snap step-row3 -key n +key space j n stable 400 5000 snap step-wrap # Back into the file, so the Find below is asked from a pane that is not a @@ -68,7 +68,7 @@ text words key enter wait 10000 two words.txt stable 700 15000 -key n +key space j n stable 400 5000 snap blank-in-path snapstyle blank-in-path diff --git a/test/snapshots/themesel.snap b/test/snapshots/themesel.snap index 1d61bf6a..4c4d2baa 100644 --- a/test/snapshots/themesel.snap +++ b/test/snapshots/themesel.snap @@ -31,53 +31,53 @@ snap list # n selects row 1 whole and Tab runs it: `Theme orchard`, which is already the # boot theme, so only the selection moves. That is the honest first step — an # idempotent command has to be safe to run. -key n +key space j n key tab stable 700 15000 snap step-orchard snapstyle step-orchard # ...and now the theme really does change under the cursor, one row at a time -key n +key space j n key tab stable 700 15000 snap step-dusk snapstyle step-dusk # Selection alone can skip rows without previewing or applying their themes. # Four steps reach atelier, the Acme homage; Tab then applies it. -key n -key n -key n -key n +key space j n +key space j n +key space j n +key space j n key tab stable 700 15000 snap step-atelier snapstyle step-atelier -key n +key space j n key tab stable 700 15000 snap step-forge snapstyle step-forge -key n +key space j n key tab stable 700 15000 snap step-lagoon snapstyle step-lagoon -key n +key space j n key tab stable 700 15000 snap step-solarium snapstyle step-solarium -key n +key space j n key tab stable 700 15000 snap step-spectrum snapstyle step-spectrum -key n +key space j n key tab stable 700 15000 snap step-harvest snapstyle step-harvest -key n +key space j n key tab stable 700 15000 snap step-clay @@ -85,37 +85,37 @@ snapstyle step-clay # The three native contrast variants precede acme, lapis and lapis_plain, and then the first # ported family's section. Its heading # and blank separator are not stops in the n/N command walk. -key n +key space j n key tab stable 700 15000 snap step-forge-black snapstyle step-forge-black -key n +key space j n key tab stable 700 15000 snap step-forge-soft snapstyle step-forge-soft -key n +key space j n key tab stable 700 15000 snap step-orchard-black snapstyle step-orchard-black -key n +key space j n key tab stable 700 15000 snap step-acme snapstyle step-acme -key n +key space j n key tab stable 700 15000 snap step-lapis snapstyle step-lapis -key n +key space j n key tab stable 700 15000 snap step-lapis-plain snapstyle step-lapis-plain -key n +key space j n key tab stable 700 15000 snap step-dark-plus @@ -124,14 +124,14 @@ snapstyle step-dark-plus # its blank line are skipped like the first. (The imported half, past the # legacy section, is sorted by name, so the ring is the same everywhere # whatever order the directory read handed the files over in.) -key n +key space j n key tab stable 700 15000 snap step-solarized-dark snapstyle step-solarized-dark # N walks back the same way — it is the exact inverse of n — and the Tab after # it runs the row it lands on, so the theme rewinds too -key N +key space j p key tab stable 700 15000 snap step-back diff --git a/test/snapshots/ttylook.snap b/test/snapshots/ttylook.snap index 91401a64..62760ae6 100644 --- a/test/snapshots/ttylook.snap +++ b/test/snapshots/ttylook.snap @@ -17,16 +17,16 @@ wait 8000 big.txt stable 700 20000 # first n: cursor sits at the shell prompt below the output — wrap lands on # the ls row's first token, big.txt; nothing opens -key n +key space j n stable 400 5000 snap tok1 snapstyle tok1 # same row, next token: plain.txt -key n +key space j n stable 400 5000 snap tok2 # N steps back to big.txt -key N +key space j p stable 400 5000 snap tokback # insert-mode n still types (a run splice), no stepping; undo it @@ -39,9 +39,9 @@ snap insert key u stable 400 5000 # resume the walk from big.txt's start: plain.txt, then sub -key n +key space j n stable 400 5000 -key n +key space j n stable 400 5000 snap tok3 # Return looks the selected dir: a shell opens below in sub and ls's it @@ -52,7 +52,7 @@ snap diropen # spined on the panes that have LOOKED, so the step leaves this shell for the # one it was looked out of. That pane's cursor is on its last token (`sub`), # so the walk runs off the end and comes round to its first — big.txt. -key n +key space j n stable 400 5000 snap noop # back in the first pane, Enter with the cursor ON a token looks it (no -- cgit v1.3 From 1ecb9b720840ea8e4753823fa8cddcf5d6a3a4d2 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 8 Oct 2026 12:03:46 -0300 Subject: Add a readable static Callstack pane and align tagline text --- docs/typ/builtins-gui.json | 6 + docs/typ/builtins-tty.json | 6 + docs/typ/guide.typ | 33 +++- docs/typ/reference.typ | 10 ++ src/CHANGELOG.md | 15 ++ src/File.zig | 82 ++++++--- src/Output.zig | 79 +++++++-- src/body_layer.zig | 42 ++--- src/builtins.zig | 13 +- src/colors.zig | 10 +- src/config.zig | 46 ++++- src/draw.zig | 18 +- src/dump.zig | 4 +- src/edit.zig | 4 +- src/exec.zig | 16 +- src/host_io.zig | 12 ++ src/layout.zig | 22 +++ src/locations.zig | 179 +++++++++++++++++++- src/look.zig | 17 +- src/lsp/lsp.zig | 10 +- src/lsp/lsp_client.zig | 263 +++++++++++++++++++++++++++-- src/modal.zig | 4 +- src/mouse.zig | 26 ++- src/ninep/ctl.zig | 22 ++- src/normal.zig | 3 +- src/panes.zig | 9 +- src/pardes.zig | 81 +++++++-- src/syntax.zig | 17 +- src/tagline.zig | 19 ++- test/column_drag.zig | 14 +- test/hxcases/waivers.jsonl | 1 + test/panes.zig | 151 ++++++++++++++++- test/snapshots/argv.golden | 26 +-- test/snapshots/badutf.golden | 14 +- test/snapshots/boot.golden | 12 +- test/snapshots/builtins.golden | 10 +- test/snapshots/builtins.snap | 2 + test/snapshots/callstack-inline.golden | 65 +++++++ test/snapshots/callstack-inline.snap | 30 ++++ test/snapshots/callstack.golden | 27 +++ test/snapshots/callstack.snap | 19 +++ test/snapshots/chordcut.golden | 40 ++--- test/snapshots/cmdexit.golden | 10 +- test/snapshots/cmdword.golden | 18 +- test/snapshots/colgrip.golden | 42 ++--- test/snapshots/collapse.golden | 20 +-- test/snapshots/cornerdrag-left.golden | 62 +++---- test/snapshots/cornerdrag.golden | 90 +++++----- test/snapshots/cursorline.golden | 20 +-- test/snapshots/delask.golden | 14 +- test/snapshots/diffview.golden | 32 ++-- test/snapshots/dirpane.golden | 10 +- test/snapshots/doccol.golden | 20 +-- test/snapshots/edit.golden | 24 +-- test/snapshots/emptycol.golden | 20 +-- test/snapshots/exec-bigdrag.golden | 8 +- test/snapshots/exec.golden | 8 +- test/snapshots/fileedit.golden | 10 +- test/snapshots/filewatch.golden | 10 +- test/snapshots/find.golden | 24 +-- test/snapshots/fsearch.golden | 26 +-- test/snapshots/ghostty-mid.golden | 12 +- test/snapshots/grep.golden | 16 +- test/snapshots/headersweep-restored.golden | 40 ++--- test/snapshots/headersweep.golden | 46 ++--- test/snapshots/hscroll.golden | 16 +- test/snapshots/images.golden | 42 ++--- test/snapshots/jumps.golden | 20 +-- test/snapshots/layout-close.golden | 62 +++---- test/snapshots/layout-open.golden | 32 ++-- test/snapshots/leader.golden | 44 +++-- test/snapshots/load.golden | 24 +-- test/snapshots/logquiet.golden | 6 +- test/snapshots/look-center.golden | 10 +- test/snapshots/look-dir.golden | 16 +- test/snapshots/look-file-1col.golden | 8 +- test/snapshots/look-file.golden | 20 +-- test/snapshots/lookloaded.golden | 20 +-- test/snapshots/lookpanes.golden | 52 +++--- test/snapshots/lookrange.golden | 20 +-- test/snapshots/lsp-client-edit.golden | 12 +- test/snapshots/lsp-client.golden | 10 +- test/snapshots/lsp-rename-files.golden | 10 +- test/snapshots/lsp-rename.golden | 10 +- test/snapshots/lsp.golden | 10 +- test/snapshots/lspcomplete.golden | 34 ++-- test/snapshots/lspcompletemoved.golden | 6 +- test/snapshots/lspdebug.golden | 6 +- test/snapshots/lsprelpath.golden | 40 ++--- test/snapshots/markup.golden | 24 +-- test/snapshots/mini.golden | 56 +++--- test/snapshots/modal.golden | 24 +-- test/snapshots/msg.golden | 14 +- test/snapshots/multicursor.golden | 24 +-- test/snapshots/nested-optout.golden | 32 ++-- test/snapshots/nested.golden | 28 +-- test/snapshots/ninep.golden | 56 +++--- test/snapshots/pagercolor.golden | 42 +++-- test/snapshots/pipe.golden | 10 +- test/snapshots/psearch.golden | 26 +-- test/snapshots/reflow.golden | 8 +- test/snapshots/respawn.golden | 8 +- test/snapshots/restore.golden | 8 +- test/snapshots/rsearch.golden | 12 +- test/snapshots/savepane.golden | 10 +- test/snapshots/scroll.golden | 24 +-- test/snapshots/scrolloff.golden | 8 +- test/snapshots/selarg.golden | 12 +- test/snapshots/selregex.golden | 16 +- test/snapshots/shellset.golden | 12 +- test/snapshots/shrinktag.golden | 24 +-- test/snapshots/splitparent.golden | 42 ++--- test/snapshots/stepgrain.golden | 20 +-- test/snapshots/syntax.golden | 24 +-- test/snapshots/tag.golden | 22 +-- test/snapshots/tagalign.golden | 60 ++++--- test/snapshots/tagalign2col.golden | 39 +++-- test/snapshots/tagbottom.golden | 26 +-- test/snapshots/tagbottomimage.golden | 22 +-- test/snapshots/tagbottomshort.golden | 34 ++-- test/snapshots/tagcmd.golden | 12 +- test/snapshots/tagnav.golden | 44 ++--- test/snapshots/tagpath.golden | 30 ++-- test/snapshots/theme.golden | 242 +++++++++++++------------- test/snapshots/themesel.golden | 146 ++++++++-------- test/snapshots/tinywin.golden | 60 +++---- test/snapshots/topbarexec.golden | 28 +-- test/snapshots/tty.golden | 18 +- test/snapshots/ttyclick.golden | 16 +- test/snapshots/ttyedit.golden | 16 +- test/snapshots/ttyfollow.golden | 16 +- test/snapshots/ttyhelp.golden | 10 +- test/snapshots/ttylook.golden | 32 ++-- test/snapshots/ttyonly.golden | 16 +- test/snapshots/ttypaste.golden | 12 +- test/snapshots/ttyprompt.golden | 16 +- test/snapshots/ttytaken.golden | 14 +- test/snapshots/tutor.golden | 10 +- test/snapshots/wheeldrift.golden | 6 +- test/snapshots/winch.golden | 24 +-- test/snapshots/windownav.golden | 12 +- test/snapshots/windowops.golden | 84 ++++----- test/snapshots/wrap.golden | 14 +- test/snapshots/yankpaste.golden | 6 +- 144 files changed, 2646 insertions(+), 1596 deletions(-) create mode 100644 test/snapshots/callstack-inline.golden create mode 100644 test/snapshots/callstack-inline.snap create mode 100644 test/snapshots/callstack.golden create mode 100644 test/snapshots/callstack.snap (limited to 'docs/typ') diff --git a/docs/typ/builtins-gui.json b/docs/typ/builtins-gui.json index 83a410dc..f602ee92 100644 --- a/docs/typ/builtins-gui.json +++ b/docs/typ/builtins-gui.json @@ -6,6 +6,10 @@ {"name": "BootShell", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "keep, replace", "doc": "A document dropped where a lone untouched shell stands: keep the shell, or replace it."}, {"name": "Callees", "leader": "SPC l C", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "List the functions the function under the cursor calls."}, {"name": "Callers", "leader": "SPC l c", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "List the callers of the function under the cursor."}, + {"name": "Callstack", "leader": "SPC l b", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Show outermost callers first, with signatures and call sites (gc)."}, + {"name": "CallstackCorners", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "rounded, square", "doc": "Callstack tree corners: rounded (the default) or square; bare, it switches styles. Applies to the next Callstack query."}, + {"name": "CallstackDepth", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "Caller levels collected by Callstack, 1 through 64; default 8. Bare, it says the current limit."}, + {"name": "CallstackLayout", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "inline, stacked", "doc": "Callstack snippets below their locations (stacked, the default) or beside them (inline); bare, it switches layouts. Applies to the next Callstack query."}, {"name": "Changelog", "leader": "SPC h c", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "This build's version and what changed to reach it, printed into an output buffer the same way Config prints the live settings."}, {"name": "ChipShadow", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "In a terminal, a notice chip casts a cell's shadow right and down, on or off."}, {"name": "ClipPaste", "leader": "SPC p", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Paste the system clipboard after the selection."}, @@ -65,6 +69,8 @@ {"name": "Ligatures", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "A font's programming ligatures draw across their cells, on or off."}, {"name": "LocationsConfig", "leader": null, "also": [], "arg": true, "scope": "root", "setting": false, "choices": null, "doc": "Set how location rows are drawn, or show how they are when bare."}, {"name": "Look", "leader": null, "also": ["enter", "right-click"], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Look at its argument: open the file or address it names, else find the word, as a right click does."}, + {"name": "LookNext", "leader": "SPC j n", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Select the next Look location across panes; Enter opens it."}, + {"name": "LookPrev", "leader": "SPC j p", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Select the previous Look location across panes; Enter opens it."}, {"name": "LookWord", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "search, list", "doc": "A plain word looked at: search selects its next place in the pane, list lists every place in a +Search."}, {"name": "Lspinfo", "leader": "SPC l i", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Show which language servers serve this file and their state."}, {"name": "Lspwhy", "leader": "SPC l w", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Explain how the last language server request was answered, step by step."}, diff --git a/docs/typ/builtins-tty.json b/docs/typ/builtins-tty.json index 35e12875..e02f4201 100644 --- a/docs/typ/builtins-tty.json +++ b/docs/typ/builtins-tty.json @@ -5,6 +5,10 @@ {"name": "BootShell", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "keep, replace", "doc": "A document dropped where a lone untouched shell stands: keep the shell, or replace it."}, {"name": "Callees", "leader": "SPC l C", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "List the functions the function under the cursor calls."}, {"name": "Callers", "leader": "SPC l c", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "List the callers of the function under the cursor."}, + {"name": "Callstack", "leader": "SPC l b", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Show outermost callers first, with signatures and call sites (gc)."}, + {"name": "CallstackCorners", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "rounded, square", "doc": "Callstack tree corners: rounded (the default) or square; bare, it switches styles. Applies to the next Callstack query."}, + {"name": "CallstackDepth", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "Caller levels collected by Callstack, 1 through 64; default 8. Bare, it says the current limit."}, + {"name": "CallstackLayout", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "inline, stacked", "doc": "Callstack snippets below their locations (stacked, the default) or beside them (inline); bare, it switches layouts. Applies to the next Callstack query."}, {"name": "Changelog", "leader": "SPC h c", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "This build's version and what changed to reach it, printed into an output buffer the same way Config prints the live settings."}, {"name": "ChipShadow", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "In a terminal, a notice chip casts a cell's shadow right and down, on or off."}, {"name": "ClipPaste", "leader": "SPC p", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Paste the system clipboard after the selection."}, @@ -55,6 +59,8 @@ {"name": "Left", "leader": "SPC w h", "also": ["C-w h", "C-w left"], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Move the keyboard to the pane, or column tag, to the left."}, {"name": "LocationsConfig", "leader": null, "also": [], "arg": true, "scope": "root", "setting": false, "choices": null, "doc": "Set how location rows are drawn, or show how they are when bare."}, {"name": "Look", "leader": null, "also": ["enter", "right-click"], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Look at its argument: open the file or address it names, else find the word, as a right click does."}, + {"name": "LookNext", "leader": "SPC j n", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Select the next Look location across panes; Enter opens it."}, + {"name": "LookPrev", "leader": "SPC j p", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Select the previous Look location across panes; Enter opens it."}, {"name": "LookWord", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "search, list", "doc": "A plain word looked at: search selects its next place in the pane, list lists every place in a +Search."}, {"name": "Lspinfo", "leader": "SPC l i", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Show which language servers serve this file and their state."}, {"name": "Lspwhy", "leader": "SPC l w", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Explain how the last language server request was answered, step by step."}, diff --git a/docs/typ/guide.typ b/docs/typ/guide.typ index 55f8a4f0..7058592f 100644 --- a/docs/typ/guide.typ +++ b/docs/typ/guide.typ @@ -218,10 +218,39 @@ around it, a `+`/`-` before each line, the words a changed line changed tinted and a line added or removed whole faintly. A mailed patch keeps its message and diffstat above. The files are found from the diff's directory or one above it. #word("Diff") on a `+Diff` shows the diff itself as -text (a paged one's `+Pager` is folded under it), and on the text stacks +text (a paged one's `+Pager` is closed once stacked), and on the text stacks it again; #word("DiffLook") `text` in the startup file opens the text first. += Call hierarchy + +Put the cursor on a function and run #word("Callstack") (#key("g c") or #key("SPC l b")). +`+Callstack` starts at the outermost callers and follows calls down toward +the selected function, with shared callers grouped and vertical guides +joining the levels with rounded corners. Each caller has a clickable location and its function +signature, extracted by the same tree-sitter context mechanism as other +location results. Signatures and call-site snippets use source syntax colors; +only calls to the selected function receive background emphasis. Guides +continue alongside every line of a multiline signature and through screen +wrapping. Cross-directory Look paths are shortened when possible. +#btn("B3") or #key("Enter") on a location opens and reveals that source +pane. #word("LookNext") / #word("LookPrev") (#keys("SPC j n", "SPC j p")) +select locations without opening them. The view follows the language +server's static call hierarchy; recursive paths are marked `↻`, and a +large hierarchy invites continuing from another function. +#word("CallstackDepth") reports the current caller depth; +`CallstackDepth 16` changes it for subsequent queries. The default is 8 +levels, and the accepted range is 1–64. The view also caps collection at +64 callers. + +`CallstackLayout stacked` (the default) puts each signature and call snippet below its +location, aligned with the location text; `CallstackLayout inline` puts it +beside the location again. A bare #word("CallstackLayout") switches modes. +`CallstackCorners rounded` (the default) uses rounded tree guides; +`CallstackCorners square` restores sharp corners. Bare #word("CallstackCorners") +switches styles. Layout and corner changes apply to the next query. These settings are retained +by #word("Dump") / #word("Restore"). + = `pardes FILE` and `--wait` In a pane's shell: @@ -242,7 +271,7 @@ refusals and `--nested` are in the reference. [#key("x"), #key("v"), #key(";")], [select the line; extend; collapse to the cursor], [#key("s")], [a cursor per regex match; every edit acts at each], [#key("/"), #keys("n", "N")], [substring search; repeat the search in the current text, wrapping at the ends], - [#keys("Space j n", "Space j p")], [#word("LookNext") / #word("LookPrev"): select locations across panes; #key("Enter") opens one], + [#keys("SPC j n", "SPC j p")], [#word("LookNext") / #word("LookPrev"): select locations across panes; #key("Enter") opens one], [#key("g l")], [line end], [`12G`], [line 12; a bare #key("G") does nothing], [#key("SPC ?")], [#word("Help"): every builtin, with its leader path and keys; `SPC w ?` only the paths under `SPC w`; #word("Tutor") (#key("SPC h t")) practises them], diff --git a/docs/typ/reference.typ b/docs/typ/reference.typ index 909c1e1a..05176951 100644 --- a/docs/typ/reference.typ +++ b/docs/typ/reference.typ @@ -262,6 +262,16 @@ A line written to #file("exec") is #word("Exec"): the server answers in this file alone while another open file of its language still holds the old name, a row per such file (zls renaming at a declaration; from a use it reaches every file); + #word("Callstack") (#key("g c") or #key("SPC l b")) opens and focuses `+Callstack`, + with static caller ancestry, tree-sitter signatures and Look locations + for callers and call sites. #word("CallstackDepth") reports or sets the + runtime depth (1–64, default 8) for subsequent queries. + `CallstackLayout stacked` (the default) aligns snippets below their locations; + `CallstackLayout inline` places the snippets beside them. + `CallstackCorners rounded` (the default) or `CallstackCorners square` + selects the tree corner style for the next query; bare, it switches styles. + #word("Callers") and #word("Callees") keep their short + lists and single-result jumps. #word("Diagnostics") and #word("Symbols") list the file's in `+Search`; #word("Lspinfo") fills `+Lsp`, the pane its write answers, with which server serves the file and its state (`not started yet` until its first diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index e15faca7..4fe0760c 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -2,6 +2,21 @@ ## Unreleased +- Callstack (gc or Space l b) opens a readable static call hierarchy with + outermost callers first, tree-sitter signatures, depth guides and clickable call sites. + `gc` replaces the old move-to-viewport-center binding. + CallstackDepth sets the caller depth at runtime (1–64, default 8). + CallstackLayout stacked is the default, aligning snippets below their + locations with rounded tree corners; inline + keeps them beside the locations. CallstackCorners square restores sharp + tree corners; rounded remains the default. + Signatures use syntax colors; only calls to the queried function get + background emphasis, and tree guides continue through multiline signatures + and wrapped rows. Cross-directory call locations use shorter relative paths. +- Workspace, column and pane tags share a tighter text inset. +- A diff paged into a session (`git show | pardes -`) opens its `+Diff` + alone; the `+Pager` no longer stays folded under it. + - n/N follow Helix search registers, counts, wrapping and select mode. `*` sets a search from the selection; `Alt-*` omits word boundaries. The location ring remains as LookNext/LookPrev (Space j n/p). diff --git a/src/File.zig b/src/File.zig index 31392ebd..c42e39ec 100644 --- a/src/File.zig +++ b/src/File.zig @@ -253,6 +253,8 @@ fn dumpLocationRows(arena: std.mem.Allocator, rows: []const locations.Row) ![]co for (rows, saved) |row, *out| out.* = .{ .kind = @enumFromInt(@intFromEnum(row.kind)), .declaration = row.declaration, + .mark_occurrence = row.mark_occurrence, + .source_column = row.source_column, .path = row.path, .line = row.at.line, .col = row.at.col, @@ -271,6 +273,10 @@ fn sameSavedLocation(a: dump.LocationRow, b: dump.LocationRow) bool { } fn restoreLocationRows(gpa: std.mem.Allocator, content: []const u8, saved: []const dump.LocationRow) ![]locations.Row { + return restoreOutputLocationRows(gpa, content, saved, false); +} + +fn restoreOutputLocationRows(gpa: std.mem.Allocator, content: []const u8, saved: []const dump.LocationRow, callstack: bool) ![]locations.Row { if (saved.len == 0) return &.{}; if (saved.len > std.mem.count(u8, content, "\n") + 1) return error.InvalidLocationRows; const rows = try gpa.alloc(locations.Row, saved.len); @@ -286,29 +292,44 @@ fn restoreLocationRows(gpa: std.mem.Allocator, content: []const u8, saved: []con var previous_line: []const u8 = ""; for (saved, rows, 0..) |row, *out, index| { const line = lines.next() orelse return error.InvalidLocationRows; - if (row.path.len == 0 or row.path.len >= 4096 or + if ((!callstack and row.path.len == 0) or row.path.len >= 4096 or row.location_end > row.code_start or row.code_start > line.len or (row.kind == .match and row.location_end == 0) or (row.declaration and row.kind != .context) or row.line > std.math.maxInt(i32) or row.col > std.math.maxInt(i32) or row.end_line > std.math.maxInt(i32) or row.end_col > std.math.maxInt(i32)) return error.InvalidLocationRows; - const inline_row = row.code_start > row.location_end and row.code_start > 0 and line[row.code_start - 1] == '\t'; - const address_row = !inline_row and row.location_end > 0 and row.code_start == line.len; - const source_row = row.location_end == 0 and row.code_start == 0; - if (!inline_row and !address_row and !source_row) return error.InvalidLocationRows; - if (row.kind == .preview) { - if (!source_row or index == 0) return error.InvalidLocationRows; - const previous = saved[index - 1]; - if (previous.kind != .match or previous.location_end == 0 or previous.code_start != previous_line.len or previous_line[previous_line.len - 1] == '\t' or - !sameSavedLocation(previous, row)) return error.InvalidLocationRows; - } - if (address_row) { - if (index + 1 >= saved.len) return error.InvalidLocationRows; - const following = saved[index + 1]; - const expected: @TypeOf(row.kind) = if (row.kind == .match) .preview else .context; - if (following.kind != expected or following.code_start != 0 or following.location_end != 0 or - following.declaration != row.declaration or !sameSavedLocation(row, following)) return error.InvalidLocationRows; + if (callstack) { + if (row.location_end > 0) { + const prefix = locations.treePrefix(line); + const parsed = locations.parseRaw(line[prefix.end..]); + if (row.kind != .match or parsed.at.line == 0 or + !std.mem.eql(u8, parsed.path, row.path) or + parsed.at.line != row.line or parsed.at.col != row.col or + parsed.at.end_line != row.end_line or parsed.at.end_col != row.end_col or + prefix.end + parsed.end != row.location_end or + prefix.end + parsed.code_start != row.code_start) return error.InvalidLocationRows; + } else if (row.kind == .preview) { + if (index == 0 or saved[index - 1].kind != .match or !sameSavedLocation(saved[index - 1], row)) return error.InvalidLocationRows; + } else if (row.kind != .context or (row.path.len == 0 and (row.line != 0 or row.code_start != line.len))) return error.InvalidLocationRows; + } else { + const inline_row = row.code_start > row.location_end and row.code_start > 0 and line[row.code_start - 1] == '\t'; + const address_row = !inline_row and row.location_end > 0 and row.code_start == line.len; + const source_row = row.location_end == 0 and row.code_start == 0; + if (!inline_row and !address_row and !source_row) return error.InvalidLocationRows; + if (row.kind == .preview) { + if (!source_row or index == 0) return error.InvalidLocationRows; + const previous = saved[index - 1]; + if (previous.kind != .match or previous.location_end == 0 or previous.code_start != previous_line.len or previous_line[previous_line.len - 1] == '\t' or + !sameSavedLocation(previous, row)) return error.InvalidLocationRows; + } + if (address_row) { + if (index + 1 >= saved.len) return error.InvalidLocationRows; + const following = saved[index + 1]; + const expected: @TypeOf(row.kind) = if (row.kind == .match) .preview else .context; + if (following.kind != expected or following.code_start != 0 or following.location_end != 0 or + following.declaration != row.declaration or !sameSavedLocation(row, following)) return error.InvalidLocationRows; + } } const code_len = line.len - row.code_start; if (row.colors_b64.len > std.base64.standard.Encoder.calcSize(code_len)) return error.InvalidLocationRows; @@ -320,6 +341,8 @@ fn restoreLocationRows(gpa: std.mem.Allocator, content: []const u8, saved: []con out.* = .{ .kind = @enumFromInt(@intFromEnum(row.kind)), .declaration = row.declaration, + .mark_occurrence = row.mark_occurrence, + .source_column = row.source_column, .path = path, .at = .{ .line = row.line, .col = row.col, .end_line = row.end_line, .end_col = row.end_col }, .location_end = row.location_end, @@ -992,7 +1015,8 @@ pub fn restore(p: *Pardes, id: usize, src: dump.Pane) !*Pane { } else null; if (saved.location_rows.len != 0 and output == null) return error.InvalidLocationRows; - const location_rows = try restoreLocationRows(p.gpa, content, saved.location_rows); + const is_callstack = if (output) |state| std.meta.eql(state.from, Output.Origin{ .query = .callstack }) else false; + const location_rows = try restoreOutputLocationRows(p.gpa, content, saved.location_rows, is_callstack); errdefer locations.freeRows(p.gpa, location_rows); var mini: ?Mini.State = null; @@ -1707,9 +1731,16 @@ fn fillBody(dst: ?[]u8, pane: *Pane, f: *State, width: usize, record_wrap: bool) const row = if (context) @as(usize, @intCast(pane.wrap_line[i])) else body_line; const at = if (context) 0 else body_at; const text = if (row < total) sourceLine(pane, @intCast(row)) else ""; + var guide_buffer: [1024]u8 = undefined; + const guide = if (at > 0 and width > 1 and f.output != null and + std.meta.eql(f.output.?.from, Output.Origin{ .query = .callstack })) + locations.treeContinuation(text, &guide_buffer, width - 1) + else + ""; + const pad = displayWidth(guide); // Headers use one screen row per source row, preserving signatures // without allowing a long ancestor to consume the whole viewport. - const end = if (width == 0 or context) text.len else fitEnd(text, at, width); + const end = if (width == 0 or context) text.len else fitEnd(text, at, width - pad); const cut = if (pane.hscroll > 0 and width == 0) modal.graphemeStart(text, @min(@as(usize, @intCast(pane.hscroll)), text.len)) else @@ -1717,6 +1748,7 @@ fn fillBody(dst: ?[]u8, pane: *Pane, f: *State, width: usize, record_wrap: bool) if ((width > 0 or pane.context_rows > 0) and record_wrap) { pane.wrap_line[i] = @intCast(row); pane.wrap_col[i] = @intCast(cut); + pane.wrap_pad[i] = @intCast(pad); pane.wrap_n = @intCast(i + 1); } if (row < total) { @@ -1735,6 +1767,8 @@ fn fillBody(dst: ?[]u8, pane: *Pane, f: *State, width: usize, record_wrap: bool) } if (dst) |out| @memcpy(out[written..][0..prefix.len], prefix); written += prefix.len; + if (dst) |out| @memcpy(out[written..][0..guide.len], guide); + written += guide.len; const shown = text[cut..end]; if (dst) |out| @memcpy(out[written..][0..shown.len], shown); written += shown.len; @@ -1935,7 +1969,11 @@ pub fn recolorSyntax(p: *Pardes, s: *Surface, pane: *Pane, f: *State, r: pardes. } }.before); var c: usize = 0; - var screen_c: usize = 0; + const pad: usize = if (vr < pane.wrap_n) pane.wrap_pad[vr] else 0; + for (0..@min(pad, tw -| prefix_width)) |col| { + s.at(tx + @as(u16, @intCast(prefix_width + col)), body_y + vr).style.fg = .{ .rgb = p.bodyChrome().diagnostic_info }; + } + var screen_c: usize = pad; while (hs + c < limit and prefix_width + screen_c < tw) { const grapheme_end = @min(limit, modal.nextGrapheme(line, hs + c)); const cells = graphemeDisplayWidth(line[hs + c .. grapheme_end]); @@ -2218,8 +2256,8 @@ pub fn paintWordSelection( if (next.line == row) hi = @min(hi, next.at); const lo = @max(word_lo, here.at); if (hi <= lo) continue; - const c0 = @as(i32, prefix_width) + displayOffset(pane, row, here.at, lo); - const c1 = @as(i32, prefix_width) + displayEndOffset(pane, row, here.at, hi - 1); + const c0 = @as(i32, prefix_width) + here.pad + displayOffset(pane, row, here.at, lo); + const c1 = @as(i32, prefix_width) + here.pad + displayEndOffset(pane, row, here.at, hi - 1); var col = @max(@as(i32, prefix_width), c0); while (col <= c1 and col < @as(i32, tw)) : (col += 1) { const cell = s.at(tx + @as(u16, @intCast(col)), body_y + @as(u16, @intCast(vr))); diff --git a/src/Output.zig b/src/Output.zig index 9e194615..9ed33ebe 100644 --- a/src/Output.zig +++ b/src/Output.zig @@ -53,13 +53,14 @@ const RowDecoration = struct { location_end: usize = 0, prefix_end: usize = 0, declaration: bool = false, + guide_end: usize = 0, mark_start: usize = 0, mark_end: usize = 0, severity: enum { none, err, warning, info, hint } = .none, /// Nothing in the row is decorated: most rows of most files. pub fn plain(row: RowDecoration) bool { - return !row.declaration and row.location_end == 0 and row.prefix_end == 0 and row.mark_end <= row.mark_start; + return row.guide_end == 0 and !row.declaration and row.location_end == 0 and row.prefix_end == 0 and row.mark_end <= row.mark_start; } /// `chrome` is the theme's own (Pardes.bodyChrome): body paper changes @@ -68,6 +69,7 @@ const RowDecoration = struct { /// working it out takes the contrast searches' pow calls. pub fn styleAt(row: RowDecoration, chrome: *const pardes.ChromeTheme, byte: usize) ?pardes.CellStyle { if (row.plain()) return null; + if (byte < row.guide_end) return .{ .fg = .{ .rgb = chrome.diagnostic_info } }; if (row.declaration or byte < @max(row.location_end, row.prefix_end)) return .{ .fg = .{ .rgb = chrome.lineno } }; if (byte < row.mark_start or byte >= row.mark_end) return null; @@ -91,32 +93,38 @@ fn rowDecoration(output: ?State, line: []const u8) RowDecoration { pub fn decorateRow(output: ?State, line: []const u8, metadata: ?locations.Row) RowDecoration { const origin = (output orelse return .{}).from; + const callstack = std.meta.eql(origin, Origin{ .query = .callstack }); + const prefix = locations.treePrefix(if (callstack) line else ""); + const trimmed = line[prefix.end..]; + const indent = prefix.end; if (!traits(origin).locations) return .{}; - const target = locations.parse(line); + const target = if (callstack) locations.parseRaw(trimmed) else locations.parse(trimmed); const spot = if (metadata) |m| m.at else target.at; if (spot.line == 0) return .{}; var row: RowDecoration = .{ - .location_end = if (metadata) |m| m.location_end else target.end, - .prefix_end = if (metadata) |m| m.code_start else target.end, + .guide_end = indent, + .location_end = if (metadata) |m| m.location_end else indent + target.end, + .prefix_end = if (metadata) |m| m.code_start else indent + target.end, .declaration = if (metadata) |m| m.declaration else false, }; - const source_start = if (metadata) |m| m.code_start else target.code_start; + const source_start = if (metadata) |m| m.code_start else indent + target.code_start; if (source_start >= line.len) return row; if (metadata) |m| if (m.kind == .context) return row; const mark_occurrence = switch (origin) { .search => true, .cmd => |cmd| cmd == .Grep, .query => |kind| switch (kind) { - .definition, .declaration, .type_definition, .implementation, .references => true, + .definition, .declaration, .type_definition, .implementation, .references, .callstack => true, else => false, }, else => false, }; - if (mark_occurrence and spot.col > 0 and spot.end_line == spot.line and + if (mark_occurrence and (if (metadata) |m| m.mark_occurrence else !prefix.branch) and spot.col > 0 and spot.end_line == spot.line and spot.end_col >= spot.col) { - row.mark_start = source_start +| (spot.col - 1); - row.mark_end = @min(line.len, source_start +| spot.end_col); + const source_column = if (metadata) |m| m.source_column else 0; + row.mark_start = source_start +| ((spot.col - 1) -| source_column); + row.mark_end = @min(line.len, source_start +| (spot.end_col -| source_column)); } const is_diagnostic = switch (origin) { .query => |kind| kind == .diagnostics or kind == .workspace_diagnostics, @@ -135,6 +143,25 @@ pub fn decorateRow(output: ?State, line: []const u8, metadata: ?locations.Row) R return row; } +test "callstack guides and Look locations share result decoration" { + const from: State = .{ .from = .{ .query = .callstack } }; + const loc = rowDecoration(from, "└──┬ lib.rs:2:8-10 fn add() {"); + try std.testing.expectEqual(@as(usize, "└──┬ lib.rs:2:8-10".len), loc.location_end); + try std.testing.expect(!loc.declaration); + try std.testing.expect(!usesLocationsConfig(from.from)); + try std.testing.expect(!traits(from.from).jumps); + const call_line = " lib.rs:12:12-20 return calculate(value);"; + const call = rowDecoration(from, call_line); + try std.testing.expectEqualStrings("calculate", call_line[call.mark_start..call.mark_end]); + const reference = rowDecoration(.{ .from = .{ .query = .references } }, call_line[4..]); + try std.testing.expectEqual(reference.mark_start + 4, call.mark_start); + try std.testing.expectEqual(reference.mark_end + 4, call.mark_end); + try std.testing.expectEqual(reference.location_end + 4, call.location_end); + const tab_line = " tab.zig:4:9-11 \treturn run();"; + const tab_call = rowDecoration(from, tab_line); + try std.testing.expectEqualStrings("run", tab_line[tab_call.mark_start..tab_call.mark_end]); +} + test "result decoration follows source byte ranges and diagnostic provenance" { const row = rowDecoration(.{ .from = .search }, "src/a.rs:3:5-7 let abc = 1;"); try std.testing.expectEqualStrings("abc", "src/a.rs:3:5-7 let abc = 1;"[row.mark_start..row.mark_end]); @@ -237,6 +264,7 @@ pub fn traits(o: Origin) Traits { .cmd => |b| builtins.registry.outputTraits(b) orelse unreachable, .query => |k| switch (k) { .hover => .{ .name = config.hover_buffer }, + .callstack => .{ .name = "+Callstack", .steps = true, .locations = true }, // prose: an action list, a diff, a report about the backend .code_action, .format, .status, .explain => .{ .name = config.lsp_buffer }, .rename => .{ .name = config.search_buffer, .steps = true, .locations = true }, @@ -267,7 +295,8 @@ pub fn usesLocationsConfig(from: Origin) bool { const tr = traits(from); return tr.steps and !tr.commands and from != .pdf_links and !std.meta.eql(from, Origin{ .cmd = .Find }) and - !std.meta.eql(from, Origin{ .query = .completion }); + !std.meta.eql(from, Origin{ .query = .completion }) and + !std.meta.eql(from, Origin{ .query = .callstack }); } pub fn fileTraits(out: ?State) Traits { @@ -533,8 +562,11 @@ pub fn fillResults(p: *Pardes, id: usize, dir: []const u8, from: Origin, arg: [] return; } } - if (usesLocationsConfig(from)) { - const formatted = try locations.format(p, dir, content, anchor, true); + if (usesLocationsConfig(from) or std.meta.eql(from, Origin{ .query = .callstack })) { + const formatted = if (std.meta.eql(from, Origin{ .query = .callstack })) + try locations.formatCallstack(p, dir, content) + else + try locations.format(p, dir, content, anchor, true); p.gpa.free(result_content); result_content = formatted.content; result_rows = formatted.rows; @@ -863,7 +895,7 @@ pub fn openThemes(p: *Pardes, id: usize) !void { pub fn isWalkRow(file: *const File.State, row: usize, line: []const u8) bool { const state = file.output orelse return true; - if (usesLocationsConfig(state.from)) return isResultRow(file, row); + if (usesLocationsConfig(state.from) or std.meta.eql(state.from, Origin{ .query = .callstack })) return isResultRow(file, row); if (!std.meta.eql(state.from, Origin{ .cmd = .Themes })) return true; // Section labels are for reading, not stops in the command walk. return std.mem.startsWith(u8, std.mem.trimStart(u8, line, " \t"), comptime config.Runtime.findAction(.theme).?.word ++ " "); @@ -901,11 +933,14 @@ fn openStepped(p: *Pardes, id: usize, from: Origin, content: []u8) !void { fn helpContent(gpa: std.mem.Allocator, prefix: []const u8) ![]u8 { const full_header = "pardes builtins, and how to run each:\nSPC and its keys, a chord, a button, the\ntopbar - or the name, executed anywhere.\n\n"; const group_header = "pardes builtins under SPC"; + const calls_help = "\nCallstack: static caller chains,\nwith signatures and clickable call sites.\nCallers / Callees: one direction at a time.\n"; + const show_calls_help = prefix.len == 0 or std.mem.eql(u8, prefix, "l"); const language_footer = "\nlanguage keys (motions, not words):\n" ++ "gd gD gy gi gr goto: definition,\n" ++ " declaration, type-def,\n" ++ " implementation, refs\n" ++ + "gc Callstack\n" ++ "]d [d ]D [D diagnostics: next,\n" ++ " prev, last, first\n" ++ "= format (applies, one\n" ++ @@ -918,6 +953,7 @@ fn helpContent(gpa: std.mem.Allocator, prefix: []const u8) ![]u8 { full_header.len + language_footer.len else group_header.len + prefix.len * 2 + 2; + if (show_calls_help) len += calls_help.len; for (pardes.builtin_rows) |row| { // a path-less builtin filters as the empty path: in the full listing // (which starts with nothing) and out of every group @@ -948,6 +984,10 @@ fn helpContent(gpa: std.mem.Allocator, prefix: []const u8) ![]u8 { content[at] = '\n'; at += 1; } + if (show_calls_help) { + @memcpy(content[at..][0..calls_help.len], calls_help); + at += calls_help.len; + } if (prefix.len == 0) { @memcpy(content[at..][0..language_footer.len], language_footer); at += language_footer.len; @@ -963,7 +1003,7 @@ pub fn openHelp(p: *Pardes, id: usize, prefix: []const u8) !void { return openRead(p, id, .{ .cmd = .Help }, prefix, content); } -test "full Help renders every builtin row, then the language keys" { +test "full Help renders builtin rows, a call hierarchy guide, then language keys" { const content = try helpContent(std.testing.allocator, ""); defer std.testing.allocator.free(content); @@ -974,17 +1014,22 @@ test "full Help renders every builtin row, then the language keys" { for (pardes.builtin_rows) |row| try std.testing.expectEqualStrings(row.line, lines.next() orelse return error.MissingBuiltinHelpRow); - // ...and after the last row, the language-keys section: the one part of - // the keymap no builtin row can carry, closing the page. + // The short call guide disambiguates the three related commands. + try std.testing.expectEqualStrings("", lines.next() orelse return error.MissingCallHelp); + try std.testing.expectEqualStrings("Callstack: static caller chains,", lines.next() orelse return error.MissingCallHelp); + try std.testing.expectEqualStrings("with signatures and clickable call sites.", lines.next() orelse return error.MissingCallHelp); + try std.testing.expectEqualStrings("Callers / Callees: one direction at a time.", lines.next() orelse return error.MissingCallHelp); + // The language keys close the page. try std.testing.expectEqualStrings("", lines.next() orelse return error.MissingLanguageKeys); try std.testing.expectEqualStrings("language keys (motions, not words):", lines.next() orelse return error.MissingLanguageKeys); try std.testing.expect(std.mem.indexOf(u8, body, "\ngd gD gy gi gr goto: definition,\n") != null); - // the group view stays a pure filter: no footer under a prefix + // The language group also explains call commands, without the motion footer. const group = try helpContent(std.testing.allocator, "l"); defer std.testing.allocator.free(group); try std.testing.expect(std.mem.indexOf(u8, group, "language keys") == null); + try std.testing.expect(std.mem.indexOf(u8, group, "Callstack: static caller chains") != null); } pub fn openConfig(p: *Pardes, id: usize) !void { diff --git a/src/body_layer.zig b/src/body_layer.zig index b24bd6ed..2aa8e5f8 100644 --- a/src/body_layer.zig +++ b/src/body_layer.zig @@ -113,8 +113,8 @@ fn paintSourceSelection(p: *Pardes, s: *Surface, pane: *Pane, r: Rect, rows: []c const lo = @max(start, row.lo); const hi = @min(end, row.hi); if (lo >= hi) continue; - var col = prefix + @as(i32, @intCast(panes.File.rawDisplayCol(line[start..], lo - start))); - const last = if (row.to_edge and hi == end) @as(i32, width) else prefix + @as(i32, @intCast(panes.File.rawDisplayCol(line[start..], hi - start))); + var col = prefix + source.pad + @as(i32, @intCast(panes.File.rawDisplayCol(line[start..], lo - start))); + const last = if (row.to_edge and hi == end) @as(i32, width) else prefix + source.pad + @as(i32, @intCast(panes.File.rawDisplayCol(line[start..], hi - start))); while (col < last and col < width) : (col += 1) { const cell = s.at(tx + @as(u16, @intCast(col)), body_y + @as(u16, @intCast(visible))); cell.default = false; @@ -399,14 +399,14 @@ pub fn renderBody(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane (if (pane.file != null) panes.File.displayOffset(pane, w.line, w.at, bnd.lo_col) else - panes.File.lineDisplayOffset(visible_line, @intCast(@max(0, w.at)), @intCast(@max(0, bnd.lo_col)))) + vpfx + panes.File.lineDisplayOffset(visible_line, @intCast(@max(0, w.at)), @intCast(@max(0, bnd.lo_col)))) + vpfx + w.pad else - vpfx; + vpfx + w.pad; const cend: i32 = if (w.line == bnd.hi_row and @as(usize, @intCast(@max(0, bnd.hi_col))) < past_view) (if (pane.file != null) panes.File.displayEndOffset(pane, w.line, w.at, bnd.hi_col) else - panes.File.lineDisplayEndOffset(visible_line, @intCast(@max(0, w.at)), @intCast(@max(0, bnd.hi_col)))) + vpfx + panes.File.lineDisplayEndOffset(visible_line, @intCast(@max(0, w.at)), @intCast(@max(0, bnd.hi_col)))) + vpfx + w.pad else @as(i32, tw) - 1; var col: i32 = @max(cstart, vpfx); @@ -432,7 +432,7 @@ pub fn renderBody(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane modal.lineSlice(body, @intCast(@max(0, cw.row))), @intCast(@max(0, cw.at)), @intCast(@max(0, sr.col)), - )) + vpfx; + )) + vpfx + cw.pad; if (crow >= pane.tag_rows and crow < @as(i32, body_bottom) and ccol >= vpfx and ccol < tw) { const cell = s.at(tx + @as(u16, @intCast(ccol)), body_y + @as(u16, @intCast(crow - pane.tag_rows))); cell.default = false; @@ -455,7 +455,7 @@ pub fn renderBody(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane const row: i32 = @intCast(pos.row); const wp = pane.wrapRow(row, @intCast(pos.col)); const cx = if (pane.file != null) - @as(i32, panes.File.gutterWidth(pane)) + panes.File.displayOffset(pane, row, wp.at, @intCast(pos.col)) + @as(i32, panes.File.gutterWidth(pane)) + wp.pad + panes.File.displayOffset(pane, row, wp.at, @intCast(pos.col)) else panes.File.lineDisplayOffset(modal.lineSlice(flat, pos.row), @intCast(@max(0, wp.at)), pos.col); if (wp.row >= 0 and wp.row < body_h and cx >= 0 and cx < tw) @@ -478,20 +478,20 @@ pub fn renderBody(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane // Off the view, the cursor is not measured (its column may be // millions of bytes along a line whose start is shown). if (cwp.row >= 0 and prow < body_bottom and !pastView(pane, body, crow, cwp.row, cwp.at, ccol, tw)) { - // Files store source-byte columns; the Surface stores display - // cells, so account for every expanded tab before the cursor. - const cx = if (pane.file != null) - @as(i32, panes.File.gutterWidth(pane)) + panes.File.displayOffset(pane, crow, cwp.at, ccol) - else if (pane.body.cur_pinned) - panes.File.lineDisplayOffset( - modal.lineSlice(body, @intCast(@max(0, cwp.row))), - @intCast(@max(0, cwp.at)), - @intCast(@max(0, ccol)), - ) - else - ccol; - if (prow >= pane.tag_rows and cx >= 0 and prow < body_bottom and cx < tw) - s.cursor = .{ .x = tx + @as(u16, @intCast(cx)), .y = body_y + @as(u16, @intCast(prow - pane.tag_rows)), .bar = pane.body.mode == .insert }; + // Files store source-byte columns; the Surface stores display + // cells, so account for every expanded tab before the cursor. + const cx = if (pane.file != null) + @as(i32, panes.File.gutterWidth(pane)) + cwp.pad + panes.File.displayOffset(pane, crow, cwp.at, ccol) + else if (pane.body.cur_pinned) + panes.File.lineDisplayOffset( + modal.lineSlice(body, @intCast(@max(0, cwp.row))), + @intCast(@max(0, cwp.at)), + @intCast(@max(0, ccol)), + ) + else + ccol; + if (prow >= pane.tag_rows and cx >= 0 and prow < body_bottom and cx < tw) + s.cursor = .{ .x = tx + @as(u16, @intCast(cx)), .y = body_y + @as(u16, @intCast(prow - pane.tag_rows)), .bar = pane.body.mode == .insert }; } } else if (panes.terminal.visibleCursor(pane)) |cur| { if (cur.y + pane.tag_rows < body_bottom and cur.x < tw) diff --git a/src/builtins.zig b/src/builtins.zig index ef769b48..f73c5982 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -236,8 +236,8 @@ pub const registry = struct { // are the default .toggle, .transition, .scene, .dump_dir, .choice, .lift, .shader_animation, .motion, .shell => false, .theme, .font, .tagline_size, .window_opacity, .window_blur, .message_ms, .shader, .inactive_dim, .grip_width => true, - // bare, it says the width (exec.applySettingBuiltin) - .tab => false, + // bare, it says the current value (exec.applySettingBuiltin) + .tab, .callstack_depth => false, }; unreachable; } @@ -1839,6 +1839,7 @@ pub const Forward = struct { /// Select the next Look location across panes; Enter opens it. pub const LookNext = struct { + pub const quiet = true; pub fn run(c: Ctx) void { look.lookWalk(c.p, 1); } @@ -1846,6 +1847,7 @@ pub const LookNext = struct { /// Select the previous Look location across panes; Enter opens it. pub const LookPrev = struct { + pub const quiet = true; pub fn run(c: Ctx) void { look.lookWalk(c.p, -1); } @@ -1952,6 +1954,13 @@ pub const WsDiagnostics = struct { } }; +/// Show outermost callers first, with signatures and call sites (gc). +pub const Callstack = struct { + pub fn run(c: Ctx) void { + c.p.lspRequest(c.id, .callstack, ""); + } +}; + /// List the callers of the function under the cursor. pub const Callers = struct { pub fn run(c: Ctx) void { diff --git a/src/colors.zig b/src/colors.zig index 2dcb906a..379d1301 100644 --- a/src/colors.zig +++ b/src/colors.zig @@ -126,9 +126,11 @@ test "every faithful port meets pardes's chrome floors in its own colours, with } test "a derived separator or tint keeps the theme's own when it already stands off" { - const forge = &themes[for (themes[0..native_count], 0..) |t, i| { - if (std.mem.eql(u8, t.name, "forge")) break i; - } else unreachable]; + const forge = &themes[ + for (themes[0..native_count], 0..) |t, i| { + if (std.mem.eql(u8, t.name, "forge")) break i; + } else unreachable + ]; const chrome = ChromeTheme.fromTheme(forge); try std.testing.expectEqual(forge.border.?, chrome.border); // forge's own tint is 1.23:1 off its tag: pushed on the way it leans. @@ -1075,7 +1077,7 @@ test "render uses target content colors while chrome is in flight" { Color{ .rgb = source_chrome.tag_bg }, surface.at(0, 0).style.bg, ); - const topbar_cell = surface.at(0, 0); + const topbar_cell = surface.at(@import("pardes.zig").TAG_TEXT_INSET, 0); try std.testing.expect(!std.mem.eql(u8, topbar_cell.grapheme(), " ")); try std.testing.expectEqual(FontRole.tagline, topbar_cell.style.font_role); const r = p.rects[0]; diff --git a/src/config.zig b/src/config.zig index fb34b746..50009660 100644 --- a/src/config.zig +++ b/src/config.zig @@ -43,6 +43,7 @@ pub const leader_path = paths: { .WsDiagnostics = "lD", .Lspinfo = "li", .Lspwhy = "lw", + .Callstack = "lb", .Callers = "lc", .Callees = "lC", .Supertypes = "lt", @@ -67,6 +68,9 @@ pub const leader_path = paths: { .Putall = null, .Incl = null, .Tab = null, + .CallstackDepth = null, + .CallstackLayout = null, + .CallstackCorners = null, .Zerox = null, .ClipYank = "y", .ClipYankMain = "Y", @@ -580,7 +584,8 @@ pub const goto_line_down: []const Chord = &.{.{ .cp = 'j' }}; pub const goto_line_up: []const Chord = &.{.{ .cp = 'k' }}; pub const goto_column: []const Chord = &.{.{ .cp = '|' }}; pub const goto_view_top: []const Chord = &.{.{ .cp = 't' }}; -pub const goto_view_center: []const Chord = &.{.{ .cp = 'c' }}; +// gc opens Callstack; it no longer moves the cursor to the viewport center. +pub const goto_view_center: []const Chord = &.{}; pub const goto_view_bottom: []const Chord = &.{.{ .cp = 'b' }}; pub const goto_last_modification: []const Chord = &.{.{ .cp = '.' }}; pub const goto_word: []const Chord = &.{.{ .cp = 'w' }}; @@ -591,6 +596,7 @@ pub const goto_declaration: []const Chord = &.{.{ .cp = 'D' }}; pub const goto_type_definition: []const Chord = &.{.{ .cp = 'y' }}; pub const goto_implementation: []const Chord = &.{.{ .cp = 'i' }}; pub const goto_references: []const Chord = &.{.{ .cp = 'r' }}; +pub const goto_callstack: []const Chord = &.{.{ .cp = 'c' }}; pub const match_bracket: []const Chord = &.{.{ .cp = 'm' }}; pub const match_inside = 'i'; @@ -835,6 +841,9 @@ pub const Runtime = struct { /// acme's Tab: a tab's width in cells, in every pane (config.tab_now /// is what the drawing and the column arithmetic read). tab: u16 = tab_width, + callstack_layout: CallstackLayout = .stacked, + callstack_corners: CallstackCorners = .rounded, + callstack_depth: u8 = @import("lsp/lsp.zig").callstack_default_depth, pub const ShaderAnimation = enum { off, on, always }; pub const Placement = enum { acme, pardes }; @@ -845,8 +854,10 @@ pub const Runtime = struct { pub const Pager = enum { pardes, off }; pub const TermImages = enum { real, petscii }; pub const JumpScope = enum { file, all }; + pub const CallstackLayout = enum { @"inline", stacked }; + pub const CallstackCorners = @import("lsp/lsp.zig").CallstackCorners; /// A setting that is one of a few words, each an enum field of Runtime. - pub const Choice = enum { placement, boot_shell, look_word, dir_look, diff_look, pager, term_images, jump_scope }; + pub const Choice = enum { placement, boot_shell, look_word, dir_look, diff_look, pager, term_images, jump_scope, callstack_layout, callstack_corners }; /// shadow: a soft drop shadow. rim: a light hairline along the top of /// the focused pane's tag rows. auto: a shadow on a light page; on a @@ -1034,6 +1045,7 @@ pub const Runtime = struct { inactive_dim, grip_width, tab, + callstack_depth, transition: animation.Transition, scene: Scene, /// A Shadertoy file into the post chain or out of it; `off` empties @@ -1118,6 +1130,9 @@ pub const Runtime = struct { .{ .word = "PagerColor", .action = .{ .toggle = .pager_color }, .doc = "A +Pager keeps its program's colours, on or off; for the next text paged." }, .{ .word = "TermImages", .action = .{ .choice = .term_images }, .doc = "How a new terminal draws its program's kitty graphics: real, as pixels where it can, or petscii, as glyph art." }, .{ .word = "JumpScope", .action = .{ .choice = .jump_scope }, .doc = "What Back and Forward keep to: file, the focused pane's file until it runs out that way, or all, every place in order." }, + .{ .word = "CallstackLayout", .action = .{ .choice = .callstack_layout }, .doc = "Callstack snippets below their locations (stacked, the default) or beside them (inline); bare, it switches layouts. Applies to the next Callstack query." }, + .{ .word = "CallstackCorners", .action = .{ .choice = .callstack_corners }, .doc = "Callstack tree corners: rounded (the default) or square; bare, it switches styles. Applies to the next Callstack query." }, + .{ .word = "CallstackDepth", .action = .callstack_depth, .doc = "Caller levels collected by Callstack, 1 through 64; default 8. Bare, it says the current limit." }, .{ .word = "Tab", .action = .tab, .doc = "A tab's width in cells, 1 through 16, in every pane; bare, it says the width." }, }; @@ -1319,6 +1334,12 @@ pub const Runtime = struct { if (percent < 50 or percent > 300) return false; state.grip_width = percent; }, + .callstack_depth => { + const text = std.mem.trim(u8, argument orelse return false, " \t\r\n"); + const depth = std.fmt.parseInt(u8, text, 10) catch return false; + if (depth < 1 or depth > @import("lsp/lsp.zig").callstack_max_depth) return false; + state.callstack_depth = depth; + }, .tab => { const text = std.mem.trim(u8, argument orelse return false, " \t\r\n"); const width = std.fmt.parseInt(u16, text, 10) catch return false; @@ -1361,6 +1382,7 @@ pub const Runtime = struct { .inactive_dim, .window_opacity, .window_blur => "0-100 (a percentage)", .grip_width => "50-300 (a percentage)", .tab => "1-16 (cells)", + .callstack_depth => "1-64 (levels)", .tagline_size => std.fmt.comptimePrint("{d}-{d} (a percentage)", .{ tagline_percent_min, tagline_percent_max }), .message_ms => std.fmt.comptimePrint("0-{d} (milliseconds)", .{message_ms_max}), .shell => "a path of at most 255 bytes; bare, $SHELL, else /bin/sh", @@ -1523,6 +1545,7 @@ pub const Runtime = struct { try out.print("# {s} unsupported\n", .{setting.word}), .motion => try out.print("{s} {s}\n", .{ setting.word, @tagName(state.motion) }), .inactive_dim => try out.print("{s} {d}\n", .{ setting.word, state.inactive_dim }), + .callstack_depth => try out.print("{s} {d}\n", .{ setting.word, state.callstack_depth }), .tab => try out.print("{s} {d}\n", .{ setting.word, state.tab }), .grip_width => if (setting.enabled(context.capabilities)) try out.print("{s} {d}\n", .{ setting.word, state.grip_width }) @@ -1816,11 +1839,14 @@ pub const Runtime = struct { .pager => "off", .term_images => "petscii", .jump_scope => "all", + .callstack_layout => "inline", + .callstack_corners => "square", }, .lift => "rim", .motion => "playful", .inactive_dim => "35", .grip_width => "200", + .callstack_depth => "16", .tab => "8", else => null, }; @@ -1892,11 +1918,14 @@ pub const Runtime = struct { .pager => "Pager off\n", .term_images => "TermImages petscii\n", .jump_scope => "JumpScope all\n", + .callstack_layout => "CallstackLayout inline\n", + .callstack_corners => "CallstackCorners square\n", }, .lift => "Lift rim\n", .motion => "Motion playful\n", .inactive_dim => "InactiveDim 35\n", .grip_width => "GripWidth 200\n", + .callstack_depth => "CallstackDepth 16\n", .tab => "Tab 8\n", .theme, .font => unreachable, }; @@ -2474,3 +2503,16 @@ test "reference.typ's #fstree is the tree the session serves, file for file" { }; if (drift) return error.FsTreeDrift; } + +test "CallstackDepth is bounded and keeps the last valid runtime limit" { + var state: Runtime = .{}; + try std.testing.expectEqual(@as(u8, 8), state.callstack_depth); + for ([_][]const u8{ "1", "8", "16", "64" }) |value| { + try std.testing.expect(Runtime.apply(&state, Runtime.find("CallstackDepth").?, value)); + try std.testing.expectEqual(try std.fmt.parseInt(u8, value, 10), state.callstack_depth); + } + for ([_][]const u8{ "0", "65", "256", "-1", "eight", "" }) |value| { + try std.testing.expect(!Runtime.apply(&state, Runtime.find("CallstackDepth").?, value)); + try std.testing.expectEqual(@as(u8, 64), state.callstack_depth); + } +} diff --git a/src/draw.zig b/src/draw.zig index 9fcbb15f..b35d55e8 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -412,15 +412,15 @@ fn recede(p: *Pardes, s: *Surface, id: usize, amount: f32, focused: bool) void { } } const body = &s.body_layers[id]; - if (body.rows != 0) for (body.cells[0..@as(usize, body.cols) * body.rows]) |*cell| { + if (body.rows != 0) for (body.cells[0 .. @as(usize, body.cols) * body.rows]) |*cell| { if (!(focused and selected(cell, th.sel_bg))) fadeStyle(&cell.style, th.fg, th.bg, palette, amount, &memo); }; if (focused) return; const tag = &s.tag_layers[id]; - if (tag.rows != 0) for (tag.cells[0..@as(usize, tag.cols) * tag.rows]) |*cell| fadeStyle(&cell.style, chrome.tag_fg, tag.bg, palette, amount, &memo); + if (tag.rows != 0) for (tag.cells[0 .. @as(usize, tag.cols) * tag.rows]) |*cell| fadeStyle(&cell.style, chrome.tag_fg, tag.bg, palette, amount, &memo); for (0..Pane.Notices.max) |i| { const notice = &s.tag_layers[NOTICE_LAYER_BASE + id * Pane.Notices.max + i]; - if (notice.rows != 0) for (notice.cells[0..@as(usize, notice.cols) * notice.rows]) |*cell| fadeStyle(&cell.style, chrome.tag_fg, notice.bg, palette, amount, &memo); + if (notice.rows != 0) for (notice.cells[0 .. @as(usize, notice.cols) * notice.rows]) |*cell| fadeStyle(&cell.style, chrome.tag_fg, notice.bg, palette, amount, &memo); } } @@ -978,7 +978,12 @@ pub fn paintHeaders(p: *Pardes, s: *Surface, arena: std.mem.Allocator) !void { if (s.region(.workspace_tag, Region.none)) |region| { const top = if (p.header_focus and p.header_column == null) p.header_top else 0; const layer = &s.tag_layers[MAX_PANES + MAX_COLS]; - try renderHeaderLayer(p, arena, layer, .workspace, 0, region.rect, tagline.topbar(p), top, chrome.tag_bg, chrome.tag_fg); + var viewport = region.rect; + const inset = @min(TAG_TEXT_INSET, viewport.w); + s.fill(viewport.x, viewport.y, inset, viewport.h, .{ .bg = .{ .rgb = chrome.tag_bg }, .fg = .{ .rgb = chrome.tag_fg }, .font_role = .tagline }); + viewport.x += inset; + viewport.w -= inset; + try renderHeaderLayer(p, arena, layer, .workspace, 0, viewport, tagline.topbar(p), top, chrome.tag_bg, chrome.tag_fg); joinHeaderRows(s, layer, chrome.tag_fg); } const column_rows = p.columnBarHeight(); @@ -1348,8 +1353,7 @@ pub fn paintPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pa const at = modal.positionAt(shown.text, shown.fromReal(@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) caret: { + } else if (pane.focus == .tag and pane.prompt == .none) caret: { const real = modal.offsetAt(whole, .{ .row = @intCast(@max(0, pane.tag.cur_row)), .col = @intCast(@max(0, pane.tag.cur_col)) }); const at = modal.positionAt(shown.text, shown.fromReal(real)); if (at.row < top or at.row >= top + rows) break :caret null; @@ -2392,7 +2396,7 @@ test "a pane focus reaches brightens on the same spring the one it leaves dims o // The file's first glyph's ink, in whichever form its body has. fn of(s: *const Surface) [3]u8 { const body = &s.body_layers[0]; - const cells = if (body.rows != 0) body.cells[0..@as(usize, body.cols) * body.rows] else s.cells; + const cells = if (body.rows != 0) body.cells[0 .. @as(usize, body.cols) * body.rows] else s.cells; for (cells) |cell| if (!cell.default and cell.len == 1 and cell.text[0] == 's' and cell.style.font_role == .body) return switch (cell.style.fg) { .rgb => |rgb| rgb, else => .{ 0, 0, 0 }, diff --git a/src/dump.zig b/src/dump.zig index 201f5bf2..402918c4 100644 --- a/src/dump.zig +++ b/src/dump.zig @@ -56,7 +56,7 @@ pub fn outPath(buf: *[1024:0]u8, dir_setting: []const u8) ?[:0]const u8 { const ds = es.getDaySeconds(); var stamp: [32]u8 = undefined; const base = std.fmt.bufPrint(&stamp, "pardes-{d:0>4}{d:0>2}{d:0>2}-{d:0>2}{d:0>2}{d:0>2}", .{ - yd.year, md.month.numeric(), @as(u8, md.day_index) + 1, + yd.year, md.month.numeric(), @as(u8, md.day_index) + 1, ds.getHoursIntoDay(), ds.getMinutesIntoHour(), ds.getSecondsIntoMinute(), }) catch return null; return uniqueIn(buf, dir, base); @@ -194,6 +194,8 @@ pub const Terminal = struct { }; pub const LocationRow = struct { + mark_occurrence: bool = true, + source_column: usize = 0, kind: enum { match, context, preview }, declaration: bool = false, path: []const u8, diff --git a/src/edit.zig b/src/edit.zig index b2909d87..5dbce0bf 100644 --- a/src/edit.zig +++ b/src/edit.zig @@ -241,8 +241,8 @@ pub fn capturePointerSelection(p: *Pardes, pane: *Pane, slot: usize) !void { if (raw) next = .{ .line = source.line + 1, .at = 0 }; const end = if (next.line == source.line) @min(line.len, @as(usize, @intCast(@max(0, next.at)))) else line.len; const start: usize = @intCast(@max(0, source.at)); - const lo = @min(end, panes.File.byteAtDisplayFrom(line, start, @intCast(@max(0, left - prefix)))); - const at = @min(end, panes.File.byteAtDisplayFrom(line, start, @intCast(@max(0, right - prefix)))); + const lo = @min(end, panes.File.byteAtDisplayFrom(line, start, @intCast(@max(0, left - prefix - source.pad)))); + const at = @min(end, panes.File.byteAtDisplayFrom(line, start, @intCast(@max(0, right - prefix - source.pad)))); row.* = .{ .row = source.line, .lo = lo, diff --git a/src/exec.zig b/src/exec.zig index 2a6bd55c..d03a4a48 100644 --- a/src/exec.zig +++ b/src/exec.zig @@ -140,7 +140,7 @@ pub fn operandAt(p: *Pardes, pane: *Pane, clicked: Pane.Sel, borrow: bool, for_l &pane.body, wrapped.line, wrapped.at, - clicked.c0 - (if (pane.file != null) @as(i32, panes.File.gutterWidth(pane)) else 0), + clicked.c0 - wrapped.pad - (if (pane.file != null) @as(i32, panes.File.gutterWidth(pane)) else 0), ) else clicked.c0; @@ -214,9 +214,9 @@ pub fn operandAt(p: *Pardes, pane: *Pane, clicked: Pane.Sel, borrow: bool, for_l const last = pane.wrapRow(row, hi - 1); if (first.row < 0 or last.row < 0) return result; expanded.r0 = first.row + @as(i32, pane.tag_rows); - expanded.c0 = @as(i32, panes.File.gutterWidth(pane)) + panes.File.displayOffset(pane, row, first.at, 0); + expanded.c0 = @as(i32, panes.File.gutterWidth(pane)) + first.pad + panes.File.displayOffset(pane, row, first.at, 0); expanded.r1 = last.row + @as(i32, pane.tag_rows); - expanded.c1 = @as(i32, panes.File.gutterWidth(pane)) + panes.File.displayEndOffset(pane, row, last.at, hi - 1); + expanded.c1 = @as(i32, panes.File.gutterWidth(pane)) + last.pad + panes.File.displayEndOffset(pane, row, last.at, hi - 1); } else { const shown = if (raw) raw_line else line; expanded.c0 = 0; @@ -242,9 +242,9 @@ pub fn operandAt(p: *Pardes, pane: *Pane, clicked: Pane.Sel, borrow: bool, for_l const last = pane.wrapRow(row, hi - 1); if (first.row >= 0 and last.row >= 0) { expanded.r0 = first.row + @as(i32, pane.tag_rows); - expanded.c0 = @as(i32, panes.File.gutterWidth(pane)) + panes.File.displayOffset(pane, row, first.at, lo); + expanded.c0 = @as(i32, panes.File.gutterWidth(pane)) + first.pad + panes.File.displayOffset(pane, row, first.at, lo); expanded.r1 = last.row + @as(i32, pane.tag_rows); - expanded.c1 = @as(i32, panes.File.gutterWidth(pane)) + panes.File.displayEndOffset(pane, row, last.at, hi - 1); + expanded.c1 = @as(i32, panes.File.gutterWidth(pane)) + last.pad + panes.File.displayEndOffset(pane, row, last.at, hi - 1); } result.preview = expanded; result.expanded = expanded; @@ -1120,6 +1120,12 @@ pub fn applySettingBuiltin(p: *Pardes, setting: config.Runtime.Setting, arg: ?[] } if (!p.settings.apply(setting, want)) p.reportFailure(p.active, "Shell: takes " ++ comptime config.Runtime.takes(.shell).?); }, + .callstack_depth => if (arg == null) { + var said: [40]u8 = undefined; + return p.setMessage(p.active, std.fmt.bufPrint(&said, "CallstackDepth {d}", .{p.settings.callstack_depth}) catch "CallstackDepth"); + } else if (!p.settings.apply(setting, arg)) { + p.reportFailure(p.active, "CallstackDepth: takes " ++ comptime config.Runtime.takes(.callstack_depth).?); + }, // Bare, it says the width, as acme's Tab does. .tab => if (arg == null) { var said: [32]u8 = undefined; diff --git a/src/host_io.zig b/src/host_io.zig index 7314affc..a90c903d 100644 --- a/src/host_io.zig +++ b/src/host_io.zig @@ -136,6 +136,8 @@ pub const Lsp = struct { /// One language query, owned by the worker that runs it. pub const Job = struct { + callstack_depth: u8 = pardes.lsp.callstack_default_depth, + callstack_corners: pardes.lsp.CallstackCorners = .rounded, id: u32, kind: pardes.lsp.Kind, offset: u32, @@ -178,6 +180,8 @@ pub const Lsp = struct { const root = try gpa.dupe(u8, filesystem.localPath(declared_root) orelse declared_root); errdefer gpa.free(root); job.* = .{ + .callstack_depth = core.settings.callstack_depth, + .callstack_corners = core.settings.callstack_corners, .id = req.id, .kind = req.kind, .offset = req.offset, @@ -234,6 +238,8 @@ pub const Lsp = struct { .arg = job.arg, .root = job.root, .others = job.others, + .callstack_depth = job.callstack_depth, + .callstack_corners = job.callstack_corners, }, &out.writer) catch { deliver(ctx, job.id, null); return; @@ -250,6 +256,8 @@ pub const Lsp = struct { const core = try pardes.Pardes.init(gpa, .{ .tty_only = true }); defer core.deinit(); + core.settings.callstack_depth = 16; + core.settings.callstack_corners = .square; var needle: [6]u8 = "needle".*; const job = try snapshot(gpa, core, .{ .id = 7, @@ -260,6 +268,10 @@ pub const Lsp = struct { }); defer job.free(gpa); + core.settings.callstack_depth = 2; + core.settings.callstack_corners = .rounded; + try std.testing.expectEqual(pardes.lsp.CallstackCorners.square, job.callstack_corners); + try std.testing.expectEqual(@as(u8, 16), job.callstack_depth); try std.testing.expectEqual(@as(u32, 7), job.id); try std.testing.expectEqual(pardes.lsp.Kind.status, job.kind); try std.testing.expectEqualStrings("needle", job.arg); diff --git a/src/layout.zig b/src/layout.zig index a2211dfd..40bce75a 100644 --- a/src/layout.zig +++ b/src/layout.zig @@ -266,6 +266,28 @@ pub fn setColumnWeights(p: *Pardes, col: usize, heights: *const [MAX_PANES]u16) } } +/// Give a newly opened report enough rows to read, borrowing only space +/// above the other panes' usable minima. Keep their tags and bodies visible. +pub fn givePaneRows(p: *Pardes, id: usize, wanted: u16, context: usize) void { + const at = findPane(p, id) orelse return; + compute(p); + var heights: [MAX_PANES]u16 = @splat(0); + for (p.col_panes[at.col][0..p.col_n[at.col]]) |other| heights[other] = p.rects[other].h; + var missing = wanted -| heights[id]; + for (p.col_panes[at.col][0..p.col_n[at.col]]) |other| { + if (other == id or p.panes[other].?.collapsed) continue; + const body_rows: u16 = if (other == context) 6 else 3; + const minimum = @max(minRows(p, other), p.panes[other].?.tag_rows + body_rows); + const take = @min(missing, heights[other] -| minimum); + heights[other] -= take; + heights[id] += take; + missing -= take; + if (missing == 0) break; + } + setColumnWeights(p, at.col, &heights); + p.sync(); +} + pub fn applyRowSplit(p: *Pardes, cc: usize, k: usize, cur_y: u16) void { if (k + 1 >= p.col_n[cc]) return; const a = p.panes[p.col_panes[cc][k]] orelse return; diff --git a/src/locations.zig b/src/locations.zig index 7755f6fd..745393e5 100644 --- a/src/locations.zig +++ b/src/locations.zig @@ -16,6 +16,8 @@ pub fn isContextLine(line: []const u8) bool { pub const Row = struct { kind: enum { match, context, preview }, declaration: bool = false, + mark_occurrence: bool = true, + source_column: usize = 0, path: []u8, at: look.Spot, location_end: usize, @@ -34,7 +36,7 @@ pub fn freeRows(gpa: std.mem.Allocator, rows: []Row) void { pub fn equalRows(a: []const Row, b: []const Row) bool { if (a.len != b.len) return false; for (a, b) |left, right| { - if (left.kind != right.kind or left.declaration != right.declaration or !std.meta.eql(left.at, right.at) or + if (left.kind != right.kind or left.declaration != right.declaration or left.mark_occurrence != right.mark_occurrence or left.source_column != right.source_column or !std.meta.eql(left.at, right.at) or left.location_end != right.location_end or left.code_start != right.code_start or !std.mem.eql(u8, left.path, right.path) or !std.mem.eql(u8, left.colors, right.colors)) return false; } @@ -119,7 +121,8 @@ pub fn parse(line: []const u8) Parsed { return parseRaw(line); } -fn parseRaw(line: []const u8) Parsed { +/// Native producer rows have one separator byte before untouched source. +pub fn parseRaw(line: []const u8) Parsed { var at: usize = 1; while (at < line.len) : (at += 1) { if (line[at] != ':' or at + 1 == line.len or !std.ascii.isDigit(line[at + 1])) continue; @@ -148,6 +151,8 @@ const Pending = struct { original: ?usize, hidden: bool = false, declaration: bool = false, + mark_occurrence: bool = true, + source_column: usize = 0, depth: usize = 0, colors: []const u8 = &.{}, @@ -174,6 +179,174 @@ pub fn sourceText(p: *pardes.Pardes, arena: std.mem.Allocator, dir: []const u8, return .{ .path = lexical, .bytes = arena.dupe(u8, bytes) catch return null }; } +/// Byte boundary after the guides in a call tree, independent of source indentation. +pub fn treePrefix(line: []const u8) struct { end: usize, branch: bool } { + var at: usize = 0; + while (at < line.len) { + for ([_][]const u8{ "╰──┬ ", "├──╮ ", "╰──╮ ", "├─── ", "╰─── ", "├──┬ ", "└──┬ ", "└─── " }) |branch| { + if (std.mem.startsWith(u8, line[at..], branch)) return .{ .end = at + branch.len, .branch = true }; + } + if (std.mem.startsWith(u8, line[at..], "├─ ") or std.mem.startsWith(u8, line[at..], "└─ ") or std.mem.startsWith(u8, line[at..], "╰─ ")) + return .{ .end = at + "└─ ".len, .branch = false }; + if (std.mem.startsWith(u8, line[at..], "│")) { + at += "│".len; + } else if (line[at] == ' ') { + at += 1; + } else break; + } + return .{ .end = at, .branch = false }; +} + +/// The same tree columns carried across a soft-wrapped display row. This is +/// presentation only: source bytes and Look addresses remain untouched. +pub fn treeContinuation(line: []const u8, buffer: []u8, max_cells: usize) []const u8 { + const prefix = line[0..treePrefix(line).end]; + var out: std.Io.Writer = .fixed(buffer); + var it = (std.unicode.Utf8View.init(prefix) catch return "").iterator(); + var cells: usize = 0; + var end: usize = 0; + while (it.nextCodepoint()) |cp| { + if (cells >= max_cells) break; + out.writeAll(if (cp == '│' or cp == '├' or cp == '┬' or cp == '╮') "│" else " ") catch break; + cells += 1; + if (cp != ' ') end = out.buffered().len; + } + if (end == 0) return ""; + // Keep one cell between the continuation and the wrapped source text. + if (end < out.buffered().len) end += 1; + return out.buffered()[0..end]; +} + +/// Enrich caller nodes on the UI thread, using the same source/declaration cache +/// as LocationsContext. The LSP worker only supplies relationships and addresses. +pub fn formatCallstack(p: *pardes.Pardes, dir: []const u8, input: []const u8) !Result { + const arena = p.scratch.allocator(); + var out: std.Io.Writer.Allocating = .init(p.gpa); + errdefer out.deinit(); + var rows: std.ArrayList(Row) = .empty; + errdefer { + for (rows.items) |row| { + p.gpa.free(row.path); + p.gpa.free(row.colors); + } + rows.deinit(p.gpa); + } + const stacked = p.settings.callstack_layout == .stacked; + var sources: std.StringHashMap(?Source) = .init(arena); + var lines = std.mem.splitScalar(u8, std.mem.trimEnd(u8, input, "\n"), '\n'); + while (lines.next()) |raw| { + const mark = @import("lsp/lsp.zig").callstack_match; + const focus = std.mem.startsWith(u8, raw, mark); + const line = if (focus) raw[mark.len..] else raw; + const prefix = treePrefix(line); + const target = parseRaw(line[prefix.end..]); + if (target.at.line == 0) { + try out.writer.print("{s}\n", .{line}); + try appendMetadata(p.gpa, &rows, .{ .path = "", .at = .{}, .label = "", .code = "", .original = null }, .context, 0, line.len, false); + continue; + } + const entry = try sources.getOrPut(target.path); + if (!entry.found_existing) entry.value_ptr.* = sourceText(p, arena, dir, target.path); + const source = entry.value_ptr.*; + var cached: Cache.Hit = .{ .analysis = .{} }; + defer cached.deinit(p.tree_sitter_gpa); + if (source) |text| cached = p.locations_cache.get(p.tree_sitter_gpa, text.path, text.bytes, true, true) catch .{ .analysis = .{} }; + var code = line[prefix.end + target.code_start ..]; + var colors: []const u8 = &.{}; + var source_row = target.at.line - 1; + if (source) |text| { + const row = target.at.line - 1; + if (prefix.branch) { + // Choose the innermost header containing the server's name range. + var chosen: ?syntax.ContextDeclaration = null; + for (cached.analysis.declarations) |declaration| { + if (declaration.start_line <= row and row <= declaration.header_end_line) { + if (chosen == null or declaration.end_byte - declaration.start_byte < chosen.?.end_byte - chosen.?.start_byte) + chosen = declaration; + } + } + if (chosen) |header| { + code = text.bytes[header.start_byte..header.header_end_byte]; + source_row = header.start_line; + } else { + const fallback = @import("modal.zig").lineSlice(text.bytes, row); + if (fallback.len > 0) code = fallback; + } + } + { + const offset = @import("modal.zig").lineStartOffset(text.bytes, source_row); + if (offset + code.len <= cached.analysis.colors.len and + std.mem.eql(u8, code, text.bytes[offset..][0..code.len])) + colors = cached.analysis.colors[offset..][0..code.len]; + } + } + const recursion = prefix.branch and std.mem.endsWith(u8, line, " ↻ recursion"); + const first_line = code[0 .. std.mem.indexOfScalar(u8, code, '\n') orelse code.len]; + const source_indent = if (stacked) first_line.len - std.mem.trimStart(u8, first_line, " \t").len else 0; + if (stacked) { + const end = prefix.end + target.end; + try out.writer.print("{s}\n", .{line[0..end]}); + try appendMetadata(p.gpa, &rows, .{ .path = target.path, .at = target.at, .label = "", .code = "", .original = null, .mark_occurrence = false }, .match, end, end, false); + } + var header_lines = std.mem.splitScalar(u8, code, '\n'); + var first = true; + var color_offset: usize = 0; + while (header_lines.next()) |code_line| { + const start = out.written().len; + if (stacked) { + var guide_buf: [1024]u8 = undefined; + const guide = treeContinuation(line, &guide_buf, std.math.maxInt(usize)); + try out.writer.writeAll(guide); + const width = pardes.panes.File.displayWidth(line[0..prefix.end]); + try out.writer.splatByteAll(' ', width -| pardes.panes.File.displayWidth(guide)); + } else if (first) { + try out.writer.writeAll(line[0 .. prefix.end + target.end]); + try out.writer.writeByte(' '); + } else { + const branch_start = prefix.end - "└──┬ ".len; + try out.writer.writeAll(line[0..branch_start]); + try out.writer.writeAll(if (std.mem.startsWith(u8, line[branch_start..], "├")) "│ " else " "); + try out.writer.writeAll(if (std.mem.endsWith(u8, line[0..prefix.end], "┬ ") or std.mem.endsWith(u8, line[0..prefix.end], "╮ ")) "│ " else " "); + try out.writer.splatByteAll(' ', pardes.panes.File.displayWidth(line[prefix.end..][0..target.end]) + 1); + } + const code_start = out.written().len - start; + const trim = @min(source_indent, code_line.len - std.mem.trimStart(u8, code_line, " \t").len); + try out.writer.writeAll(code_line[trim..]); + const recursion_note = recursion and first and !std.mem.endsWith(u8, code_line, " ↻ recursion"); + if (recursion_note) try out.writer.writeAll(" ↻ recursion"); + try out.writer.writeByte('\n'); + try appendMetadata(p.gpa, &rows, .{ + .path = target.path, + .at = if (first) target.at else .{ .line = source_row + 1 }, + .label = "", + .code = code_line[trim..], + .source_column = trim, + .original = null, + .mark_occurrence = focus and !prefix.branch, + .colors = if (colors.len >= color_offset + code_line.len) colors[color_offset + trim ..][0 .. code_line.len - trim] else &.{}, + }, if (first) (if (stacked) .preview else .match) else .context, if (first and !stacked) prefix.end + target.end else 0, code_start, true); + // Recursion notes are prose, outside the source snapshot. + if (recursion_note) { + const added = " ↻ recursion".len; + const row = &rows.items[rows.items.len - 1]; + if (row.colors.len > 0) { + const expanded = try p.gpa.alloc(u8, row.colors.len + added); + @memcpy(expanded[0..row.colors.len], row.colors); + @memset(expanded[row.colors.len..], 0); + p.gpa.free(row.colors); + row.colors = expanded; + } + } + color_offset += code_line.len + 1; + source_row += 1; + first = false; + } + } + const owned_rows = try rows.toOwnedSlice(p.gpa); + errdefer freeRows(p.gpa, owned_rows); + return .{ .content = try out.toOwnedSlice(), .rows = owned_rows, .anchor = null }; +} + /// Inputs are sorted results. Expand each source group, merge context with /// matches, then align groups of eight matches. All temporary source data /// stays in the caller's scratch arena; returned text and rows are owned. @@ -334,7 +507,7 @@ fn appendMetadata(gpa: std.mem.Allocator, rows: *std.ArrayList(Row), pending: Pe errdefer gpa.free(path); const colors = try gpa.dupe(u8, if (source) pending.colors else &.{}); errdefer gpa.free(colors); - try rows.append(gpa, .{ .kind = kind, .declaration = pending.declaration, .path = path, .at = pending.at, .location_end = location_end, .code_start = code_start, .colors = colors }); + try rows.append(gpa, .{ .kind = kind, .declaration = pending.declaration, .mark_occurrence = pending.mark_occurrence, .source_column = pending.source_column, .path = path, .at = pending.at, .location_end = location_end, .code_start = code_start, .colors = colors }); } const alignment_entries = 8; diff --git a/src/look.zig b/src/look.zig index 5795979f..1065cb02 100644 --- a/src/look.zig +++ b/src/look.zig @@ -524,7 +524,7 @@ pub fn cursorWordSel(p: *Pardes, pane: *Pane) Pane.Sel { const w = pane.wrapRow(pane.body.cur_row, pane.body.cur_col); const vrow = w.row + @as(i32, pane.tag_rows); const vcol = if (pane.file != null) - panes.File.displayOffset(pane, pane.body.cur_row, w.at, pane.body.cur_col) + @as(i32, panes.File.gutterWidth(pane)) + w.pad + panes.File.displayOffset(pane, pane.body.cur_row, w.at, pane.body.cur_col) + @as(i32, panes.File.gutterWidth(pane)) else blk: { const lines = edit.paneCursorLines(p, &pane.body) catch break :blk pane.body.cur_col; const local = pane.body.cur_row; @@ -892,7 +892,13 @@ fn lookSpanIn(p: *Pardes, pane: *Pane, from: LookFrom, delta: i32, budget: *usiz if (grain == .whole) break :span wholeRowSpan(ln); if (pane.file) |f| if (@as(usize, @intCast(r)) < f.location_rows.len) { const end = f.location_rows[@intCast(r)].location_end; - if (end > 0) break :span @as(?Span, .{ .start = 0, .end = end }); + if (end > 0) { + const start_byte = if (f.output != null and std.meta.eql(f.output.?.from, panes.Output.Origin{ .query = .callstack })) + @import("locations.zig").treePrefix(ln).end + else + 0; + break :span @as(?Span, .{ .start = start_byte, .end = end }); + } }; break :span lineSpan(p, ln, dir, &realbuf); } orelse continue; @@ -1057,6 +1063,7 @@ pub fn focusPaneLine(p: *Pardes, id: usize, at: Spot, landing: enum { center, ke if (id >= MAX_PANES) return; const pane = p.panes[id] orelse return; p.active = id; + if (pane.collapsed) layout.toggleCollapse(p, id); pane.body.normal.clear(); if (pane.hasPdf()) { if (landing == .keep) return; @@ -2677,7 +2684,7 @@ test "Incl's directories find a name found nowhere else, too; bare Incl l try std.testing.expectEqual(@as(usize, 0), p.incl.items.len); } -test "n in a command pane walks its own file:line places, whoever walked last" { +test "LookNext in a command pane walks its own file:line places, whoever walked last" { if (!platform_has_fs) return; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); @@ -2706,12 +2713,12 @@ test "n in a command pane walks its own file:line places, whoever walked last" { cmd.focus = .body; cmd.body.mode = .normal; for ([_]u21{ 'g', 'g' }) |cp| p.update(.{ .key = .{ .cp = cp } }); - p.update(.{ .key = .{ .cp = 'n' } }); + exec.runBuiltin(p, .LookNext, p.active, "", null); try std.testing.expectEqual(dst, p.active); const first = cmd.look_at orelse return error.NoSpot; const lines = try edit.paneCursorLines(p, &cmd.body); try std.testing.expect(std.mem.startsWith(u8, lines[@intCast(first.row)][@intCast(first.col0)..], "x.c:3:1")); - p.update(.{ .key = .{ .cp = 'n' } }); + exec.runBuiltin(p, .LookNext, p.active, "", null); try std.testing.expectEqual(dst, p.active); const second = cmd.look_at orelse return error.NoSpot; try std.testing.expect(std.mem.startsWith(u8, lines[@intCast(second.row)][@intCast(second.col0)..], "y.c:2:1")); diff --git a/src/lsp/lsp.zig b/src/lsp/lsp.zig index 8dc4da4f..96d42bbd 100644 --- a/src/lsp/lsp.zig +++ b/src/lsp/lsp.zig @@ -16,6 +16,7 @@ pub const Kind = enum { format, select_refs, completion, + callstack, incoming_calls, outgoing_calls, supertypes, @@ -24,7 +25,14 @@ pub const Kind = enum { explain, }; +pub const callstack_match = "@callstack-match "; +pub const CallstackCorners = enum { rounded, square }; +pub const callstack_default_depth: u8 = 8; +pub const callstack_max_depth: u8 = 64; + pub const Req = struct { + callstack_depth: u8 = callstack_default_depth, + callstack_corners: CallstackCorners = .rounded, kind: Kind, path: []const u8, source: [:0]const u8, @@ -46,7 +54,7 @@ pub const Doc = struct { path: []const u8, source: [:0]const u8 }; /// file of the server's language is synced before it is asked. pub fn reachesOtherFiles(kind: Kind) bool { return switch (kind) { - .rename, .references, .implementation, .workspace_symbols, .incoming_calls, .outgoing_calls, .supertypes, .subtypes => true, + .rename, .references, .implementation, .workspace_symbols, .callstack, .incoming_calls, .outgoing_calls, .supertypes, .subtypes => true, else => false, }; } diff --git a/src/lsp/lsp_client.zig b/src/lsp/lsp_client.zig index 561195fe..54bbaa79 100644 --- a/src/lsp/lsp_client.zig +++ b/src/lsp/lsp_client.zig @@ -521,7 +521,8 @@ fn run(c: *Conn, si: usize, arena: std.mem.Allocator, req: lsp.Req, out: *std.Io }; const pos = posOf(req.source, req.offset, c.caps.enc); - var cx: Cx = .{ .arena = arena, .base = req.root, .cur_path = req.path, .cur_src = req.source, .out = out }; + var cx: Cx = .{ .arena = arena, .base = req.root, .cur_path = req.path, .cur_src = req.source, .out = out, .relative_parents = req.kind == .callstack, .callstack_corners = req.callstack_corners }; + for (req.others) |doc| try cx.files.append(arena, .{ .path = doc.path, .text = doc.source }); tr.note("server {s} (pid {d}), root {s}, {s} columns", .{ @tagName(c.state), c.pid, c.root, @tagName(c.caps.enc), }); @@ -642,6 +643,7 @@ fn run(c: *Conn, si: usize, arena: std.mem.Allocator, req: lsp.Req, out: *std.Io n += 1; } }, + .callstack => try callstack(c, si, arena, &cx, uri.items, pos, deadline, tr, req.callstack_depth), .incoming_calls => try hierarchy(c, si, arena, &cx, uri.items, pos, deadline, .incoming, tr), .outgoing_calls => try hierarchy(c, si, arena, &cx, uri.items, pos, deadline, .outgoing, tr), .supertypes => try hierarchy(c, si, arena, &cx, uri.items, pos, deadline, .supers, tr), @@ -869,6 +871,184 @@ fn sortEdits(edits: []PutEdit) void { }.lt); } +/// A bounded static hierarchy. Reuse the prepared item verbatim (including +/// server data), and retain every call-site range rather than just a declaration. +fn hierarchyResult(c: *Conn, arena: std.mem.Allocator, item: std.json.Value, method: []const u8, deadline: i64) Err!?std.json.Value { + if (jsonDepth(item, 0) > 96) return null; + var body: std.ArrayList(u8) = .empty; + try app(&body, arena, "\"item\":"); + try app(&body, arena, std.json.Stringify.valueAlloc(arena, item, .{}) catch return error.OutOfMemory); + return call(c, arena, method, body.items, deadline); +} + +const CallTree = struct { + const Site = struct { range: std.json.Value, focus: bool }; + const Node = struct { + item: std.json.Value, + ranges: std.ArrayList(Site) = .empty, + children: std.ArrayList(usize) = .empty, + cycle: bool = false, + }; + nodes: std.ArrayList(Node) = .empty, + roots: std.ArrayList(usize) = .empty, + path: [lsp.callstack_max_depth]std.json.Value = undefined, + depth_limit: usize = lsp.callstack_default_depth, + visited: usize = 0, + limited: bool = false, + siblings: [lsp.callstack_max_depth]bool = @splat(false), + rendered: usize = 0, + + /// Incoming paths arrive nearest-first. Insert them outermost-first, + /// sharing common caller prefixes and retaining all their call sites. + fn addPath(tree: *CallTree, arena: std.mem.Allocator, path: []const std.json.Value, cycle: bool) Err!void { + var parent: ?usize = null; + var at = path.len; + while (at > 0) { + at -= 1; + const entry = path[at]; + const item = get(entry, "from").?; + const children = if (parent) |id| tree.nodes.items[id].children.items else tree.roots.items; + const found = for (children) |id| { + if (sameCall(tree.nodes.items[id].item, item)) break id; + } else null; + const id = found orelse blk: { + const id = tree.nodes.items.len; + try tree.nodes.append(arena, .{ .item = item }); + if (parent) |pid| { + try tree.nodes.items[pid].children.append(arena, id); + } else try tree.roots.append(arena, id); + break :blk id; + }; + const node = &tree.nodes.items[id]; + node.cycle = node.cycle or (cycle and at == 0); + for (items(get(entry, "fromRanges"))) |range| { + const parsed = rangeOf(range) orelse continue; + for (node.ranges.items) |*other| { + if (std.meta.eql(parsed, rangeOf(other.range).?)) { + other.focus = other.focus or at == 0; + break; + } + } else try node.ranges.append(arena, .{ .range = range, .focus = at == 0 }); + } + parent = id; + } + } +}; + +fn sameCall(a: std.json.Value, b: std.json.Value) bool { + const au = str(get(a, "uri")) orelse return false; + const bu = str(get(b, "uri")) orelse return false; + const ar = rangeOf(get(a, "selectionRange") orelse get(a, "range")) orelse return false; + const br = rangeOf(get(b, "selectionRange") orelse get(b, "range")) orelse return false; + return std.mem.eql(u8, au, bu) and std.meta.eql(ar, br); +} + +fn callPrefix(out: *std.Io.Writer, tree: *const CallTree, depth: usize) Err!void { + for (tree.siblings[0..depth]) |more| try out.writeAll(if (more) "│ " else " "); +} + +fn validCaller(entry: std.json.Value) bool { + const from = get(entry, "from") orelse return false; + const uri = str(get(from, "uri")) orelse return false; + return std.mem.startsWith(u8, uri, "file:") and + rangeOf(get(from, "selectionRange") orelse get(from, "range")) != null; +} + +fn callstack(c: *Conn, si: usize, arena: std.mem.Allocator, cx: *Cx, uri: []const u8, pos: Pos, deadline: i64, tr: *Trace, max_depth: u8) Err!void { + if (!c.caps.call_hier) return lsp.none(cx.out, "{s} does not answer call hierarchy (no callHierarchyProvider)", .{specs[si].name}); + const b = try atPos(arena, uri, pos); + const prepared = (try call(c, arena, "textDocument/prepareCallHierarchy", b.items, deadline)) orelse return; + if (items(prepared).len == 0) return lsp.none(cx.out, "no function at this position", .{}); + for (items(prepared)) |item| { + var tree: CallTree = .{ .depth_limit = std.math.clamp(max_depth, 1, lsp.callstack_max_depth) }; + const incoming = try hierarchyResult(c, arena, item, "callHierarchy/incomingCalls", deadline); + const count = try collectCallers(c, arena, item, incoming, deadline, &tree, 0); + if (count == 0) try cx.out.writeAll("No callers reported\n"); + try renderCallers(cx, c.caps.enc, &tree, tree.roots.items, 0); + if (tree.limited) try cx.out.writeAll("… continue from a function above with Callstack\n"); + tr.note("callstack: {d} callers", .{tree.rendered}); + } +} + +fn collectCallers(c: *Conn, arena: std.mem.Allocator, focus: std.json.Value, incoming: ?std.json.Value, deadline: i64, tree: *CallTree, depth: usize) Err!usize { + var count: usize = 0; + for (items(incoming)) |entry| { + if (tree.visited >= 64) { + tree.limited = true; + break; + } + if (!validCaller(entry)) continue; + const from = get(entry, "from").?; + const cycle = sameCall(focus, from) or for (tree.path[0..depth]) |ancestor| { + if (sameCall(get(ancestor, "from").?, from)) break true; + } else false; + tree.path[depth] = entry; + tree.visited += 1; + count += 1; + var children: usize = 0; + if (!cycle) { + if (depth + 1 == tree.depth_limit or tree.visited >= 64) { + tree.limited = true; + } else { + const ancestors = try hierarchyResult(c, arena, from, "callHierarchy/incomingCalls", deadline); + children = try collectCallers(c, arena, focus, ancestors, deadline, tree, depth + 1); + } + } + if (children == 0) try tree.addPath(arena, tree.path[0 .. depth + 1], cycle); + } + return count; +} + +fn callerLess(tree: *const CallTree, a: usize, b: usize) bool { + const left = tree.nodes.items[a].item; + const right = tree.nodes.items[b].item; + const uri_order = std.mem.order(u8, str(get(left, "uri")).?, str(get(right, "uri")).?); + if (uri_order != .eq) return uri_order == .lt; + return callRangeLess({}, get(left, "selectionRange") orelse get(left, "range").?, get(right, "selectionRange") orelse get(right, "range").?); +} + +fn callRangeLess(_: void, a: std.json.Value, b: std.json.Value) bool { + const left = rangeOf(a).?; + const right = rangeOf(b).?; + return left.sl < right.sl or (left.sl == right.sl and left.sc < right.sc); +} + +fn renderCallers(cx: *Cx, enc: Enc, tree: *CallTree, children: []usize, depth: usize) Err!void { + std.mem.sort(usize, children, @as(*const CallTree, tree), callerLess); + for (children, 0..) |id, index| { + if (tree.rendered >= 64) { + tree.limited = true; + return; + } + const node = &tree.nodes.items[id]; + const item = node.item; + const uri = str(get(item, "uri")).?; + const more = index + 1 < children.len; + try callPrefix(cx.out, tree, depth); + const has_children = node.children.items.len > 0 or node.ranges.items.len > 0; + const rounded = cx.callstack_corners == .rounded; + try cx.out.writeAll(if (more) "├" else if (rounded) "╰" else "└"); + try cx.out.writeAll(if (has_children) "──┬ " else "─── "); + const name = flat(cx.arena, str(get(item, "name")) orelse "(unnamed)"); + const label = if (node.cycle) try std.fmt.allocPrint(cx.arena, "{s} ↻ recursion", .{name}) else name; + try emitRange(cx, enc, uri, get(item, "selectionRange") orelse get(item, "range"), label); + tree.rendered += 1; + tree.siblings[depth] = more; + std.mem.sort(CallTree.Site, node.ranges.items, {}, struct { + fn less(_: void, a: CallTree.Site, b: CallTree.Site) bool { + return callRangeLess({}, a.range, b.range); + } + }.less); + for (node.ranges.items, 0..) |site, site_index| { + if (site.focus) try cx.out.writeAll(lsp.callstack_match); + try callPrefix(cx.out, tree, depth + 1); + try cx.out.writeAll(if (node.children.items.len > 0 or site_index + 1 < node.ranges.items.len) "├─ " else if (rounded) "╰─ " else "└─ "); + try emitRange(cx, enc, uri, site.range, ""); + } + try renderCallers(cx, enc, tree, node.children.items, depth + 1); + } +} + const Hier = enum { incoming, outgoing, supers, subs }; /// The two-step hierarchy kinds: prepare at the cursor, then follow every @@ -894,17 +1074,7 @@ fn hierarchy(c: *Conn, si: usize, arena: std.mem.Allocator, cx: *Cx, uri: []cons const b = try atPos(arena, uri, pos); const prepared = (try call(c, arena, prepare, b.items, deadline)) orelse return; for (items(prepared)) |item| { - // the item goes back VERBATIM — servers hide resolution state in - // `data` and a re-serialized subset would come back unresolvable. - // But only if it can round-trip: Stringify panics past its nesting - // limit, so a server that nests a bomb in `data` gets no rows for - // that item, not a dead editor. - if (jsonDepth(item, 0) > 96) continue; - var body: std.ArrayList(u8) = .empty; - try app(&body, arena, "\"item\":"); - const item_json = std.json.Stringify.valueAlloc(arena, item, .{}) catch return error.OutOfMemory; - try app(&body, arena, item_json); - const result = (try call(c, arena, follow, body.items, deadline)) orelse return; + const result = (try hierarchyResult(c, arena, item, follow, deadline)) orelse return; for (items(result)) |entry| switch (h) { .incoming => { // one row per CALL SITE, under the caller's name — that is @@ -965,6 +1135,8 @@ const Cx = struct { cur_src: []const u8, out: *std.Io.Writer, rows: usize = 0, + relative_parents: bool = false, + callstack_corners: lsp.CallstackCorners = .rounded, files: std.ArrayList(struct { path: []const u8, text: []const u8 }) = .empty, fn text(cx: *Cx, path: []const u8) ?[]const u8 { @@ -1018,7 +1190,10 @@ fn emitRange(cx: *Cx, enc: Enc, uri: []const u8, range: ?std.json.Value, note: [ const lntext: []const u8 = if (src) |t| t[@min(bol, t.len)..@min(eol, t.len)] else ""; const col = colBytes(lntext, r.sc, enc); - const shown = lsp.rel(cx.base, path); + const shown = if (cx.relative_parents) blk: { + const relative = std.fs.path.relativePosix(cx.arena, "/", cx.base, path) catch break :blk path; + break :blk if (relative.len < path.len) relative else path; + } else lsp.rel(cx.base, path); // A same-line exclusive end byte offset is also the displayed inclusive // one-based column. Multi-line ranges display only their starting address. const end_col = if (r.el == r.sl and r.ec > r.sc) colBytes(lntext, r.ec, enc) else col; @@ -2131,6 +2306,68 @@ fn coord(v: ?std.json.Value) ?u32 { // ----------------------------------------------------------------- tests +test "caller trees reverse incoming paths and merge shared callers and sites" { + var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator); + defer arena_state.deinit(); + const arena = arena_state.allocator(); + const fixture = try std.json.parseFromSliceLeaky(std.json.Value, arena, "[{\"from\":{\"name\":\"left\",\"uri\":\"file:///test.c\",\"selectionRange\":{\"start\":{\"line\":3,\"character\":0},\"end\":{\"line\":3,\"character\":4}}},\"fromRanges\":[{\"start\":{\"line\":3,\"character\":0},\"end\":{\"line\":3,\"character\":4}}]},{\"from\":{\"name\":\"right\",\"uri\":\"file:///test.c\",\"selectionRange\":{\"start\":{\"line\":4,\"character\":0},\"end\":{\"line\":4,\"character\":4}}},\"fromRanges\":[{\"start\":{\"line\":4,\"character\":0},\"end\":{\"line\":4,\"character\":4}}]},{\"from\":{\"name\":\"page\",\"uri\":\"file:///test.c\",\"selectionRange\":{\"start\":{\"line\":1,\"character\":0},\"end\":{\"line\":1,\"character\":4}}},\"fromRanges\":[{\"start\":{\"line\":1,\"character\":0},\"end\":{\"line\":1,\"character\":4}}]},{\"from\":{\"name\":\"page\",\"uri\":\"file:///test.c\",\"selectionRange\":{\"start\":{\"line\":1,\"character\":0},\"end\":{\"line\":1,\"character\":4}}},\"fromRanges\":[{\"start\":{\"line\":2,\"character\":0},\"end\":{\"line\":2,\"character\":4}}]},{\"from\":{\"name\":\"main\",\"uri\":\"file:///test.c\",\"selectionRange\":{\"start\":{\"line\":0,\"character\":0},\"end\":{\"line\":0,\"character\":4}}},\"fromRanges\":[{\"start\":{\"line\":0,\"character\":0},\"end\":{\"line\":0,\"character\":4}}]}]", .{}); + const entries = items(fixture); + var tree: CallTree = .{}; + try tree.addPath(arena, &.{ entries[0], entries[2], entries[4] }, false); + try tree.addPath(arena, &.{ entries[1], entries[3], entries[4] }, false); + try std.testing.expectEqual(@as(usize, 1), tree.roots.items.len); + try std.testing.expectEqual(@as(usize, 4), tree.nodes.items.len); + const root = tree.nodes.items[tree.roots.items[0]]; + try std.testing.expectEqualStrings("main", str(get(root.item, "name")).?); + try std.testing.expectEqual(@as(usize, 1), root.ranges.items.len); + const page = tree.nodes.items[root.children.items[0]]; + try std.testing.expectEqual(@as(usize, 2), page.children.items.len); + try std.testing.expectEqual(@as(usize, 2), page.ranges.items.len); + try std.testing.expect(!root.ranges.items[0].focus); + for (page.ranges.items) |site| try std.testing.expect(!site.focus); + for (page.children.items) |id| try std.testing.expect(tree.nodes.items[id].ranges.items[0].focus); + var out: std.Io.Writer.Allocating = .init(arena); + var cx: Cx = .{ .arena = arena, .base = "/", .cur_path = "/test.c", .cur_src = "main_call();\npage_left();\npage_right();\nleft_call();\nright_call();\n", .out = &out.writer }; + try renderCallers(&cx, .utf8, &tree, tree.roots.items, 0); + const text = out.written(); + try std.testing.expectEqual(@as(usize, 2), std.mem.count(u8, text, lsp.callstack_match)); + const main_at = std.mem.indexOf(u8, text, " main\n").?; + const page_at = std.mem.indexOf(u8, text, " page\n").?; + const left_at = std.mem.indexOf(u8, text, " left\n").?; + const right_at = std.mem.indexOf(u8, text, " right\n").?; + try std.testing.expect(main_at < page_at and page_at < left_at and left_at < right_at); + try std.testing.expectEqual(@as(usize, 1), std.mem.count(u8, text, "main_call();")); + try std.testing.expect(std.mem.indexOf(u8, text, "page_left();").? < std.mem.indexOf(u8, text, "page_right();").?); + try std.testing.expect(std.mem.indexOf(u8, text, "├──┬ test.c:4:") != null); + try std.testing.expect(std.mem.indexOf(u8, text, "╰──┬ test.c:1:") != null); + cx.callstack_corners = .square; + tree.rendered = 0; + const square_start = out.written().len; + try renderCallers(&cx, .utf8, &tree, tree.roots.items, 0); + const square = out.written()[square_start..]; + try std.testing.expect(std.mem.indexOf(u8, square, "├──┬ test.c:4:") != null); + try std.testing.expect(std.mem.indexOf(u8, square, "└──┬ test.c:1:") != null); + try std.testing.expect(std.mem.indexOf(u8, square, "╰") == null); + try std.testing.expect(std.mem.indexOf(u8, square, "╮") == null); + var recursive: CallTree = .{}; + try recursive.addPath(arena, &.{ entries[0], entries[0] }, true); + try std.testing.expect(!recursive.nodes.items[recursive.roots.items[0]].cycle); + try std.testing.expect(recursive.nodes.items[1].cycle); +} + +test "callstack cross-crate paths remain resolvable without absolute path clutter" { + var arena_state = std.heap.ArenaAllocator.init(std.testing.allocator); + defer arena_state.deinit(); + const arena = arena_state.allocator(); + const range = try std.json.parseFromSliceLeaky(std.json.Value, arena, + \\{"start":{"line":1,"character":3},"end":{"line":1,"character":6}} + , .{}); + var out: std.Io.Writer.Allocating = .init(arena); + var cx: Cx = .{ .arena = arena, .base = "/workspace/merkle-tree/src", .cur_path = "", .cur_src = "", .out = &out.writer, .relative_parents = true }; + try emitRange(&cx, .utf8, "file:///workspace/entry/src/entry.rs", range, "fn run()"); + try std.testing.expectEqualStrings("../../entry/src/entry.rs:2:4-6 fn run()\n", out.written()); +} + test "LSP client rename and format propagate incomplete edit encoding" { const gpa = std.testing.allocator; const uri = "file:///file.c"; diff --git a/src/modal.zig b/src/modal.zig index 548524ae..50e0ddf4 100644 --- a/src/modal.zig +++ b/src/modal.zig @@ -36,6 +36,7 @@ pub const Normal = struct { goto_type_definition, goto_implementation, goto_references, + goto_callstack, view_top, view_center, @@ -320,7 +321,7 @@ pub const Normal = struct { undo, redo, }; - pub const Lsp = enum { definition, declaration, type_definition, implementation, references, format }; + pub const Lsp = enum { definition, declaration, type_definition, implementation, references, callstack, format }; pub const Counted = struct { count: u32, @@ -471,6 +472,7 @@ pub const Normal = struct { if (key.has(.goto_type_definition)) return resultAction(.{ .lsp = .type_definition }); if (key.has(.goto_implementation)) return resultAction(.{ .lsp = .implementation }); if (key.has(.goto_references)) return resultAction(.{ .lsp = .references }); + if (key.has(.goto_callstack)) return resultAction(.{ .lsp = .callstack }); return .ignored; }, .view => { diff --git a/src/mouse.zig b/src/mouse.zig index 733479dd..536a4fdb 100644 --- a/src/mouse.zig +++ b/src/mouse.zig @@ -100,7 +100,7 @@ pub const HeaderSweep = struct { /// as a pane tag's sweep stays on its tag. fn headerPoint(p: *Pardes, column: ?usize, mcol: u16, mrow: u16, clamp: bool) ?struct { t: *panes.Text, text: []const u8, line: u16, at: usize } { const t = if (column) |c| &p.col_tags[c] else &p.global_tag; - const x = if (column) |c| p.col_x[c] + TAG_TEXT_INSET else 0; + const x = if (column) |c| p.col_x[c] + TAG_TEXT_INSET else TAG_TEXT_INSET; const focused = p.header_focus and p.header_column == column; const text = edit.flatSurface(p, t) catch return null; const base = if (column != null) p.topBarHeight() else 0; @@ -588,7 +588,7 @@ pub fn handleMouse(p: *Pardes, event: Mouse) void { p.header_drag = false; return; }; - const x = if (p.header_column) |c| p.col_x[c] + TAG_TEXT_INSET else 0; + const x = if (p.header_column) |c| p.col_x[c] + TAG_TEXT_INSET else TAG_TEXT_INSET; const text = edit.flatSurface(p, t) catch return; // `row` is the header's row on screen, `line` the line of its text // shown there. @@ -612,7 +612,8 @@ pub fn handleMouse(p: *Pardes, event: Mouse) void { pane.closePrompt(); }; var column: ?usize = null; - var x: u16 = 0; + var x: u16 = TAG_TEXT_INSET; + if (mcol < x) return; if (mrow >= p.topBarHeight()) { for (0..p.ncol) |c| if (mcol >= p.col_x[c] and mcol < p.col_x[c] + p.col_w[c]) { column = c; @@ -1047,7 +1048,7 @@ fn gestureRange(p: *Pardes, id: usize, text: []const u8, on_tag: bool, operand: const top = lead[0] - @as(i32, pane.tag_rows); if (top < 0) break :lead null; const w = pane.wrapAt(top); - const col = edit.paneByteAtDisplay(p, &pane.body, w.line, w.at, lead[1] - panes.File.gutterWidth(pane)); + const col = edit.paneByteAtDisplay(p, &pane.body, w.line, w.at, lead[1] - panes.File.gutterWidth(pane) - w.pad); break :lead .{ .row = @intCast(@max(0, w.line)), .col = @intCast(@max(0, col)), @@ -1154,7 +1155,7 @@ fn sweepPoint(p: *Pardes, pane: *panes.Pane, r: i32, c: i32) ?modal.Cursor { if (visible < 0) return null; const w = pane.wrapAt(visible); if (w.line < 0) return null; - const col = edit.paneByteAtDisplay(p, &pane.body, w.line, w.at, c - (if (pane.file != null) @as(i32, panes.File.gutterWidth(pane)) else 0)); + const col = edit.paneByteAtDisplay(p, &pane.body, w.line, w.at, c - w.pad - (if (pane.file != null) @as(i32, panes.File.gutterWidth(pane)) else 0)); return .{ .row = @intCast(w.line), .col = @intCast(@max(0, col)) }; } @@ -1268,7 +1269,7 @@ fn dragRelease(p: *Pardes, button: Mouse.Button) void { &pane.body, w.line, w.at, - sl.c1 - (if (pane.file != null) @as(i32, panes.File.gutterWidth(pane)) else 0), + sl.c1 - w.pad - (if (pane.file != null) @as(i32, panes.File.gutterWidth(pane)) else 0), ); pane.body.cur_pinned = true; if (edit.clampFileCursor(&pane.body)) pane.ensureCursorVisible(); @@ -1312,7 +1313,14 @@ fn dragRelease(p: *Pardes, button: Mouse.Button) void { pane.sel[b] = expanded else if (operand.text == null) pane.sel[b].state = .none; - if (s.button == config.look_button and clk.r0 >= pane.tag_rows and pane.body.mode != .tty) { + if (s.button == config.look_button and clk.r0 >= pane.tag_rows and pane.body.mode != .tty and operand.expanded != null) { + // This click chose a new word. An old keyboard anchor + // must not stretch to it; borrowed selections retain + // their original cursor and extent. + pane.body.vsel.active = false; + pane.body.msel.active = false; + pane.body.nsel = 0; + pane.body.select = false; pane.body.cur_row = operand.row; pane.body.cur_col = operand.col; if (edit.clampFileCursor(&pane.body)) pane.ensureCursorVisible(); @@ -1431,8 +1439,8 @@ fn chordCutPaste(p: *Pardes, cut: bool) void { const w1 = pane.wrapAt(@max(0, sl.r1 - @as(i32, pane.tag_rows))); const row0 = w0.line; const row1 = w1.line; - const col0 = edit.paneByteAtDisplay(p, &pane.body, w0.line, w0.at, sl.c0 - pfx); - const col1 = edit.paneByteAtDisplay(p, &pane.body, w1.line, w1.at, sl.c1 - pfx); + const col0 = edit.paneByteAtDisplay(p, &pane.body, w0.line, w0.at, sl.c0 - pfx - w0.pad); + const col1 = edit.paneByteAtDisplay(p, &pane.body, w1.line, w1.at, sl.c1 - pfx - w1.pad); pane.body.cur_row = row1; pane.body.cur_col = col1; pane.body.cur_pinned = true; diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index e6e738a5..f6457b83 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -554,6 +554,7 @@ fn checkBuiltin(p: *Pardes, req: Req, line: []const u8, scope: builtins.Scope) ? .font => config.Runtime.FontSpec.parse(arg) != null, // Bare, it says the width, as from a pane's exec. .tab => arg.len == 0 or (std.fmt.parseInt(u16, arg, 10) catch 0) -% 1 < 16, + .callstack_depth => arg.len == 0 or (std.fmt.parseInt(u8, arg, 10) catch 0) -% 1 < pardes.lsp.callstack_max_depth, else => probe: { var probe = p.settings; break :probe probe.apply(setting, if (arg.len > 0) arg else null); @@ -662,6 +663,7 @@ pub fn writeSettingsOf(p: *Pardes, s: *const config.Runtime, w: *std.Io.Writer) .motion => try w.print("{s} {s}\n", .{ word, @tagName(s.motion) }), .inactive_dim => try w.print("{s} {d}\n", .{ word, s.inactive_dim }), .grip_width => try w.print("{s} {d}\n", .{ word, s.grip_width }), + .callstack_depth => try w.print("{s} {d}\n", .{ word, s.callstack_depth }), .tab => try w.print("{s} {d}\n", .{ word, s.tab }), } } @@ -743,12 +745,13 @@ pub fn fillPager(p: *Pardes, serial: u32, held: *std.ArrayList(u8)) error{OutOfM f.pager_spans = page.spans; f.saved_revision = f.revision; // A diff paged (`git show`, difftui's patches): its hunks stacked in a - // +Diff (DiffLook hunks), the +Pager folded to its tag under it for - // Diff to bring back. The keyboard stays where it was, as a page's. + // +Diff (DiffLook hunks) in the +Pager's place, the +Pager closed. The + // keyboard stays where it was, as a page's. if (f.pager_diff and p.settings.diff_look == .hunks) { const keyboard = p.active; - if (panes.Output.openDiff(p, id, f.path, f.content)) |_| { - if (!pane.collapsed) pardes.layout.toggleCollapse(p, id); + if (panes.Output.openDiff(p, id, f.path, f.content)) |hid| { + // ponytail: the text is gone with it; Diff on the +Diff says no such file. + p.removePane(id, hid) catch {}; } else |_| {} if (p.panes[keyboard] != null) p.active = keyboard; } @@ -1452,6 +1455,8 @@ test "the root ctl reads the settings as a write takes them, and takes the sessi try testing.expectEqual(@as(u64, settings.len), call(p, .{ .tag = 1, .op = .getattr, .node = root_ctl }).reply.attr.size); try testing.expect(std.mem.indexOf(u8, settings, "Verbose on\n") != null); try testing.expect(std.mem.indexOf(u8, settings, "LocationsConfig ") != null); + try testing.expect(std.mem.indexOf(u8, settings, "CallstackDepth 8\n") != null); + try testing.expectEqual(Status.ok, wr(p, root_ctl, "CallstackDepth").reply.status); // Settings only: nothing /status or the DumpConfig window says. try testing.expect(std.mem.indexOf(u8, settings, "Platform") == null); try testing.expect(std.mem.indexOf(u8, settings, "requested") == null); @@ -1494,7 +1499,6 @@ test "the root ctl reads the settings as a write takes them, and takes the sessi try testing.expectEqual(Status.ok, wr(p, root_ctl, "Verbose off").reply.status); } - test "a second lock is refused until the holder unlocks or closes, and binds nobody else" { const p = try withFile(testing.allocator, "one\ntwo\n"); defer p.deinit(); @@ -3920,7 +3924,7 @@ test "a closed file is found again: Recent and /recent list it closed, a look at try testing.expectEqual(Status.ok, wr(p, root_exec, "Recent\n").reply.status); const rows = p.panes[p.paneBySerial(try std.fmt.parseInt(u32, std.mem.trimEnd(u8, rd(p, root_exec, 0, 64).bytes, "\n"), 10)).?].?; const at = std.mem.indexOf(u8, rows.file.?.content, try std.fmt.bufPrint(&want, "{s}:3:", .{a})).?; - const row = rows.file.?.content[at .. std.mem.indexOfScalarPos(u8, rows.file.?.content, at, '\n').?]; + const row = rows.file.?.content[at..std.mem.indexOfScalarPos(u8, rows.file.?.content, at, '\n').?]; try testing.expect(std.mem.endsWith(u8, row, " (closed)")); try testing.expectEqual(Status.ok, wr(p, Node.of(rows.serial, .look), try std.fmt.bufPrint(&line, "{s}\n", .{row[0 .. row.len - " (closed)".len]})).reply.status); p.sync(); @@ -4159,11 +4163,11 @@ test "a remembered place is clamped to the file as it is now, its selection's tw _ = wr(p, root_exec, "Recent\n"); const rows = p.panes[p.paneBySerial(try std.fmt.parseInt(u32, std.mem.trimEnd(u8, rd(p, root_exec, 0, 64).bytes, "\n"), 10)).?].?; const at = std.mem.indexOf(u8, rows.file.?.content, "c.txt:").?; - const row = rows.file.?.content[at .. std.mem.indexOfScalarPos(u8, rows.file.?.content, at, '\n').?]; + const row = rows.file.?.content[at..std.mem.indexOfScalarPos(u8, rows.file.?.content, at, '\n').?]; // Both ends are in the row, a range. try testing.expect(std.mem.indexOfScalar(u8, row, '-') != null); var full: [4400]u8 = undefined; - const loc = try std.fmt.bufPrint(&full, "{s}/{s}\n", .{ dir, row[0 .. std.mem.indexOfScalar(u8, row, ' ').?] }); + const loc = try std.fmt.bufPrint(&full, "{s}/{s}\n", .{ dir, row[0..std.mem.indexOfScalar(u8, row, ' ').?] }); // A look at it opens the file, never a miss, clamped to its last line. try testing.expectEqual(Status.ok, wr(p, Node.of(rows.serial, .look), loc).reply.status); p.sync(); @@ -4350,7 +4354,7 @@ test "every word's /commands description is its own doc comment's first sentence undescribed += 1; continue; }; - const word = line[0 .. std.mem.indexOfScalar(u8, line, ' ').?]; + const word = line[0..std.mem.indexOfScalar(u8, line, ' ').?]; if (config.Runtime.find(word)) |setting| { try testing.expect(std.mem.endsWith(u8, line, setting.doc)); continue; diff --git a/src/normal.zig b/src/normal.zig index fad1836b..77feb7cf 100644 --- a/src/normal.zig +++ b/src/normal.zig @@ -905,10 +905,11 @@ fn executeNormalAction(p: *Pardes, t: *Text, semantic: modal.Normal.Action) void .undo => return edit.doUndo(p, t), .redo => return edit.doRedo(p, t), }, - // gd and gr are the Def and Refs a tag shows, run as a click runs them. + // Language shortcuts run the same builtins as tags and leader commands. .lsp => |request| return switch (request) { .definition => exec.runBuiltin(p, .Def, p.active, "", null), .references => exec.runBuiltin(p, .Refs, p.active, "", null), + .callstack => exec.runBuiltin(p, .Callstack, p.active, "", null), .declaration => p.lspRequest(p.active, .declaration, ""), .type_definition => p.lspRequest(p.active, .type_definition, ""), .implementation => p.lspRequest(p.active, .implementation, ""), diff --git a/src/panes.zig b/src/panes.zig index 89362996..ba1dedb5 100644 --- a/src/panes.zig +++ b/src/panes.zig @@ -219,6 +219,7 @@ pub const Pane = struct { // Visible rows map to source lines and raw/display column origins. wrap_line: [limits.wrap_rows]i32 = undefined, wrap_col: [limits.wrap_rows]i32 = undefined, + wrap_pad: [limits.wrap_rows]u16 = @splat(0), wrap_n: u16 = 0, /// A row map also exists for sticky headers when soft wrapping is off. body_wrapped: bool = false, @@ -493,15 +494,15 @@ pub const Pane = struct { return pane.surfRow(terminal.gridOffset(pane)); } - pub fn wrapAt(pane: *Pane, vr: i32) struct { line: i32, at: i32 } { + pub fn wrapAt(pane: *Pane, vr: i32) struct { line: i32, at: i32, pad: i32 = 0 } { if (pane.wrap_n > 0 and vr >= 0 and vr < @as(i32, pane.wrap_n)) - return .{ .line = pane.wrap_line[@intCast(vr)], .at = pane.wrap_col[@intCast(vr)] }; + return .{ .line = pane.wrap_line[@intCast(vr)], .at = pane.wrap_col[@intCast(vr)], .pad = pane.wrap_pad[@intCast(vr)] }; // unwrapped: rows ARE lines, and the byte column a row starts at is the // horizontal scroll (always 0 on a terminal, which never has one) return .{ .line = pane.scroll() + vr, .at = pane.hscroll }; } - pub fn wrapRow(pane: *Pane, line: i32, col: i32) struct { row: i32, at: i32 } { + pub fn wrapRow(pane: *Pane, line: i32, col: i32) struct { row: i32, at: i32, pad: i32 = 0 } { if (pane.wrap_n == 0) return .{ .row = line - pane.scroll(), .at = pane.hscroll }; var i: u16 = 0; while (i < pane.wrap_n) : (i += 1) { @@ -509,7 +510,7 @@ pub const Pane = struct { // the LAST row of a line owns every column past its start, so a // cursor parked on the trailing newline still has somewhere to draw if (i + 1 < pane.wrap_n and pane.wrap_line[i + 1] == line and col >= pane.wrap_col[i + 1]) continue; - return .{ .row = @intCast(i), .at = pane.wrap_col[i] }; + return .{ .row = @intCast(i), .at = pane.wrap_col[i], .pad = pane.wrap_pad[i] }; } return .{ .row = -1, .at = 0 }; } diff --git a/src/pardes.zig b/src/pardes.zig index 29192c33..5f330712 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -220,7 +220,6 @@ pub const Turn = struct { while (t.lsp_answers == answers) t.settled.wait(t.io.?, &t.mutex) catch return; } - pub fn awaitRestored(t: *Turn, restores: u64) void { while (t.restores == restores) t.settled.wait(t.io.?, &t.mutex) catch return; } @@ -294,7 +293,7 @@ pub const MAX_JUMPS = 64; pub const TOPBAR_H: u16 = 1; pub const COLBAR_H: u16 = 1; pub const BOX_H: u16 = 1; -pub const TAG_GAP: u16 = 1; +pub const TAG_GAP: u16 = 0; pub const TAG_TEXT_INSET: u16 = config.GUTTER + TAG_GAP; pub fn taglineBandOffset(row: u16, canvas_h: f32, cell_h: u32, tagline_h: u32) u32 { @@ -655,25 +654,25 @@ test "topbar hover highlights exactly the executable word" { defer frame.deinit(); _ = try p.render(frame.allocator()); - p.update(.{ .mouse = .{ .button = .none, .kind = .motion, .col = 1, .row = 0 } }); + p.update(.{ .mouse = .{ .button = .none, .kind = .motion, .col = TAG_TEXT_INSET + 1, .row = 0 } }); _ = frame.reset(.retain_capacity); const hovered = try p.render(frame.allocator()); for (0.."Newcol".len) |col| { - const cell = hovered.at(@intCast(col), 0); + const cell = hovered.at(TAG_TEXT_INSET + @as(u16, @intCast(col)), 0); try std.testing.expectEqual(Color{ .rgb = p.theme().sel_bg }, cell.style.bg); try std.testing.expectEqual(Color{ .rgb = p.theme().sel_fg }, cell.style.fg); } - try std.testing.expectEqual(Color{ .rgb = p.chromeTheme().tag_bg }, hovered.at(6, 0).style.bg); + try std.testing.expectEqual(Color{ .rgb = p.chromeTheme().tag_bg }, hovered.at(TAG_TEXT_INSET + 6, 0).style.bg); - p.update(.{ .mouse = .{ .button = .none, .kind = .motion, .col = 6, .row = 0 } }); + p.update(.{ .mouse = .{ .button = .none, .kind = .motion, .col = TAG_TEXT_INSET + 6, .row = 0 } }); _ = frame.reset(.retain_capacity); const whitespace = try p.render(frame.allocator()); - try std.testing.expectEqual(Color{ .rgb = p.chromeTheme().tag_bg }, whitespace.at(1, 0).style.bg); + try std.testing.expectEqual(Color{ .rgb = p.chromeTheme().tag_bg }, whitespace.at(TAG_TEXT_INSET + 1, 0).style.bg); p.update(.pointer_leave); _ = frame.reset(.retain_capacity); const left = try p.render(frame.allocator()); - try std.testing.expectEqual(Color{ .rgb = p.chromeTheme().tag_bg }, left.at(1, 0).style.bg); + try std.testing.expectEqual(Color{ .rgb = p.chromeTheme().tag_bg }, left.at(TAG_TEXT_INSET + 1, 0).style.bg); } test "pane-tag Exec prefers Tty and argument builtins before shell fallback" { @@ -1216,7 +1215,7 @@ test "Def and Refs are a speaking file's tag words; gd, gr and a 2-1 chord all r const f = &pane.file.?; p.gpa.free(f.path); f.path = try p.gpa.dupe(u8, "/tmp/x.zig"); - try std.testing.expect(std.mem.endsWith(u8, tagline.curTail(pane), " Def Refs")); + try std.testing.expect(std.mem.endsWith(u8, tagline.curTail(pane), " Def Refs Del")); p.sync(); while (p.nextEffect()) |_| {} const Asked = struct { @@ -1241,6 +1240,9 @@ test "Def and Refs are a speaking file's tag words; gd, gr and a 2-1 chord all r p.update(.{ .key = .{ .cp = 'g' } }); p.update(.{ .key = .{ .cp = 'r' } }); try std.testing.expectEqual(@as(u32, 8), try Asked.one(p, .references)); + p.update(.{ .key = .{ .cp = 'g' } }); + p.update(.{ .key = .{ .cp = 'c' } }); + try std.testing.expectEqual(@as(u32, 8), try Asked.one(p, .callstack)); const r = p.rects[0]; const x0 = r.x + config.GUTTER + panes.File.gutterWidth(pane); @@ -1525,7 +1527,6 @@ test "unknown Exec from a document runs as a command pane in its directory, type try std.testing.expect(spawned); } - const FakeTtyQuery = struct { taken: [MAX_PANES]bool = @splat(false), asked: usize = 0, @@ -2009,7 +2010,6 @@ test "a command pane shows how its command ended, and the next command there run try std.testing.expectEqual(@as(?usize, null), exec.execute(p, 1, long)); } - test "image dump restores source bytes renderer choices and exact custom tail" { const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true }); @@ -2062,7 +2062,6 @@ test "image dump restores source bytes renderer choices and exact custom tail" { try std.testing.expectEqualStrings(" Keep Del", redump.panes[0].tag_tail.?); } - test "a Look on a directory does not type ls into an occupied terminal" { const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .cols = 100, .rows = 30 }); @@ -3374,9 +3373,9 @@ test "editable workspace and column tags are typed into and persist" { p.acknowledgePanelPresentation(&.{}); try std.testing.expectEqual(TOPBAR_H + COLBAR_H, p.rects[0].y); // a sweep over a header is its selection, the caret where it ended - p.update(.{ .mouse = .{ .button = .left, .kind = .press, .col = 0, .row = 0 } }); - p.update(.{ .mouse = .{ .button = .left, .kind = .drag, .col = 6, .row = 0 } }); - p.update(.{ .mouse = .{ .button = .left, .kind = .release, .col = 6, .row = 0 } }); + p.update(.{ .mouse = .{ .button = .left, .kind = .press, .col = TAG_TEXT_INSET, .row = 0 } }); + p.update(.{ .mouse = .{ .button = .left, .kind = .drag, .col = TAG_TEXT_INSET + 6, .row = 0 } }); + p.update(.{ .mouse = .{ .button = .left, .kind = .release, .col = TAG_TEXT_INSET + 6, .row = 0 } }); try std.testing.expect(p.global_tag.vsel.active and p.global_tag.vsel.col == 0 and p.global_tag.cur_col == 6); p.update(.{ .key = .{ .cp = 'H', .text = " Help" } }); try std.testing.expect(std.mem.startsWith(u8, p.global_tag.own.?, "Newcol Help Joincol")); @@ -6966,6 +6965,7 @@ pub const Pardes = struct { .definition => "Def", .references => "Refs", .explain => "Lspwhy", + .callstack => "Callstack", .incoming_calls => "Callers", .outgoing_calls => "Callees", .document_symbols => "Symbols", @@ -7081,6 +7081,18 @@ pub const Pardes = struct { // (a multi-file Rename's preview, Lspinfo's +Lsp), made or filled // again, not the pane it was asked from. p.fs.lsp_result = if (p.next_serial != serial_before) p.next_serial else p.fs.refilled; + if (w.kind == .callstack) { + for (p.panes, 0..) |slot, result_id| if (slot) |result_pane| { + if (result_pane.serial != p.fs.lsp_result) continue; + if (p.next_serial != serial_before) { + const report_rows = std.mem.count(u8, result_pane.file.?.content, "\n"); + const wanted: u16 = @intCast(@min(p.screen_h, report_rows + result_pane.tag_rows)); + layout.givePaneRows(p, result_id, wanted, w.pane); + } + look.focusPaneLine(p, result_id, .{ .line = 1, .col = 1 }, .keep); + break; + }; + } if (w.kind == .rename) { var said_buf: [128]u8 = undefined; // Rows that only name a file the server left alone (lsp_client @@ -7624,7 +7636,6 @@ pub const Pardes = struct { return if (frames) |n| p.stepped_ns + n * animation.frame_ns else null; } - /// A render-time animation is moving (a pane's lift): it is sampled at /// each frame's own `now`, so while it moves the shell draws every loop /// and its present (vsync) paces it, at the display's rate. `nextWake` @@ -8514,6 +8525,44 @@ test "the jump list never holds two entries in a row the same, when the one betw try std.testing.expectEqual(@as(u32, 150), p.jumps[1].line); } +test "Callstack always opens and focuses its own pane, reusing it for another symbol" { + if (!lsp.supports.contains(.callstack)) return; + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true }); + defer p.deinit(); + _ = try p.setTestFile("fn work() {}\n"); + const source = p.panes[0].?; + p.lspRequest(0, .callstack, ""); + const first = p.lsp_wait orelse return error.NoRequest; + p.lspResponse(first.id, "└──┬ /test.txt:1:4-7 work\n@callstack-match └─ /test.txt:1:4-7 fn work() {}\n"); + const report = p.panes[p.active].?; + try std.testing.expect(report != source); + try std.testing.expect(std.mem.endsWith(u8, report.file.?.path, "/+Callstack")); + try std.testing.expectEqual(@as(i32, 0), source.body.cur_row); + const stale_selection = std.mem.indexOfScalar(u8, report.file.?.content, '\n').? + 1; + report.body.setRange(report.file.?.content, 0, .{ .anchor = stale_selection, .head = stale_selection + 6 }, true); + layout.toggleCollapse(p, 0); + var frame = std.heap.ArenaAllocator.init(std.testing.allocator); + defer frame.deinit(); + const surface = try p.render(frame.allocator()); + p.acknowledgePanelPresentation(&.{}); + const r = p.rects[p.active]; + const row = r.y + report.tag_rows; + const col = r.x + config.GUTTER + panes.File.gutterWidth(report) + 7; + try std.testing.expectEqual(.off, surface.at(col, row).style.ul); + p.update(.{ .mouse = .{ .button = .right, .kind = .press, .row = row, .col = col } }); + p.update(.{ .mouse = .{ .button = .right, .kind = .release, .row = row, .col = col } }); + try std.testing.expect(!source.collapsed); + try std.testing.expectEqual(@as(usize, 0), p.active); + try std.testing.expect(!report.body.vsel.active); + try std.testing.expectEqual(@as(usize, 0), report.body.nsel); + const serial = report.serial; + p.lspRequest(0, .callstack, ""); + const second = p.lsp_wait orelse return error.NoRequest; + p.lspResponse(second.id, "No callers reported\n"); + try std.testing.expectEqual(serial, p.panes[p.active].?.serial); + try std.testing.expectEqualStrings("No callers reported\n", p.panes[p.active].?.file.?.content); +} + test "Callers with one answer jumps to it and says where, in a msg" { if (!lsp.supports.contains(.incoming_calls)) return; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true }); diff --git a/src/syntax.zig b/src/syntax.zig index 89d96239..b2f5ea99 100644 --- a/src/syntax.zig +++ b/src/syntax.zig @@ -414,7 +414,6 @@ pub fn walkNodes(tree_ptr: *anyopaque, walk: NodeWalk, from: usize, to: usize, a return 1; } - /// helix's textobjects, which its `]f`, `mif` and kin select: the name a /// query's captures begin with (`function.around`, `test.inside`). pub const Object = @import("modal.zig").Normal.Object; @@ -940,13 +939,10 @@ pub fn highlightLocationRows(gpa: std.mem.Allocator, content: []const u8, rows: } fn codeAfterLocation(line: []const u8) ?struct { path: []const u8, at: usize, text: []const u8 } { - const token_end = std.mem.indexOfAny(u8, line, " \t") orelse return null; - if (token_end == 0) return null; - const token = line[0..token_end]; - const target = look.parsePathLine(token); - if (target.end != token.len) return null; + const trimmed = std.mem.trimStart(u8, line, " \t"); + const target = @import("locations.zig").parseRaw(trimmed); if (target.at.line == 0) return null; - const at = token_end + 1; + const at = line.len - trimmed.len + target.code_start; if (at >= line.len) return null; return .{ .path = target.path, .at = at, .text = line[at..] }; } @@ -1355,6 +1351,11 @@ test "syntax codeAfterLocation takes whole-token locations and nothing else" { try std.testing.expect(codeAfterLocation("src/x.zig:7:2") == null); try std.testing.expect(codeAfterLocation("") == null); try std.testing.expect(codeAfterLocation(" leading space") == null); + const indented = " some directory/x.zig:7:2-9 return 42;"; + const nested = codeAfterLocation(indented) orelse return error.ShouldBeALocation; + try std.testing.expectEqualStrings("some directory/x.zig", nested.path); + try std.testing.expectEqualStrings(" return 42;", nested.text); + try std.testing.expectEqualStrings(nested.text, indented[nested.at..]); } test "syntax default full grammar set highlights Typst source" { @@ -1736,6 +1737,7 @@ test "syntax result fragments preserve source indentation and inline markup" { defer stop(); const fixtures = [_]struct { path: []const u8, source: []const u8 }{ .{ .path = "a.zig", .source = " const number = 42; // note" }, + .{ .path = " nested path/a.zig", .source = " return call(42, \"hello\"); // note" }, .{ .path = "a.md", .source = "# Heading *slant*" }, .{ .path = "a.md", .source = "**bold** and `code`" }, .{ .path = "a.md", .source = " # this is indented code" }, @@ -1961,4 +1963,3 @@ test "syntax source analysis preserves declarations and injected colors" { try std.testing.expectEqual(@as(usize, 0), unsupported.declarations.len); try std.testing.expectEqual(@as(usize, 0), unsupported.colors.len); } - diff --git a/src/tagline.zig b/src/tagline.zig index cf0b17fd..b6601d61 100644 --- a/src/tagline.zig +++ b/src/tagline.zig @@ -19,15 +19,19 @@ const Pardes = pardes.Pardes; pub const pane_tail = " " ++ config.pane_builtins_str; pub const pdf_pane_tail = " " ++ config.pdf_pane_builtins_str; pub const file_pane_tail = " " ++ config.file_pane_builtins_str; -pub const context_pane_tail = file_pane_tail ++ " TreeContext"; -pub const locations_pane_tail = file_pane_tail ++ " LocationsConfig"; -/// A file a language server speaks for (by its extension): its jumps too. -pub const lsp_pane_tail = file_pane_tail ++ " " ++ config.lsp_pane_builtins_str; -pub const lsp_context_pane_tail = context_pane_tail ++ " " ++ config.lsp_pane_builtins_str; +fn withFileCommands(comptime tail: []const u8, comptime words: []const u8) []const u8 { + std.debug.assert(std.mem.endsWith(u8, tail, " Del")); + return tail[0 .. tail.len - " Del".len] ++ " " ++ words ++ " Del"; +} +pub const context_pane_tail = withFileCommands(file_pane_tail, "TreeContext"); +pub const locations_pane_tail = withFileCommands(file_pane_tail, "LocationsConfig"); +/// Language commands precede the final Del, like other file-pane commands. +pub const lsp_pane_tail = withFileCommands(file_pane_tail, config.lsp_pane_builtins_str); +pub const lsp_context_pane_tail = withFileCommands(context_pane_tail, config.lsp_pane_builtins_str); pub const pager_pane_tail = " " ++ config.pager_pane_builtins_str; pub const diff_pane_tail = " " ++ config.diff_pane_builtins_str; pub const pager_diff_pane_tail = " " ++ config.pager_diff_pane_builtins_str; -pub const diff_view_tail = " " ++ config.diff_view_builtins_str ++ " LocationsConfig"; +pub const diff_view_tail = withFileCommands(" " ++ config.diff_view_builtins_str, "LocationsConfig"); pub const terminal_pane_tail = " " ++ config.terminal_pane_builtins_str; pub const command_pane_tail = " " ++ config.command_pane_builtins_str; pub const dir_pane_tail = " " ++ config.dir_pane_builtins_str; @@ -76,7 +80,7 @@ pub fn revealHeader(p: *Pardes) void { if (cur < p.header_top) p.header_top = cur; if (rows > 0 and cur >= p.header_top + rows) p.header_top = cur + 1 - rows; const line = modal.lineSlice(text, cur); - const width = p.tagCapacity(if (p.header_column) |c| p.col_w[c] -| TAG_TEXT_INSET else p.screen_w); + const width = p.tagCapacity(if (p.header_column) |c| p.col_w[c] -| TAG_TEXT_INSET else p.screen_w -| TAG_TEXT_INSET); const col = panes.File.rawDisplayCol(line, @min(@as(usize, @intCast(@max(0, t.cur_col))), line.len)); if (col < p.header_scroll) p.header_scroll = col; if (col >= p.header_scroll + width) p.header_scroll = col -| (width -| 1); @@ -480,4 +484,3 @@ test "a pane tag wraps a long line onto rows, and offsets map both ways" { try std.testing.expectEqual(@as(usize, 10), shown.toReal(11)); // the 'e' of Del try std.testing.expectEqual(@as(usize, 11), shown.fromReal(10)); } - diff --git a/test/column_drag.zig b/test/column_drag.zig index 89508800..a089ab4a 100644 --- a/test/column_drag.zig +++ b/test/column_drag.zig @@ -153,12 +153,14 @@ test "column grip is separate from compact text and the resize seam" { try std.testing.expectEqual(pardes.FontRole.tagline, surface.at(rect.x + pardes.TAG_TEXT_INSET, pardes.TOPBAR_H).style.font_role); try std.testing.expectEqual(pardes.FontRole.tagline, surface.at(rect.x + pardes.TAG_TEXT_INSET, pane_tag_y).style.font_role); } - const gap_x = p.col_x[1] + config.GUTTER; - try std.testing.expectEqualStrings(" ", p.surface.at(gap_x, pardes.TOPBAR_H).grapheme()); - mouse(p, .press, gap_x); - try std.testing.expect(p.drag != .column_move); - try std.testing.expect(!p.header_drag); - mouse(p, .release, gap_x); + if (pardes.TAG_GAP > 0) { + const gap_x = p.col_x[1] + config.GUTTER; + try std.testing.expectEqualStrings(" ", p.surface.at(gap_x, pardes.TOPBAR_H).grapheme()); + mouse(p, .press, gap_x); + try std.testing.expect(p.drag != .column_move); + try std.testing.expect(!p.header_drag); + mouse(p, .release, gap_x); + } p.update(.{ .mouse = headerMouse(layer, 0, .press) }); try std.testing.expect(p.drag != .column_move); try std.testing.expect(p.header_drag); diff --git a/test/hxcases/waivers.jsonl b/test/hxcases/waivers.jsonl index 6abc7de2..34687480 100644 --- a/test/hxcases/waivers.jsonl +++ b/test/hxcases/waivers.jsonl @@ -1,2 +1,3 @@ {"name":"alt-c-window-op","reason":"Alt-c moves a pane to a new column instead of Helix's change-noyank.","reference":{"name":"alt-c-window-op","text":"bc def\n","mode":"insert","cursor":{"row":0,"col":0},"anchor":{"row":0,"col":0}},"expected":{"name":"alt-c-window-op","text":"abc def\n","mode":"normal","cursor":{"row":0,"col":0},"anchor":{"row":0,"col":0}}} {"name":"msel-ins-checkpoint","reason":"Undo restores the primary range alone: a history entry keeps one range, not every one, so the others stay where the edit left them.","reference":{"name":"msel-ins-checkpoint","text":"Xab\nXab\n","mode":"normal","cursor":{"row":1,"col":1},"anchor":{"row":1,"col":1},"sels":[{"cursor":{"row":0,"col":1},"anchor":{"row":0,"col":1}},{"cursor":{"row":1,"col":1},"anchor":{"row":1,"col":1}}],"primary":1},"expected":{"name":"msel-ins-checkpoint","text":"Xab\nXab\n","mode":"normal","cursor":{"row":1,"col":1},"anchor":{"row":1,"col":1},"sels":[{"cursor":{"row":0,"col":2},"anchor":{"row":0,"col":2}},{"cursor":{"row":1,"col":1},"anchor":{"row":1,"col":1}}],"primary":1}} +{"name":"gc-noscroll","reason":"gc runs the Callstack builtin at the cursor instead of moving to the viewport center; with no language server the cursor stays put.","reference":{"name":"gc-noscroll","text":"l00\nl01\nl02\nl03\nl04\nl05\nl06\nl07\nl08\nl09\nl10\nl11\n","mode":"normal","cursor":{"row":6,"col":0},"anchor":{"row":6,"col":0}},"expected":{"name":"gc-noscroll","text":"l00\nl01\nl02\nl03\nl04\nl05\nl06\nl07\nl08\nl09\nl10\nl11\n","mode":"normal","cursor":{"row":0,"col":0},"anchor":{"row":0,"col":0}}} diff --git a/test/panes.zig b/test/panes.zig index 41061bea..86e52838 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -121,10 +121,12 @@ const TagLayerTests = struct { try std.testing.expectEqual(second, p.drag.move.id); p.update(.{ .mouse = mouse(layer, grip_edge - 0.1, .release) }); try std.testing.expectEqualStrings(" ", p.surface.at(layer.viewport.x - 1, layer.viewport.y).grapheme()); - p.update(.{ .mouse = mouse(layer, edge - 0.1, .press) }); - try std.testing.expect(p.drag != .move); - try std.testing.expect(p.panes[second].?.focus == .body); - p.update(.{ .mouse = mouse(layer, edge - 0.1, .release) }); + if (pardes.TAG_GAP > 0) { + p.update(.{ .mouse = mouse(layer, edge - 0.1, .press) }); + try std.testing.expect(p.drag != .move); + try std.testing.expect(p.panes[second].?.focus == .body); + p.update(.{ .mouse = mouse(layer, edge - 0.1, .release) }); + } p.update(.{ .mouse = mouse(layer, edge + 0.1, .press) }); p.update(.{ .mouse = mouse(layer, edge + 0.1, .release) }); try std.testing.expectEqual(second, p.active); @@ -164,7 +166,6 @@ const TagLayerTests = struct { } }; - // Rows relative to where the pane's body and tag are, whatever height its // tag has (a tag wraps onto more rows when it is long). fn paneAt(p: *Pardes, r: anytype) *pardes.Pane { @@ -2735,6 +2736,146 @@ const OutputTests = struct { } } + test "stacked Callstack aligns source below locations and keeps exact emphasis and navigation" { + if (!syntax.enabled) return error.SkipZigTest; + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 30 }); + defer p.deinit(); + const source = " pub fn caller(\n value: u32,\n ) void {\n work(value);\n }\n"; + const pane = try TreeContextTests.setZigFile(p, source); + try std.testing.expectEqual(config.Runtime.CallstackLayout.stacked, p.settings.callstack_layout); + const input = try std.fmt.allocPrint(p.gpa, "╰──╮ {s}:1:12-17 caller\n@callstack-match ╰─ {s}:4:9-12 work(value);\n", .{ pane.file.?.path, pane.file.?.path }); + try fillResults(p, 0, "/", .{ .query = .callstack }, "", input, null); + const result_id = pane.search_pane.?; + const result = p.panes[result_id].?; + const file = &result.file.?; + try std.testing.expectEqual(@as(usize, 6), file.location_rows.len); + try std.testing.expectEqualStrings(" │ pub fn caller(", modal.lineSlice(file.content, 1)); + try std.testing.expectEqualStrings(" │ value: u32,", modal.lineSlice(file.content, 2)); + try std.testing.expectEqualStrings(" │ ) void {", modal.lineSlice(file.content, 3)); + try std.testing.expectEqualStrings(" work(value);", modal.lineSlice(file.content, 5)); + const site = file.location_rows[5]; + try std.testing.expectEqual(@as(usize, 8), site.source_column); + try std.testing.expect(site.colors.len > 0); + const text = modal.lineSlice(file.content, 5); + const decoration = panes.Output.decorateRow(file.output, text, site); + try std.testing.expectEqualStrings("work", text[decoration.mark_start..decoration.mark_end]); + for (file.location_rows, 0..) |row, i| { + try std.testing.expectEqual(i == 0 or i == 4, panes.Output.isResultRow(file, i)); + if (i != 5) try std.testing.expect(!row.mark_occurrence); + } + p.active = result_id; + result.body.cur_row = 4; + result.body.cur_col = " └─ ".len; + p.update(.{ .key = .{ .cp = Key.enter } }); + try std.testing.expectEqual(@as(usize, 0), p.active); + try std.testing.expectEqual(@as(i32, 3), pane.body.cur_row); + try pardes.dump.dumpState(p); + const restored = try pardes.dump.initFromDump(p.gpa, .{ .tty_only = true }, p.dump_out.?); + defer restored.deinit(); + try std.testing.expectEqual(config.Runtime.CallstackLayout.stacked, restored.settings.callstack_layout); + const after = restored.panes[result_id].?.file.?; + try std.testing.expectEqualStrings(file.content, after.content); + try std.testing.expectEqual(@as(usize, 8), after.location_rows[5].source_column); + const restored_decoration = panes.Output.decorateRow(after.output, text, after.location_rows[5]); + try std.testing.expectEqual(decoration, restored_decoration); + try std.testing.expect(p.executeBuiltinLine(0, "CallstackLayout inline")); + try fillResults(p, 0, "/", .{ .query = .callstack }, "", try p.gpa.dupe(u8, "No callers reported\n"), null); + try std.testing.expectEqual(config.Runtime.CallstackLayout.@"inline", p.settings.callstack_layout); + } + + test "Callstack signatures share unsaved tree context and keep guides out of Look selections" { + if (!syntax.enabled) return error.SkipZigTest; + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 110, .rows = 30 }); + defer p.deinit(); + p.settings.callstack_layout = .@"inline"; + const source = "const Box = struct {\n" ++ + " pub fn caller(\n" ++ + " value: u32,\n" ++ + " ) void {\n" ++ + " work(value);\n" ++ + " }\n};\n"; + const pane = try TreeContextTests.setZigFile(p, source); + const path = pane.file.?.path; + const input = try std.fmt.allocPrint(p.gpa, "├──┬ {s}:2:12-17 caller\n@callstack-match │ └─ {s}:5:9-12 work(value);\n└─── missing.zig:3:4-8 other ↻ recursion\n", .{ path, path }); + try fillResults(p, 0, "/", .{ .query = .callstack }, "", input, null); + const result_id = pane.search_pane.?; + const result = p.panes[result_id].?; + const file = &result.file.?; + try std.testing.expect(std.mem.indexOf(u8, file.content, "pub fn caller(") != null); + try std.testing.expect(std.mem.indexOf(u8, file.content, "value: u32,") != null); + try std.testing.expect(std.mem.indexOf(u8, file.content, "const Box") == null); + try std.testing.expect(std.mem.indexOf(u8, file.content, "other ↻ recursion") != null); + try std.testing.expectEqual(@as(usize, 5), file.location_rows.len); + for (file.location_rows[0..3]) |row| { + try std.testing.expect(!row.declaration); + try std.testing.expect(!row.mark_occurrence); + try std.testing.expect(row.colors.len > 0); + } + for (1..3) |index| try std.testing.expect(std.mem.startsWith(u8, modal.lineSlice(file.content, index), "│ │ ")); + const analysis = try syntax.analyzeSource(p.scratch.allocator(), path, source, true, true); + for (file.location_rows[0..3], 1..) |row, source_row| { + const offset = modal.lineStartOffset(source, source_row); + try std.testing.expectEqualSlices(u8, analysis.colors[offset..][0..row.colors.len], row.colors); + } + try std.testing.expect(file.location_rows[3].mark_occurrence); + try std.testing.expect(!file.location_rows[3].declaration); + try std.testing.expect(!panes.Output.isWalkRow(file, 1, modal.lineSlice(file.content, 1))); + p.active = result_id; + result.body.cur_row = 0; + result.body.cur_col = 0; + p.update(.{ .key = .{ .cp = ' ' } }); + p.update(.{ .key = .{ .cp = 'j' } }); + p.update(.{ .key = .{ .cp = 'n' } }); + try std.testing.expectEqual(@as(i32, 0), result.body.cur_row); + try std.testing.expectEqual(@as(i32, "├──┬ ".len), result.body.cur_col); + // Enter on the selected signature address must open source, not a path + // accidentally prefixed with tree glyphs. + p.update(.{ .key = .{ .cp = Key.enter } }); + try std.testing.expectEqual(@as(usize, 0), p.active); + try std.testing.expectEqual(@as(i32, 1), pane.body.cur_row); + p.settings.callstack_depth = 16; + try pardes.dump.dumpState(p); + const restored = try pardes.dump.initFromDump(p.gpa, .{ .tty_only = true }, p.dump_out.?); + defer restored.deinit(); + try std.testing.expectEqual(@as(u8, 16), restored.settings.callstack_depth); + const restored_file = restored.panes[result_id].?.file.?; + try std.testing.expectEqualStrings(file.content, restored_file.content); + try std.testing.expectEqual(file.location_rows.len, restored_file.location_rows.len); + for (file.location_rows, restored_file.location_rows) |before, after| { + try std.testing.expectEqual(before.mark_occurrence, after.mark_occurrence); + try std.testing.expectEqual(before.at, after.at); + try std.testing.expectEqual(before.code_start, after.code_start); + try std.testing.expectEqualSlices(u8, before.colors, after.colors); + } + // Narrow enough that the location itself wraps. The repeated guide + // consumes cells, but neither changes the source address nor steals + // a click from the wrapped portion of that address. + p.active = result_id; + p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 8, .tagline_h = 10 }; + p.update(.{ .resize = .{ .cols = 28, .rows = 40 } }); + result.file.?.scroll = 0; + var frame = std.heap.ArenaAllocator.init(p.gpa); + defer frame.deinit(); + _ = try p.render(frame.allocator()); + const wrapped = for (0..result.wrap_n) |vr| { + const w = result.wrapAt(@intCast(vr)); + if (w.line == 0 and w.pad > 0 and w.at < file.location_rows[0].location_end) break vr; + } else return error.MissingWrappedLocation; + const w = result.wrapAt(@intCast(wrapped)); + const shown = try panes.File.bodyText(frame.allocator(), result, file, true); + const shown_line = modal.lineSlice(shown, wrapped); + try std.testing.expect(std.mem.startsWith(u8, shown_line[panes.File.gutterWidth(result)..], "│ │ ")); + const rect = p.rects[result_id]; + const press: pardes.Mouse = .{ .button = .right, .kind = .press, .col = @intCast(rect.x + config.GUTTER + panes.File.gutterWidth(result) + w.pad + 1), .row = @intCast(p.bodyTop(result, rect) + wrapped) }; + + var release = press; + release.kind = .release; + p.update(.{ .mouse = press }); + p.update(.{ .mouse = release }); + try std.testing.expectEqual(@as(usize, 0), p.active); + try std.testing.expectEqual(@as(i32, 1), pane.body.cur_row); + } + test "Locations context uses unsaved sources and navigation visits only matches" { if (!syntax.enabled) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 30 }); diff --git a/test/snapshots/argv.golden b/test/snapshots/argv.golden index 65b0ac71..9dfa35b9 100644 --- a/test/snapshots/argv.golden +++ b/test/snapshots/argv.golden @@ -1,7 +1,7 @@ == snap noargs grid=100x31 cursor=4,5 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -|$ /tmp/pardes-snap/argv/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +|$ /tmp/pardes-snap/argv/cwd Tty+bash Save Mode Filter Collapse Del | $ echo ARGV''TTY | ARGVTTY | $ @@ -20,12 +20,12 @@ | | | -| /tmp/pardes-snap/argv/cwd/+New Save Tty Collapse Del +| /tmp/pardes-snap/argv/cwd/+New Save Tty Collapse Del | 1 == snap filearg grid=100x31 cursor=7,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/argv/cwd/notes.txt Save Tty Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/argv/cwd/notes.txt Save Tty Collapse Del | 3 line 3 | 4 line 4 | 5 line 5 @@ -34,9 +34,9 @@ | 8 line 8 | 9 == snap filearg-n3 grid=100x31 cursor=7,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/argv/cwd/notes.txt Save Tty Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/argv/cwd/notes.txt Save Tty Collapse Del | 1 line 1 | 2 line 2 | 3 line 3 @@ -47,8 +47,8 @@ | 8 line 8 | 9 == snap dirarg grid=100x31 cursor=4,5 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/argv/cwd/sub Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/argv/cwd/sub Tty+bash Save Mode Filter Collapse Del | ls | inside.txt diff --git a/test/snapshots/badutf.golden b/test/snapshots/badutf.golden index 14aa71dc..1cdd5163 100644 --- a/test/snapshots/badutf.golden +++ b/test/snapshots/badutf.golden @@ -1,17 +1,17 @@ == snap badbytes grid=100x31 cursor=7,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/badutf/cwd/bad.txt Save Tty Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/badutf/cwd/bad.txt Save Tty Collapse Del | 1 hello �� world | 2 latin-1 caf� tail | 3 truncated �� here | 4 end | 5 == snap hscroll-midglyph grid=50x31 cursor=46,4 -|Newcol Joincol Find Grep Help Changelog Tutor Dump -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/badutf/cwd/wide.txt Save Tty C -| ollapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Du +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/badutf/cwd/wide.txt Save Tty Co +| llapse Del | 1 日本語 日本語 日本語 日本語 日本語 tail | 2 | 3 diff --git a/test/snapshots/boot.golden b/test/snapshots/boot.golden index ac674ed2..85b994d7 100644 --- a/test/snapshots/boot.golden +++ b/test/snapshots/boot.golden @@ -1,13 +1,13 @@ == snap boot grid=100x31 cursor=4,5 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/boot/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/boot/cwd Tty+bash Save Mode Filter Collapse Del | ls | hello.txt == style boot grid=100x31 -|0: 0-99 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-99 #becfc4,#314738, -|2: 0-1 d,#add38a, 2-2 d,#314738, 3-28 #becfc4,#314738, 29-37 #dfbce5,#314738, 38-99 #becfc4,#314738, +|0: 0-1 d,#1d2824, 2-99 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-99 #becfc4,#314738, +|2: 0-1 d,#add38a, 2-27 #becfc4,#314738, 28-36 #dfbce5,#314738, 37-99 #becfc4,#314738, |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-99 d,#0d1410, diff --git a/test/snapshots/builtins.golden b/test/snapshots/builtins.golden index 2207ede6..b9d5c5b2 100644 --- a/test/snapshots/builtins.golden +++ b/test/snapshots/builtins.golden @@ -1,7 +1,7 @@ == snap boot grid=120x67 cursor=7,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/builtins/cwd/notes.txt Save Tty Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/builtins/cwd/notes.txt Save Tty Collapse Del | 1 line 1 | 2 line 2 | 3 line 3 @@ -10,7 +10,7 @@ | 6 line 6 | 7 == snap window-group grid=120x67 cursor=7,10 -|9: /tmp/pardes-snap/builtins/cwd/+Help Save Tty Collapse Del +|9: /tmp/pardes-snap/builtins/cwd/+Help Save Tty Collapse Del |10: 1 pardes builtins under SPC w |11: 2 |12: 3 SPC w h Left C-w h, C-w left @@ -27,7 +27,7 @@ |16: == snap tutor-from-index grid=120x67 cursor=7,16 |10: 1 pardes builtins under SPC h Tutor -|15: /tmp/pardes-snap/builtins/cwd/+Tutor Save Tty Collapse Del +|15: /tmp/pardes-snap/builtins/cwd/+Tutor Save Tty Collapse Del |16: 1 |17: 2 PARDES TUTOR |18: 3 diff --git a/test/snapshots/builtins.snap b/test/snapshots/builtins.snap index 8ae22a62..fc0ab796 100644 --- a/test/snapshots/builtins.snap +++ b/test/snapshots/builtins.snap @@ -30,6 +30,8 @@ wheel up 110 50 wheel up 110 50 wheel up 110 50 wheel up 110 50 +wheel up 110 50 +wheel up 110 50 wait 10000 Look enter, right-click wait 10000 Exec tab, middle-click wait 10000 Filter diff --git a/test/snapshots/callstack-inline.golden b/test/snapshots/callstack-inline.golden new file mode 100644 index 00000000..32213223 --- /dev/null +++ b/test/snapshots/callstack-inline.golden @@ -0,0 +1,65 @@ +== snap hierarchy grid=110x40 cursor=7,14 +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/callstack-inline/cwd/setup.txt Save Tty Collapse Del +| 1 CallstackLayout inline +| 2 main.rs +| /tmp/pardes-snap/callstack-inline/cwd/main.rs Save Tty Collapse TreeContext Def Refs Del +| 1 mod lib; --:--:-- lsp rust-analyzer: ready +| 2 +| 3 fn main() { +| 4 let x = add(1, 2); +| 5 let y = add(3, 4); +| 6 let _ = x + y; +| 7 } +| /tmp/pardes-snap/callstack-inline/cwd/+Callstack Save Tty Collapse Del +| 1 ╰──┬ main.rs:3:4-7 fn main() { +| 2 ├─ main.rs:4:13-15 let x = add(1, 2); +| 3 ├─ main.rs:5:13-15 let y = add(3, 4); +| 4 ╰──┬ main.rs:3:4-7 fn main() { ↻ recursion +| 5 ├─ main.rs:4:13-15 let x = add(1, 2); +| 6 ╰─ main.rs:5:13-15 let y = add(3, 4); +| 7 +== style hierarchy grid=110x40 +|0: 0-1 d,#1d2824, 2-109 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-109 #becfc4,#314738, +|2: 0-1 d,#496656, 2-39 #b2c3b8,#1d2824, 40-49 #d3b0d9,#1d2824, 50-109 #b2c3b8,#1d2824, +|3: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-109 #e5eee5,#0d1410, +|4: 0-0 d,#152019, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-109 #e5eee5,#0d1410, +|5: 0-1 d,#496656, 2-39 #b2c3b8,#1d2824, 40-47 #d3b0d9,#1d2824, 48-109 #b2c3b8,#1d2824, +|6: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-10 #c9a7ed,#0d1410, 11-73 #e5eee5,#0d1410, 74-74 #e5eee5,#1d2824, 75-109 #b2c3b8,#1d2824, +|7: 0-0 d,#608269, 1-4 d,#0d1410, 5-109 #59675c,#0d1410, +|8: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-9 #c9a7ed,#0d1410, 10-109 #e5eee5,#0d1410, +|9: 0-0 d,#608269, 1-4 d,#0d1410, 5-10 #59675c,#0d1410, 11-14 #c9a7ed,#0d1410, 15-109 #e5eee5,#0d1410, +|10: 0-0 d,#608269, 1-4 d,#0d1410, 5-10 #59675c,#0d1410, 11-14 #c9a7ed,#0d1410, 15-109 #e5eee5,#0d1410, +|11: 0-0 d,#608269, 1-4 d,#0d1410, 5-10 #59675c,#0d1410, 11-14 #c9a7ed,#0d1410, 15-109 #e5eee5,#0d1410, +|12: 0-0 d,#152019, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-109 #e5eee5,#0d1410, +|13: 0-1 d,#add38a, 2-39 #becfc4,#314738, 40-50 #dfbce5,#314738, 51-109 #becfc4,#314738, +|14: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-11 #92d1de,#0d1410, 12-25 #59675c,#0d1410, 26-28 #c9a7ed,#0d1410, 29-109 #e5eee5,#0d1410, +|15: 0-0 d,#608269, 1-4 d,#0d1410, 5-9 #59675c,#0d1410, 10-12 #92d1de,#0d1410, 13-32 #59675c,#0d1410, 33-36 #c9a7ed,#0d1410, 37-109 #e5eee5,#0d1410, +|16: 0-0 d,#608269, 1-4 d,#0d1410, 5-9 #59675c,#0d1410, 10-12 #92d1de,#0d1410, 13-32 #59675c,#0d1410, 33-36 #c9a7ed,#0d1410, 37-109 #e5eee5,#0d1410, +|17: 0-0 d,#608269, 1-4 d,#0d1410, 5-9 #59675c,#0d1410, 10-14 #92d1de,#0d1410, 15-28 #59675c,#0d1410, 29-31 #c9a7ed,#0d1410, 32-109 #e5eee5,#0d1410, +|18: 0-0 d,#608269, 1-4 d,#0d1410, 5-12 #59675c,#0d1410, 13-15 #92d1de,#0d1410, 16-35 #59675c,#0d1410, 36-39 #c9a7ed,#0d1410, 40-43 #e5eee5,#0d1410, 44-46 #f7e4a5,#5e4923, 47-109 #e5eee5,#0d1410, +|19: 0-0 d,#608269, 1-4 d,#0d1410, 5-12 #59675c,#0d1410, 13-15 #92d1de,#0d1410, 16-35 #59675c,#0d1410, 36-39 #c9a7ed,#0d1410, 40-43 #e5eee5,#0d1410, 44-46 #f7e4a5,#5e4923, 47-109 #e5eee5,#0d1410, +|20: 0-0 d,#608269, 1-4 d,#0d1410, 5-109 #59675c,#0d1410, +|21: 0-0 d,#608269, 1-109 d,#0d1410, +|22: 0-0 d,#608269, 1-109 d,#0d1410, +|23: 0-0 d,#608269, 1-109 d,#0d1410, +|24: 0-0 d,#608269, 1-109 d,#0d1410, +|25: 0-0 d,#608269, 1-109 d,#0d1410, +|26: 0-0 d,#608269, 1-109 d,#0d1410, +|27: 0-0 d,#608269, 1-109 d,#0d1410, +|28: 0-0 d,#608269, 1-109 d,#0d1410, +|29: 0-0 d,#608269, 1-109 d,#0d1410, +|30: 0-0 d,#608269, 1-109 d,#0d1410, +|31: 0-0 d,#608269, 1-109 d,#0d1410, +|32: 0-0 d,#608269, 1-109 d,#0d1410, +|33: 0-0 d,#608269, 1-109 d,#0d1410, +|34: 0-0 d,#608269, 1-109 d,#0d1410, +|35: 0-0 d,#608269, 1-109 d,#0d1410, +|36: 0-0 d,#608269, 1-109 d,#0d1410, +|37: 0-0 d,#608269, 1-109 d,#0d1410, +|38: 0-0 d,#608269, 1-109 d,#0d1410, +|39: 0-0 d,#608269, 1-109 d,#0d1410, +== snap caller grid=110x40 cursor=13,8 +|6: 1 mod lib; diff --git a/test/snapshots/callstack-inline.snap b/test/snapshots/callstack-inline.snap new file mode 100644 index 00000000..9acfa206 --- /dev/null +++ b/test/snapshots/callstack-inline.snap @@ -0,0 +1,30 @@ +# Inline remains an option; source colors, rounded guides and Look navigation are retained. +file main.rs mod lib;\n\nfn main() {\n let x = add(1, 2);\n let y = add(3, 4);\n let _ = x + y;\n}\n +file lib.rs // mock fixture\npub fn add(a: i32, b: i32) -> i32 {\n a + b\n}\n +file setup.txt CallstackLayout inline\nmain.rs\n +start 40 110 setup.txt +wait 8000 CallstackLayout inline +key g g +key x +key tab +stable 300 10000 +key esc +settle 100 +key g g +key j +key home +key enter +wait 8000 add(1, 2) +stable 700 20000 +key g c +wait 10000 Callstack +wait 10000 recursion +stable 700 15000 +snap hierarchy +snapstyle hierarchy +# LookNext selects the caller signature; Enter opens it in the source pane. +key space j n +key enter +wait 10000 fn main +stable 700 15000 +snap caller diff --git a/test/snapshots/callstack.golden b/test/snapshots/callstack.golden new file mode 100644 index 00000000..2970593d --- /dev/null +++ b/test/snapshots/callstack.golden @@ -0,0 +1,27 @@ +== snap hierarchy grid=110x40 cursor=7,11 +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/callstack/cwd/main.rs Save Tty Collapse TreeContext Def Refs Del +| 1 mod lib; --:--:-- lsp rust-analyzer: ready +| 2 +| 3 fn main() { +| 4 let x = add(1, 2); +| 5 let y = add(3, 4); +| 6 let _ = x + y; +| 7 } +| /tmp/pardes-snap/callstack/cwd/+Callstack Save Tty Collapse Del +| 1 ╰──┬ main.rs:3:4-7 +| 2 │ fn main() { +| 3 ├─ main.rs:4:13-15 +| 4 │ let x = add(1, 2); +| 5 ├─ main.rs:5:13-15 +| 6 │ let y = add(3, 4); +| 7 ╰──┬ main.rs:3:4-7 +| 8 │ fn main() { ↻ recursion +| 9 ├─ main.rs:4:13-15 +| 10 │ let x = add(1, 2); +| 11 ╰─ main.rs:5:13-15 +| 12 let y = add(3, 4); +| 13 +== snap caller grid=110x40 cursor=13,5 +|3: 1 mod lib; diff --git a/test/snapshots/callstack.snap b/test/snapshots/callstack.snap new file mode 100644 index 00000000..b32367af --- /dev/null +++ b/test/snapshots/callstack.snap @@ -0,0 +1,19 @@ +# Static call hierarchy in a dedicated pane; sites and declarations are Look targets. +file main.rs mod lib;\n\nfn main() {\n let x = add(1, 2);\n let y = add(3, 4);\n let _ = x + y;\n}\n +file lib.rs // mock fixture\npub fn add(a: i32, b: i32) -> i32 {\n a + b\n}\n +start 40 110 main.rs +wait 8000 add(1, 2) +stable 700 20000 +press left 13 6 +release left 13 6 +key g c +wait 10000 Callstack +wait 10000 recursion +stable 700 15000 +snap hierarchy +# LookNext selects the caller signature; Enter opens it in the source pane. +key space j n +key enter +wait 10000 fn main +stable 700 15000 +snap caller diff --git a/test/snapshots/chordcut.golden b/test/snapshots/chordcut.golden index 817c534c..280dd877 100644 --- a/test/snapshots/chordcut.golden +++ b/test/snapshots/chordcut.golden @@ -1,12 +1,12 @@ == snap opened grid=120x31 cursor=7,8 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/chordcut/cwd Tty+bash Save Mode Filter C /tmp/pardes-snap/chordcut/cwd Tty+bash Save Mode Filter C -| ollapse Del ollapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/chordcut/cwd Tty+bash Save Mode Filter Co /tmp/pardes-snap/chordcut/cwd Tty+bash Save Mode Filter Co +| llapse Del llapse Del | ls ls | f.txt g.txt f.txt g.txt | -| /tmp/pardes-snap/chordcut/cwd/f.txt Save Tty Collapse Del +| /tmp/pardes-snap/chordcut/cwd/f.txt Save Tty Collapse Del | 1 line 1 | 2 line 2 | 3 line 3 @@ -16,12 +16,12 @@ | | | -| /tmp/pardes-snap/chordcut/cwd Tty+bash Save Mode Filter C -| ollapse Del +| /tmp/pardes-snap/chordcut/cwd Tty+bash Save Mode Filter Co +| llapse Del | ls | f.txt g.txt == snap cut grid=120x31 cursor=7,9 -|7: * /tmp/pardes-snap/chordcut/cwd/f.txt Save Tty Collapse Del +|7: */tmp/pardes-snap/chordcut/cwd/f.txt Save Tty Collapse Del |9: 2 2 == snap copied grid=120x31 cursor=10,10 == snap pointpaste grid=120x31 cursor=16,11 @@ -32,27 +32,27 @@ |9: 2 2echo B''OO g.txt == snap execafter grid=120x31 cursor=25,9 |8: 1 line 1 Exec -|17: /tmp/pardes-snap/chordcut/cwd Tty+bash Save Mode Filter C /tmp/pardes-snap/chordcut/cwd (echo B''OO) exit 0 Kill Sa -|18: ollapse Del ve Collapse Del +|17: /tmp/pardes-snap/chordcut/cwd Tty+bash Save Mode Filter Co /tmp/pardes-snap/chordcut/cwd (echo B''OO) exit 0 Kill Sav +|18: llapse Del e Collapse Del |19: ls % echo B''OO |20: f.txt g.txt BOO |21: exit 0 == snap cancellook grid=120x31 cursor=25,9 |8: 1 line 1 == snap lookafter grid=120x31 cursor=7,23 -|22: /tmp/pardes-snap/chordcut/cwd/g.txt Save Tty Collapse Del +|22: /tmp/pardes-snap/chordcut/cwd/g.txt Save Tty Collapse Del |23: 1 line 1 |24: 2 line 2 |25: 3 == style chordsel grid=120x31 -|0: 0-119 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-59 #becfc4,#314738, 60-61 #becfc4,#887455, 62-62 #becfc4,#1d2824, 63-119 #b2c3b8,#1d2824, -|2: 0-1 d,#496656, 2-2 d,#1d2824, 3-32 #b2c3b8,#1d2824, 33-41 #d3b0d9,#1d2824, 42-59 #b2c3b8,#1d2824, 60-61 #b2c3b8,#496656, 62-92 #b2c3b8,#1d2824, 93-101 #d3b0d9,#1d2824, 102-119 #b2c3b8,#1d2824, -|3: 0-2 d,#1d2824, 3-119 #b2c3b8,#1d2824, +|0: 0-1 d,#1d2824, 2-119 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-59 #becfc4,#314738, 60-61 #becfc4,#887455, 62-119 #b2c3b8,#1d2824, +|2: 0-1 d,#496656, 2-31 #b2c3b8,#1d2824, 32-40 #d3b0d9,#1d2824, 41-59 #b2c3b8,#1d2824, 60-61 #b2c3b8,#496656, 62-91 #b2c3b8,#1d2824, 92-100 #d3b0d9,#1d2824, 101-119 #b2c3b8,#1d2824, +|3: 0-1 d,#1d2824, 2-119 #b2c3b8,#1d2824, |4: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, |6: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, -|7: 0-0 d,#496656, 1-1 #000000,#f9cb70,b 2-2 #000000,#1d2824, 3-32 #b2c3b8,#1d2824, 33-38 #d3b0d9,#1d2824, 39-59 #b2c3b8,#1d2824, 60-60 #b2c3b8,#608269, 61-119 #b2c3b8,#0d1410, +|7: 0-0 d,#496656, 1-1 #000000,#f9cb70,b 2-31 #b2c3b8,#1d2824, 32-37 #d3b0d9,#1d2824, 38-59 #b2c3b8,#1d2824, 60-60 #b2c3b8,#608269, 61-119 #b2c3b8,#0d1410, |8: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, |9: 0-0 d,#608269, 1-4 d,#0d1410, 5-7 #59675c,#0d1410, 8-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, |10: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, @@ -62,12 +62,12 @@ |14: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, |15: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, |16: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, -|17: 0-1 d,#496656, 2-2 d,#1d2824, 3-32 #b2c3b8,#1d2824, 33-41 #d3b0d9,#1d2824, 42-59 #b2c3b8,#1d2824, 60-61 #b2c3b8,#496656, 62-119 #b2c3b8,#1d2824, -|18: 0-2 d,#1d2824, 3-119 #b2c3b8,#1d2824, +|17: 0-1 d,#496656, 2-31 #b2c3b8,#1d2824, 32-40 #d3b0d9,#1d2824, 41-59 #b2c3b8,#1d2824, 60-61 #b2c3b8,#496656, 62-119 #b2c3b8,#1d2824, +|18: 0-1 d,#1d2824, 2-119 #b2c3b8,#1d2824, |19: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, |20: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, |21: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-61 d,#0d1410, 62-119 #e5eee5,#0d1410, -|22: 0-1 d,#add38a, 2-2 d,#314738, 3-32 #becfc4,#314738, 33-38 #dfbce5,#314738, 39-59 #becfc4,#314738, 60-60 #becfc4,#608269, 61-119 #becfc4,#0d1410, +|22: 0-1 d,#add38a, 2-31 #becfc4,#314738, 32-37 #dfbce5,#314738, 38-59 #becfc4,#314738, 60-60 #becfc4,#608269, 61-119 #becfc4,#0d1410, |23: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-10 #f5f7ee,#3c614a, 11-11 #f5f7ee,#0d1410, 12-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, |24: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, |25: 0-0 d,#608269, 1-4 d,#0d1410, 5-59 #59675c,#0d1410, 60-60 #59675c,#608269, 61-119 #59675c,#0d1410, @@ -80,7 +80,7 @@ |23: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, |24: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, == snap ttyprobe grid=120x31 cursor=42,23 -|17: $ /tmp/pardes-snap/chordcut/cwd Tty+bash Save Mode Filter C /tmp/pardes-snap/chordcut/cwd (echo B''OO) exit 0 Kill Sa +|17: $ /tmp/pardes-snap/chordcut/cwd Tty+bash Save Mode Filter Co /tmp/pardes-snap/chordcut/cwd (echo B''OO) exit 0 Kill Sav |19: $ ls % echo B''OO |21: $ stty -icanon -echo; printf '\x1b[?2004h\x1b[?1000h\x1b[? exit 0 |22: 1006h'; cat -v diff --git a/test/snapshots/cmdexit.golden b/test/snapshots/cmdexit.golden index 7d950a43..f2f38217 100644 --- a/test/snapshots/cmdexit.golden +++ b/test/snapshots/cmdexit.golden @@ -1,15 +1,15 @@ == snap opened grid=120x31 cursor=7,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/cmdexit/cwd/cmds.txt Save Tty Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/cmdexit/cwd/cmds.txt Save Tty Collapse Del | 1 sleep 30 & echo BG''STARTED | 2 exec /dev/null 2>&1; sleep 1; false == snap background grid=120x31 cursor=7,3 -|17: /tmp/pardes-snap/cmdexit/cwd (sleep 30 & echo BG''STARTED) exit 0 Kill Save Collapse Del +|17: /tmp/pardes-snap/cmdexit/cwd (sleep 30 & echo BG''STARTED) exit 0 Kill Save Collapse Del |18: % sleep 30 & echo BG''STARTED |19: BGSTARTED |20: exit 0 == snap letgo grid=120x31 cursor=7,3 -|24: /tmp/pardes-snap/cmdexit/cwd (exec /dev/null 2>&1; sleep 1; false) exit 1 Kill Save Collapse Del +|24: /tmp/pardes-snap/cmdexit/cwd (exec /dev/null 2>&1; sleep 1; false) exit 1 Kill Save Collapse Del |25: % exec /dev/null 2>&1; sleep 1; false |26: exit 1 diff --git a/test/snapshots/cmdword.golden b/test/snapshots/cmdword.golden index af2fbcb8..3b2f5cc9 100644 --- a/test/snapshots/cmdword.golden +++ b/test/snapshots/cmdword.golden @@ -1,28 +1,28 @@ == snap opened grid=120x31 cursor=7,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/cmdword/cwd/cmds.txt Save Tty Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/cmdword/cwd/cmds.txt Save Tty Collapse Del | 1 @`echo ZZ''E` @`echo ZZ''L` Look p.txt @`Look .` == snap atexec grid=120x31 cursor=7,3 -|17: /tmp/pardes-snap/cmdword/cwd (echo ZZ''E) exit 0 Kill Save Collapse Del +|17: /tmp/pardes-snap/cmdword/cwd (echo ZZ''E) exit 0 Kill Save Collapse Del |18: % echo ZZ''E |19: ZZE |20: exit 0 == snap atlook grid=120x31 cursor=2,24 -|17: /tmp/pardes-snap/cmdword/cwd (echo ZZ''L) exit 0 Kill Save Collapse Del +|17: /tmp/pardes-snap/cmdword/cwd (echo ZZ''L) exit 0 Kill Save Collapse Del |21: % echo ZZ''L |22: ZZL |23: exit 0 == snap lookword grid=120x31 cursor=7,6 -|5: /tmp/pardes-snap/cmdword/cwd/p.txt Save Tty Collapse Del +|5: /tmp/pardes-snap/cmdword/cwd/p.txt Save Tty Collapse Del |6: 1 just text == snap nested grid=120x31 cursor=4,11 -|8: /tmp/pardes-snap/cmdword/cwd Tty+bash Save Mode Filter Collapse Del +|8: /tmp/pardes-snap/cmdword/cwd Tty+bash Save Mode Filter Collapse Del |9: ls |10: cmds.txt p.txt zzmark.txt == snap execword grid=120x31 cursor=4,11 -|8: /tmp/pardes-snap/cmdword/cwd Tty+bash Save Mode Filter Collapse Del Exec +|8: /tmp/pardes-snap/cmdword/cwd Tty+bash Save Mode Filter Collapse Del Exec == snap tagcmd grid=120x31 cursor=4,11 -|8: /tmp/pardes-snap/cmdword/cwd Tty+bash Save Mode Filter Collapse Del Exec @`echo ZZ''T` +|8: /tmp/pardes-snap/cmdword/cwd Tty+bash Save Mode Filter Collapse Del Exec @`echo ZZ''T` |11: echo ZZ''T |12: ZZT diff --git a/test/snapshots/colgrip.golden b/test/snapshots/colgrip.golden index 26a0b1c0..e7881957 100644 --- a/test/snapshots/colgrip.golden +++ b/test/snapshots/colgrip.golden @@ -1,8 +1,8 @@ == style rest grid=100x24 -|0: 0-99 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#1d2824, 3-49 #b2c3b8,#1d2824, 50-51 #b2c3b8,#887455, 52-52 #b2c3b8,#314738, 53-99 #becfc4,#314738, -|2: 0-1 d,#496656, 2-2 d,#1d2824, 3-31 #b2c3b8,#1d2824, 32-37 #d3b0d9,#1d2824, 38-49 #b2c3b8,#1d2824, 50-51 #b2c3b8,#add38a, 52-52 #b2c3b8,#314738, 53-81 #becfc4,#314738, 82-90 #dfbce5,#314738, 91-99 #becfc4,#314738, -|3: 0-2 d,#1d2824, 3-49 #b2c3b8,#1d2824, 50-53 #b2c3b8,#314738, 54-99 #becfc4,#314738, +|0: 0-1 d,#1d2824, 2-99 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-49 #b2c3b8,#1d2824, 50-51 #b2c3b8,#887455, 52-99 #becfc4,#314738, +|2: 0-1 d,#496656, 2-30 #b2c3b8,#1d2824, 31-36 #d3b0d9,#1d2824, 37-49 #b2c3b8,#1d2824, 50-51 #b2c3b8,#add38a, 52-80 #becfc4,#314738, 81-89 #dfbce5,#314738, 90-99 #becfc4,#314738, +|3: 0-1 d,#1d2824, 2-49 #b2c3b8,#1d2824, 50-51 #b2c3b8,#314738, 52-99 #becfc4,#314738, |4: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-49 d,#0d1410, 50-50 d,#608269, 51-51 d,#0d1410, 52-99 #e5eee5,#0d1410, |6: 0-0 d,#608269, 1-49 d,#0d1410, 50-50 d,#608269, 51-99 d,#0d1410, @@ -24,12 +24,12 @@ |22: 0-0 d,#608269, 1-49 d,#0d1410, 50-50 d,#608269, 51-99 d,#0d1410, |23: 0-0 d,#608269, 1-49 d,#0d1410, 50-50 d,#608269, 51-99 d,#0d1410, == style held grid=100x24 -|1: 0-1 d,#887455, 2-2 d,#1d2824, 3-49 #b2c3b8,#1d2824, 50-51 #b2c3b8,#f4c086, 52-52 #b2c3b8,#314738, 53-99 #becfc4,#314738, +|1: 0-1 d,#887455, 2-49 #b2c3b8,#1d2824, 50-51 #b2c3b8,#f4c086, 52-99 #becfc4,#314738, == snap resize-drag grid=100x24 cursor=54,6 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol ╎ New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/colgrip/cwd/w.txt S╎ve Tty Col /tmp/pardes-snap/colgrip/cwd Tty+bash Save Mode -| lapse Del ╎ Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol ╎ New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/colgrip/cwd/w.txt Sa╎e Tty Coll /tmp/pardes-snap/colgrip/cwd Tty+bash Save Mode +| apse Del ╎ Filter Collapse Del | 1 x ╎ ls | ╎ w.txt | ╎ @@ -51,9 +51,9 @@ | ╎ | ╎ == style resize-drag grid=100x24 -|1: 0-1 d,#887455, 2-2 d,#1d2824, 3-38 #b2c3b8,#1d2824, 39-49 #f4c086,#1d2824, 50-51 #f4c086,#f4c086, 52-52 #f4c086,#314738, 53-99 #becfc4,#314738, -|2: 0-1 d,#496656, 2-2 d,#1d2824, 3-31 #b2c3b8,#1d2824, 32-37 #d3b0d9,#1d2824, 38-38 #b2c3b8,#1d2824, 39-39 #f4c086,#1d2824, 40-49 #b2c3b8,#1d2824, 50-51 #b2c3b8,#add38a, 52-52 #b2c3b8,#314738, 53-81 #becfc4,#314738, 82-90 #dfbce5,#314738, 91-99 #becfc4,#314738, -|3: 0-2 d,#1d2824, 3-38 #b2c3b8,#1d2824, 39-49 #f4c086,#1d2824, 50-53 #f4c086,#314738, 54-99 #becfc4,#314738, +|1: 0-1 d,#887455, 2-38 #b2c3b8,#1d2824, 39-49 #f4c086,#1d2824, 50-51 #f4c086,#f4c086, 52-99 #becfc4,#314738, +|2: 0-1 d,#496656, 2-30 #b2c3b8,#1d2824, 31-36 #d3b0d9,#1d2824, 37-38 #b2c3b8,#1d2824, 39-39 #f4c086,#1d2824, 40-49 #b2c3b8,#1d2824, 50-51 #b2c3b8,#add38a, 52-80 #becfc4,#314738, 81-89 #dfbce5,#314738, 90-99 #becfc4,#314738, +|3: 0-1 d,#1d2824, 2-38 #b2c3b8,#1d2824, 39-49 #f4c086,#1d2824, 50-51 #f4c086,#314738, 52-99 #becfc4,#314738, |4: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-38 #e5eee5,#0d1410, 39-49 #f4c086,#0d1410, 50-50 #f4c086,#608269, 51-51 #f4c086,#0d1410, 52-99 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-38 d,#0d1410, 39-49 #f4c086,#0d1410, 50-50 #f4c086,#608269, 51-51 #f4c086,#0d1410, 52-99 #e5eee5,#0d1410, |6: 0-0 d,#608269, 1-38 d,#0d1410, 39-49 #f4c086,#0d1410, 50-50 #f4c086,#608269, 51-99 #f4c086,#0d1410, @@ -75,9 +75,9 @@ |22: 0-0 d,#608269, 1-38 d,#0d1410, 39-49 #f4c086,#0d1410, 50-50 #f4c086,#608269, 51-99 #f4c086,#0d1410, |23: 0-0 d,#608269, 1-38 d,#0d1410, 39-49 #f4c086,#0d1410, 50-50 #f4c086,#608269, 51-99 #f4c086,#0d1410, == snap resize-done grid=100x24 cursor=44,6 -|1: New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -|2: /tmp/pardes-snap/colgrip/cwd/w.txt Sa /tmp/pardes-snap/colgrip/cwd Tty+bash Save Mode Filter Co -|3: ve Tty Collapse Del llapse Del +|1: New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +|2: /tmp/pardes-snap/colgrip/cwd/w.txt Sav /tmp/pardes-snap/colgrip/cwd Tty+bash Save Mode Filter Col +|3: e Tty Collapse Del lapse Del |4: 1 x ls |5: w.txt |6: @@ -120,9 +120,9 @@ |22: ╎ |23: ╎ == style reorder-drag grid=100x24 -|1: 0-1 d,#887455, 2-2 d,#1d2824, 3-39 #b2c3b8,#1d2824, 40-41 #b2c3b8,#f4c086, 42-42 #b2c3b8,#314738, 43-99 #becfc4,#314738, -|2: 0-1 d,#496656, 2-2 d,#1d2824, 3-31 #b2c3b8,#1d2824, 32-37 #d3b0d9,#1d2824, 38-39 #b2c3b8,#1d2824, 40-41 #b2c3b8,#add38a, 42-42 #b2c3b8,#314738, 43-71 #becfc4,#314738, 72-80 #dfbce5,#314738, 81-99 #becfc4,#314738, -|3: 0-2 d,#1d2824, 3-39 #b2c3b8,#1d2824, 40-42 #b2c3b8,#314738, 43-99 #becfc4,#314738, +|1: 0-1 d,#887455, 2-39 #b2c3b8,#1d2824, 40-41 #b2c3b8,#f4c086, 42-99 #becfc4,#314738, +|2: 0-1 d,#496656, 2-30 #b2c3b8,#1d2824, 31-36 #d3b0d9,#1d2824, 37-39 #b2c3b8,#1d2824, 40-41 #b2c3b8,#add38a, 42-70 #becfc4,#314738, 71-79 #dfbce5,#314738, 80-99 #becfc4,#314738, +|3: 0-1 d,#1d2824, 2-39 #b2c3b8,#1d2824, 40-41 #b2c3b8,#314738, 42-99 #becfc4,#314738, |4: 0-0 d,#608269, 1-4 #f4c086,#0d1410, 5-6 #59675c,#0d1410, 7-39 #e5eee5,#0d1410, 40-40 #e5eee5,#608269, 41-99 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-39 #f4c086,#0d1410, 40-40 #f4c086,#608269, 41-41 #f4c086,#0d1410, 42-99 #e5eee5,#0d1410, |6: 0-0 d,#608269, 1-39 #f4c086,#0d1410, 40-40 #f4c086,#608269, 41-99 #f4c086,#0d1410, @@ -144,9 +144,9 @@ |22: 0-0 d,#608269, 1-39 #f4c086,#0d1410, 40-40 #f4c086,#608269, 41-99 #f4c086,#0d1410, |23: 0-0 d,#608269, 1-39 #f4c086,#0d1410, 40-40 #f4c086,#608269, 41-99 #f4c086,#0d1410, == snap reorder-done grid=100x24 cursor=4,6 -|1: New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -|2: /tmp/pardes-snap/colgrip/cwd Tty+bash Save Mode Filter Co /tmp/pardes-snap/colgrip/cwd/w.txt Sa -|3: llapse Del ve Tty Collapse Del +|1: New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +|2: /tmp/pardes-snap/colgrip/cwd Tty+bash Save Mode Filter Col /tmp/pardes-snap/colgrip/cwd/w.txt Sav +|3: lapse Del e Tty Collapse Del |4: ls 1 x |5: w.txt |6: diff --git a/test/snapshots/collapse.golden b/test/snapshots/collapse.golden index 57aafc8f..13e1b1f2 100644 --- a/test/snapshots/collapse.golden +++ b/test/snapshots/collapse.golden @@ -1,7 +1,7 @@ == snap before grid=160x25 cursor=7,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/collapse/cwd/kept.txt Save Tty Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/collapse/cwd/kept.txt Save Tty Collapse Del | 1 KEEP-FIRST | 2 KEEP-SECOND | 3 KEEP-THIRD @@ -10,12 +10,12 @@ |4: |5: == 9p middle-collapsed-cursor grid=160x25 cursor=none -|0: Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -@0: 0-74 #b2c3b8,#1d2824,,tagline 75-159 d,#1d2824,,tagline -|1: New Tty Find Grep Joincol Delcol -@1: 0-1 #ffffff,#887455,,tagline 2-2 d,#314738,,tagline 3-34 #becfc4,#314738,,tagline 35-159 d,#314738,,tagline -|2: /tmp/pardes-snap/collapse/cwd/kept.txt Save Tty Collapse Del -@2: 0-1 #000000,#add38a,,tagline 2-2 d,#314738,,tagline 3-32 #becfc4,#314738,,tagline 33-40 #dfbce5,#314738,,tagline 41-62 #becfc4,#314738,,tagline 63-159 d,#314738,,tagline +|0: Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +@0: 0-76 #b2c3b8,#1d2824,,tagline 77-159 d,#1d2824,,tagline +|1: New Tty Find Grep Joincol Delcol +@1: 0-1 #ffffff,#887455,,tagline 2-33 #becfc4,#314738,,tagline 34-159 d,#314738,,tagline +|2: /tmp/pardes-snap/collapse/cwd/kept.txt Save Tty Collapse Del +@2: 0-1 #000000,#add38a,,tagline 2-31 #becfc4,#314738,,tagline 32-39 #dfbce5,#314738,,tagline 40-61 #becfc4,#314738,,tagline 62-159 d,#314738,,tagline |3: @3: 0-159 d,#486152,,body |4: @@ -64,7 +64,7 @@ |3: 1 KEEP-FIRST Collapse |4: 2 KEEP-SECOND |5: 3 KEEP-THIRD -== snap tab-collapsed grid=160x25 cursor=51,2 +== snap tab-collapsed grid=160x25 cursor=50,2 |3: |4: |5: diff --git a/test/snapshots/cornerdrag-left.golden b/test/snapshots/cornerdrag-left.golden index a5f36319..4d2d6d43 100644 --- a/test/snapshots/cornerdrag-left.golden +++ b/test/snapshots/cornerdrag-left.golden @@ -1,13 +1,13 @@ == snap right-split grid=100x31 cursor=54,11 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/cornerdrag-left/cwd Tty+bash S /tmp/pardes-snap/cornerdrag-left/cwd Tty+bash S -| ave Mode Filter Collapse Del ave Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/cornerdrag-left/cwd Tty+bash Sa /tmp/pardes-snap/cornerdrag-left/cwd Tty+bash Sa +| ve Mode Filter Collapse Del ve Mode Filter Collapse Del | ls ls | w.txt w.txt | -| /tmp/pardes-snap/cornerdrag-left/cwd Tty+bash S -| ave Mode Filter Collapse Del +| /tmp/pardes-snap/cornerdrag-left/cwd Tty+bash Sa +| ve Mode Filter Collapse Del | ls | w.txt | @@ -16,19 +16,19 @@ | | | -| /tmp/pardes-snap/cornerdrag-left/cwd Tty+bash S -| ave Mode Filter Collapse Del +| /tmp/pardes-snap/cornerdrag-left/cwd Tty+bash Sa +| ve Mode Filter Collapse Del | ls | w.txt == snap hover-corner grid=100x31 cursor=54,11 -|1: New Tty Find Grep Joincol Delcol ╎ New Tty Find Grep Joincol Delcol -|2: /tmp/pardes-snap/cornerdrag-left/cwd Tty+bash ╎ /tmp/pardes-snap/cornerdrag-left/cwd Tty+bash S -|3: ave Mode Filter Collapse Del ╎ ave Mode Filter Collapse Del +|1: New Tty Find Grep Joincol Delcol ╎ New Tty Find Grep Joincol Delcol +|2: /tmp/pardes-snap/cornerdrag-left/cwd Tty+bash S╎ /tmp/pardes-snap/cornerdrag-left/cwd Tty+bash Sa +|3: ve Mode Filter Collapse Del ╎ ve Mode Filter Collapse Del |4: ls ╎ ls |5: w.txt ╎ w.txt |6: ╎ -|7: ╎ /tmp/pardes-snap/cornerdrag-left/cwd Tty+bash S -|8: ╎ ave Mode Filter Collapse Del +|7: ╎ /tmp/pardes-snap/cornerdrag-left/cwd Tty+bash Sa +|8: ╎ ve Mode Filter Collapse Del |9: ╎ ls |10: ╎ w.txt |11: ╎ @@ -37,8 +37,8 @@ |14: ╎ |15: ╎ |16: ╎ -|17: /tmp/pardes-snap/cornerdrag-left/cwd Tty+bash ╎ -|18: ave Mode Filter Collapse Del ╎ +|17: /tmp/pardes-snap/cornerdrag-left/cwd Tty+bash S╎ +|18: ve Mode Filter Collapse Del ╎ |19: ls ╎ |20: w.txt ╎ |21: ╎ @@ -53,14 +53,14 @@ |30: ╎ == snap hover-left-corner grid=100x31 cursor=54,11 == snap corner-drag grid=100x31 cursor=54,11 -|1: New Tty Find Grep Joincol ╎elcol New Tty Find Grep Joincol Delcol -|2: /tmp/pardes-snap/cornerdra╎-left/cwd Tty+bash S /tmp/pardes-snap/cornerdrag-left/cwd Tty+bash S -|3: ave Mode Filter Collapse D╎l ave Mode Filter Collapse Del +|1: New Tty Find Grep Joincol D╎lcol New Tty Find Grep Joincol Delcol +|2: /tmp/pardes-snap/cornerdrag╎left/cwd Tty+bash Sa /tmp/pardes-snap/cornerdrag-left/cwd Tty+bash Sa +|3: ve Mode Filter Collapse Del╎ ve Mode Filter Collapse Del |4: ls ╎ ls |5: w.txt ╎ w.txt |6: ╎ -|7: ╎ /tmp/pardes-snap/cornerdrag-left/cwd Tty+bash S -|8: ╎ ave Mode Filter Collapse Del +|7: ╎ /tmp/pardes-snap/cornerdrag-left/cwd Tty+bash Sa +|8: ╎ ve Mode Filter Collapse Del |9: ╎ ls |10: ╎ w.txt |11: ╎ @@ -69,8 +69,8 @@ |14: ╎ |15: ╎ |16: ╎ -|17: /tmp/pardes-snap/cornerdra╎-left/cwd Tty+bash S -|18: ave Mode Filter Collapse D╎l +|17: /tmp/pardes-snap/cornerdrag╎left/cwd Tty+bash Sa +|18: ve Mode Filter Collapse Del╎ |19: ls ╎ |20: w.txt ╎ |21: ╎ @@ -84,14 +84,14 @@ |29: ╎ |30: ╎ == snap corner-done grid=100x31 cursor=34,11 -|1: New Tty Find Grep Joincol D New Tty Find Grep Joincol Delcol -|2: /tmp/pardes-snap/cornerdrag /tmp/pardes-snap/cornerdrag-left/cwd Tty+bash Save Mode Filter Coll -|3: -left/cwd Tty+bash Save Mod apse Del -|4: e Filter Collapse Del ls +|1: New Tty Find Grep Joincol De New Tty Find Grep Joincol Delcol +|2: /tmp/pardes-snap/cornerdrag- /tmp/pardes-snap/cornerdrag-left/cwd Tty+bash Save Mode Filter Colla +|3: left/cwd Tty+bash Save Mode pse Del +|4: Filter Collapse Del ls |5: ls w.txt |6: w.txt -|7: /tmp/pardes-snap/cornerdrag-left/cwd Tty+bash Save Mode Filter Coll -|8: apse Del +|7: /tmp/pardes-snap/cornerdrag-left/cwd Tty+bash Save Mode Filter Colla +|8: pse Del |9: ls |10: w.txt |11: @@ -100,9 +100,9 @@ |14: |15: |16: -|17: /tmp/pardes-snap/cornerdrag -|18: -left/cwd Tty+bash Save Mod -|19: e Filter Collapse Del +|17: /tmp/pardes-snap/cornerdrag- +|18: left/cwd Tty+bash Save Mode +|19: Filter Collapse Del |20: ls |21: w.txt |22: diff --git a/test/snapshots/cornerdrag.golden b/test/snapshots/cornerdrag.golden index 8dd21eff..246840bc 100644 --- a/test/snapshots/cornerdrag.golden +++ b/test/snapshots/cornerdrag.golden @@ -1,8 +1,8 @@ == snap hover-corner grid=100x31 cursor=4,6 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol ╎ New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save ╎ /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save M -| ode Filter Collapse Del ╎ ode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol ╎ New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save M╎ /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save Mo +| de Filter Collapse Del ╎ de Filter Collapse Del | ls ╎ ls | w.txt ╎ w.txt | ╎ @@ -16,8 +16,8 @@ | ╎ | ╎ | ╎ -| /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save ╎ -| ode Filter Collapse Del ╎ +| /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save M╎ +| de Filter Collapse Del ╎ | ls ╎ | w.txt ╎ | ╎ @@ -31,9 +31,9 @@ | ╎ | ╎ == snap edge-drag grid=100x31 cursor=4,6 -|1: New Tty Find Grep Joincol ╎elcol New Tty Find Grep Joincol Delcol -|2: /tmp/pardes-snap/cornerdra╎/cwd Tty+bash Save M /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save M -|3: ode Filter Collapse Del ╎ ode Filter Collapse Del +|1: New Tty Find Grep Joincol D╎lcol New Tty Find Grep Joincol Delcol +|2: /tmp/pardes-snap/cornerdrag╎cwd Tty+bash Save Mo /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save Mo +|3: de Filter Collapse Del ╎ de Filter Collapse Del |4: ls ╎ ls |5: w.txt ╎ w.txt |6: ╎ @@ -47,8 +47,8 @@ |14: ╎ |15: ╎ |16: ╎ -|17: /tmp/pardes-snap/cornerdra╎/cwd Tty+bash Save M -|18: ode Filter Collapse Del ╎ +|17: /tmp/pardes-snap/cornerdrag╎cwd Tty+bash Save Mo +|18: de Filter Collapse Del ╎ |19: ls ╎ |20: w.txt ╎ |21: ╎ @@ -62,10 +62,10 @@ |29: ╎ |30: ╎ == snap edge-done grid=100x31 cursor=4,7 -|1: New Tty Find Grep Joincol D New Tty Find Grep Joincol Delcol -|2: /tmp/pardes-snap/cornerdrag /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save Mode Filter Collapse -|3: /cwd Tty+bash Save Mode Fil Del -|4: ter Collapse Del ls +|1: New Tty Find Grep Joincol De New Tty Find Grep Joincol Delcol +|2: /tmp/pardes-snap/cornerdrag/ /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save Mode Filter Collapse D +|3: cwd Tty+bash Save Mode Filte el +|4: r Collapse Del ls |5: ls w.txt |6: w.txt |7: @@ -78,9 +78,9 @@ |14: |15: |16: -|17: /tmp/pardes-snap/cornerdrag -|18: /cwd Tty+bash Save Mode Fil -|19: ter Collapse Del +|17: /tmp/pardes-snap/cornerdrag/ +|18: cwd Tty+bash Save Mode Filte +|19: r Collapse Del |20: ls |21: w.txt |22: @@ -93,10 +93,10 @@ |29: |30: == snap corner-drag grid=100x31 cursor=4,7 -|1: New Tty Find Grep Joincol D New Tty Find Grep Joincol ╎elcol -|2: /tmp/pardes-snap/cornerdrag /tmp/pardes-snap/cornerdra╎/cwd Tty+bash Save Mode Filter Collapse -|3: /cwd Tty+bash Save Mode Fil Del ╎ -|4: ter Collapse Del ls ╎ +|1: New Tty Find Grep Joincol De New Tty Find Grep Joincol D╎lcol +|2: /tmp/pardes-snap/cornerdrag/ /tmp/pardes-snap/cornerdrag╎cwd Tty+bash Save Mode Filter Collapse D +|3: cwd Tty+bash Save Mode Filte el ╎ +|4: r Collapse Del ls ╎ |5: ls w.txt ╎ |6: w.txt ╎ |7: ╎ @@ -109,9 +109,9 @@ |14: ╎ |15: ╎ |16: ╎ -|17: /tmp/pardes-snap/cornerdrag ╎ -|18: /cwd Tty+bash Save Mode Fil ╎ -|19: ter Collapse Del ╎ +|17: /tmp/pardes-snap/cornerdrag/ ╎ +|18: cwd Tty+bash Save Mode Filte ╎ +|19: r Collapse Del ╎ |20: ls ╎ |21: w.txt ╎ |22: ╎ @@ -124,16 +124,16 @@ |29: ╎ |30: ╎ == snap corner-done grid=100x31 cursor=4,6 -|1: New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -|2: /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save Mode Filter /tmp/pardes-snap/cornerdrag/cwd Tty+b -|3: Collapse Del ash Save Mode Filter Collapse Del +|1: New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +|2: /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save Mode Filter /tmp/pardes-snap/cornerdrag/cwd Tty+ba +|3: Collapse Del sh Save Mode Filter Collapse Del |4: ls ls |5: w.txt w.txt |6: |7: |8: -|9: /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save Mode Filter -|10: Collapse Del +|9: /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save Mode Filter +|10: Collapse Del |11: ls |12: w.txt |13: @@ -155,16 +155,16 @@ |29: |30: == snap clamp-x grid=100x31 cursor=4,6 -|1: New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol D╎lcol -|2: /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save Mode Filter /tmp/pardes-snap/cornerdrag╎cwd Tty+b -|3: Collapse Del ash Save Mode Filter Collap╎e Del +|1: New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol De╎col +|2: /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save Mode Filter /tmp/pardes-snap/cornerdrag/╎wd Tty+ba +|3: Collapse Del sh Save Mode Filter Collapse╎Del |4: ls ls ╎ |5: w.txt w.txt ╎ |6: ╎ |7: ╎ |8: ╎ -|9: /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save Mode Filter ╎ -|10: Collapse Del ╎ +|9: /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save Mode Filter ╎ +|10: Collapse Del ╎ |11: ls ╎ |12: w.txt ╎ |13: ╎ @@ -186,16 +186,16 @@ |29: ╎ |30: ╎ == snap clamp-y grid=100x31 cursor=4,6 -|1: New Tty Find Grep Joincol Delcol ╎ New Tty Find Grep Joincol Delcol -|2: /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save Mode Filte╎ /tmp/pardes-snap/cornerdrag/cwd Tty+b -|3: Collapse Del ╎ ash Save Mode Filter Collapse Del +|1: New Tty Find Grep Joincol Delcol ╎ New Tty Find Grep Joincol Delcol +|2: /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save Mode Filter╎ /tmp/pardes-snap/cornerdrag/cwd Tty+ba +|3: Collapse Del ╎ sh Save Mode Filter Collapse Del |4: ls ╎ ls |5: w.txt ╎ w.txt |6: ╎ |7: ╎ |8: ╎ -|9: /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save Mode Filte╎ -|10: Collapse Del ╎ +|9: /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save Mode Filter╎ +|10: Collapse Del ╎ |11: ls ╎ |12: w.txt ╎ |13: ╎ @@ -217,9 +217,9 @@ |29: ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ |30: ╎ == snap clamp-done grid=100x31 cursor=4,6 -|1: New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -|2: /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save Mode Filter /tmp/pardes-snap/cornerdrag/cwd Tty+b -|3: Collapse Del ash Save Mode Filter Collapse Del +|1: New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +|2: /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save Mode Filter /tmp/pardes-snap/cornerdrag/cwd Tty+ba +|3: Collapse Del sh Save Mode Filter Collapse Del |4: ls ls |5: w.txt w.txt |6: @@ -243,7 +243,7 @@ |24: |25: |26: -|27: /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save Mode Filter -|28: Collapse Del +|27: /tmp/pardes-snap/cornerdrag/cwd Tty+bash Save Mode Filter +|28: Collapse Del |29: w.txt |30: diff --git a/test/snapshots/cursorline.golden b/test/snapshots/cursorline.golden index 6b99a30a..277565b3 100644 --- a/test/snapshots/cursorline.golden +++ b/test/snapshots/cursorline.golden @@ -1,11 +1,11 @@ == snap top grid=150x31 cursor=7,7 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/cursorline/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/cursorline/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/cursorline/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/cursorline/cwd Tty+bash Save Mode Filter Collapse Del | ls ls | cur.txt cur.txt | -| /tmp/pardes-snap/cursorline/cwd/cur.txt Save Tty Collapse Del +| /tmp/pardes-snap/cursorline/cwd/cur.txt Save Tty Collapse Del | 1 line 1 | 2 line 2 | 3 line 3 @@ -16,17 +16,17 @@ | 8 line 8 | 9 line 9 | 10 line 10 -| /tmp/pardes-snap/cursorline/cwd Tty+bash Save Mode Filter Collapse Del +| /tmp/pardes-snap/cursorline/cwd Tty+bash Save Mode Filter Collapse Del | ls | cur.txt == style top grid=150x31 -|0: 0-149 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-74 #becfc4,#314738, 75-76 #becfc4,#887455, 77-77 #becfc4,#1d2824, 78-149 #b2c3b8,#1d2824, -|2: 0-1 d,#496656, 2-2 d,#1d2824, 3-34 #b2c3b8,#1d2824, 35-43 #d3b0d9,#1d2824, 44-74 #b2c3b8,#1d2824, 75-76 #b2c3b8,#496656, 77-109 #b2c3b8,#1d2824, 110-118 #d3b0d9,#1d2824, 119-149 #b2c3b8,#1d2824, +|0: 0-1 d,#1d2824, 2-149 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-74 #becfc4,#314738, 75-76 #becfc4,#887455, 77-149 #b2c3b8,#1d2824, +|2: 0-1 d,#496656, 2-33 #b2c3b8,#1d2824, 34-42 #d3b0d9,#1d2824, 43-74 #b2c3b8,#1d2824, 75-76 #b2c3b8,#496656, 77-108 #b2c3b8,#1d2824, 109-117 #d3b0d9,#1d2824, 118-149 #b2c3b8,#1d2824, |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, -|6: 0-1 d,#add38a, 2-2 d,#314738, 3-34 #becfc4,#314738, 35-42 #dfbce5,#314738, 43-74 #becfc4,#314738, 75-75 #becfc4,#608269, 76-149 #becfc4,#0d1410, +|6: 0-1 d,#add38a, 2-33 #becfc4,#314738, 34-41 #dfbce5,#314738, 42-74 #becfc4,#314738, 75-75 #becfc4,#608269, 76-149 #becfc4,#0d1410, |7: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |8: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |9: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, @@ -37,7 +37,7 @@ |14: 0-0 d,#152019, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |15: 0-0 d,#152019, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |16: 0-0 d,#152019, 1-3 d,#0d1410, 4-6 #59675c,#0d1410, 7-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, -|17: 0-1 d,#496656, 2-2 d,#1d2824, 3-34 #b2c3b8,#1d2824, 35-43 #d3b0d9,#1d2824, 44-74 #b2c3b8,#1d2824, 75-75 #b2c3b8,#608269, 76-149 #b2c3b8,#0d1410, +|17: 0-1 d,#496656, 2-33 #b2c3b8,#1d2824, 34-42 #d3b0d9,#1d2824, 43-74 #b2c3b8,#1d2824, 75-75 #b2c3b8,#608269, 76-149 #b2c3b8,#0d1410, |18: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |19: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |20: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, diff --git a/test/snapshots/delask.golden b/test/snapshots/delask.golden index d1487a36..7d911239 100644 --- a/test/snapshots/delask.golden +++ b/test/snapshots/delask.golden @@ -1,7 +1,7 @@ == snap three grid=100x36 cursor=18,20 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/delask/cwd/top.txt Save Tty Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/delask/cwd/top.txt Save Tty Collapse Del | 1 top-marker | | @@ -18,7 +18,7 @@ | | | -| * /tmp/pardes-snap/delask/cwd/+New Save Tty Collapse Del +| */tmp/pardes-snap/delask/cwd/+New Save Tty Collapse Del | 1 middle-pane | | @@ -27,7 +27,7 @@ | | | -| * /tmp/pardes-snap/delask/cwd/+New Save Tty Collapse Del +| */tmp/pardes-snap/delask/cwd/+New Save Tty Collapse Del | 1 bottom-pane Up == snap asked grid=100x36 cursor=18,20 |20: 1 middle-pane Del: give space to k above j below @@ -40,7 +40,7 @@ |29: == snap typed grid=100x36 cursor=27,20 |20: 1 bottom-pane DelBelow -|28: * /tmp/pardes-snap/delask/cwd/+New Save Tty Collapse Del +|28: */tmp/pardes-snap/delask/cwd/+New Save Tty Collapse Del |29: 1 third-pane == snap below-took-click grid=100x36 cursor=17,20 |20: 1 third-pane @@ -48,7 +48,7 @@ |29: == snap four grid=100x36 cursor=7,29 |3: 1 top-marker New -|28: /tmp/pardes-snap/delask/cwd/+New Save Tty Collapse Del +|28: /tmp/pardes-snap/delask/cwd/+New Save Tty Collapse Del |29: 1 == snap mouse-del grid=100x36 cursor=7,29 |3: 1 top-marker diff --git a/test/snapshots/diffview.golden b/test/snapshots/diffview.golden index 868e5e85..b4ce7759 100644 --- a/test/snapshots/diffview.golden +++ b/test/snapshots/diffview.golden @@ -1,7 +1,7 @@ == snap diff-pane grid=100x31 cursor=7,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/diffview/cwd/change.diff Save Tty Diff Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/diffview/cwd/change.diff Save Tty Diff Collapse Del | 1 diff --git a/src/shape.zig b/src/shape.zig | 2 index 1111111..2222222 100644 | 3 --- a/src/shape.zig @@ -23,9 +23,9 @@ | 19 }; | 20 == style diff-colours grid=100x31 -|0: 0-99 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-99 #becfc4,#314738, -|2: 0-1 d,#add38a, 2-2 d,#314738, 3-32 #becfc4,#314738, 33-44 #dfbce5,#314738, 45-99 #becfc4,#314738, +|0: 0-1 d,#1d2824, 2-99 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-99 #becfc4,#314738, +|2: 0-1 d,#add38a, 2-31 #becfc4,#314738, 32-43 #dfbce5,#314738, 44-99 #becfc4,#314738, |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-99 #b9f480,#0d1410, |4: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-99 #b9f480,#0d1410, |5: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-99 #b9f480,#0d1410, @@ -55,7 +55,7 @@ |29: 0-0 d,#608269, 1-99 d,#0d1410, |30: 0-0 d,#608269, 1-99 d,#0d1410, == snap look-added-line grid=100x31 cursor=55,22 -|16: /tmp/pardes-snap/diffview/cwd/src/shape.zig Save Tty Collapse Del TreeContext Def Refs +|16: /tmp/pardes-snap/diffview/cwd/src/shape.zig Save Tty Collapse TreeContext Def Refs Del |17: 1 const std = @import("std"); |18: 2 |19: 3 pub const Shape = union(enum) { @@ -70,9 +70,9 @@ |28: 12 }; |29: 13 == snap command-pane grid=100x31 cursor=7,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/diffview/cwd/cmds.txt Save Tty Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/diffview/cwd/cmds.txt Save Tty Collapse Del | 1 cat change.diff Exec | 2 | @@ -87,7 +87,7 @@ | | | -| /tmp/pardes-snap/diffview/cwd (cat change.diff) exit 0 Kill Save Collapse Del +| /tmp/pardes-snap/diffview/cwd (cat change.diff) exit 0 Kill Save Collapse Del | circle: f32, | - square: u8 = 7, | + square: f32, @@ -101,9 +101,9 @@ | }; | exit 0 == style command-colours grid=100x31 -|0: 0-99 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-99 #becfc4,#314738, -|2: 0-1 d,#add38a, 2-2 d,#314738, 3-32 #becfc4,#314738, 33-41 #dfbce5,#314738, 42-99 #becfc4,#314738, +|0: 0-1 d,#1d2824, 2-99 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-99 #becfc4,#314738, +|2: 0-1 d,#add38a, 2-31 #becfc4,#314738, 32-40 #dfbce5,#314738, 41-99 #becfc4,#314738, |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-93 #e5eee5,#0d1410, 94-94 #e5eee5,#1d2824, 95-99 #b2c3b8,#1d2824, |4: 0-0 d,#608269, 1-4 d,#0d1410, 5-99 #59675c,#0d1410, |5: 0-0 d,#608269, 1-99 d,#0d1410, @@ -118,7 +118,7 @@ |14: 0-0 d,#608269, 1-99 d,#0d1410, |15: 0-0 d,#608269, 1-99 d,#0d1410, |16: 0-0 d,#608269, 1-99 d,#0d1410, -|17: 0-1 d,#496656, 2-2 d,#1d2824, 3-99 #b2c3b8,#1d2824, +|17: 0-1 d,#496656, 2-99 #b2c3b8,#1d2824, |18: 0-0 d,#152019, 1-6 d,#0d1410, 7-99 #e5eee5,#0d1410, |19: 0-0 d,#152019, 1-1 d,#0d1410, 2-2 #f1a39b,#302b25,b 3-6 #f1a39b,#302b25, 7-19 #e5eee5,#302b25, 20-20 #f8c082,#302b25, 21-99 #e5eee5,#302b25, |20: 0-0 d,#152019, 1-1 d,#0d1410, 2-2 #b6ce94,#263025,b 3-6 #b6ce94,#263025, 7-99 #e5eee5,#263025, @@ -134,7 +134,7 @@ |30: 0-0 d,#152019, 1-99 d,#0d1410, == snap command-look grid=100x31 cursor=23,10 |3: 1 cat change.diff -|5: /tmp/pardes-snap/diffview/cwd/src/shape.zig Save Tty Collapse Del TreeContext Def Refs +|5: /tmp/pardes-snap/diffview/cwd/src/shape.zig Save Tty Collapse TreeContext Def Refs Del |6: 1 const std = @import("std"); |7: 2 |8: 3 pub const Shape = union(enum) { diff --git a/test/snapshots/dirpane.golden b/test/snapshots/dirpane.golden index 3118079f..960c8913 100644 --- a/test/snapshots/dirpane.golden +++ b/test/snapshots/dirpane.golden @@ -1,13 +1,13 @@ == snap dir-open grid=80x24 cursor=7,6 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/dirpane/cwd/top.txt Save Tty Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/dirpane/cwd/top.txt Save Tty Collapse Del | 1 sub | -| /tmp/pardes-snap/dirpane/cwd/sub/ Get Tty Collapse Del +| /tmp/pardes-snap/dirpane/cwd/sub/ Get Tty Collapse Del | 1 .hidden beta-gamma.txt inner.txt | 2 alpha.txt deeper/ zeta | 3 == snap entry-open grid=80x24 cursor=7,9 -|8: /tmp/pardes-snap/dirpane/cwd/sub/inner.txt Save Tty Collapse Del +|8: /tmp/pardes-snap/dirpane/cwd/sub/inner.txt Save Tty Collapse Del |9: 1 inner-marker diff --git a/test/snapshots/doccol.golden b/test/snapshots/doccol.golden index 21424456..0d71dffa 100644 --- a/test/snapshots/doccol.golden +++ b/test/snapshots/doccol.golden @@ -1,25 +1,25 @@ == snap boot grid=100x31 cursor=7,4 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/doccol/cwd/a.txt Save Tty Coll /tmp/pardes-snap/doccol/cwd Tty+bash Save Mode -| apse Del Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/doccol/cwd/a.txt Save Tty Colla /tmp/pardes-snap/doccol/cwd Tty+bash Save Mode F +| pse Del ilter Collapse Del | 1 AAA ls | a.txt b.txt c.txt == snap two-docs grid=100x31 cursor=7,19 -|17: /tmp/pardes-snap/doccol/cwd/b.txt Save Tty Coll -|18: apse Del +|17: /tmp/pardes-snap/doccol/cwd/b.txt Save Tty Colla +|18: pse Del |19: 1 BBB |20: 2 B-TWO == snap moved grid=100x31 cursor=57,22 |17: |18: |19: -|20: /tmp/pardes-snap/doccol/cwd/b.txt Save Tty Coll -|21: apse Del +|20: /tmp/pardes-snap/doccol/cwd/b.txt Save Tty Colla +|21: pse Del |22: 1 BBB |23: 2 B-TWO == snap worked grid=100x31 cursor=59,23 == snap third grid=100x31 cursor=57,28 -|26: /tmp/pardes-snap/doccol/cwd/c.txt Save Tty Coll -|27: apse Del +|26: /tmp/pardes-snap/doccol/cwd/c.txt Save Tty Colla +|27: pse Del |28: 1 CCC diff --git a/test/snapshots/edit.golden b/test/snapshots/edit.golden index aa39ed9c..2ac4dfcf 100644 --- a/test/snapshots/edit.golden +++ b/test/snapshots/edit.golden @@ -1,8 +1,8 @@ == snap inserted grid=100x31 cursor=16,10 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/edit/cwd Tty+bash Save Mode Fi /tmp/pardes-snap/edit/cwd Tty+bash Save Mode Fi -| lter Collapse Del lter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/edit/cwd Tty+bash Save Mode Fil /tmp/pardes-snap/edit/cwd Tty+bash Save Mode Fil +| ter Collapse Del ter Collapse Del | ls ls | e.txt e.txt | @@ -16,15 +16,15 @@ | | | -| /tmp/pardes-snap/edit/cwd Tty+bash Save Mode Fi -| lter Collapse Del +| /tmp/pardes-snap/edit/cwd Tty+bash Save Mode Fil +| ter Collapse Del | ls | e.txt == style inserted grid=100x31 -|0: 0-99 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-49 #becfc4,#314738, 50-51 #becfc4,#887455, 52-52 #becfc4,#1d2824, 53-99 #b2c3b8,#1d2824, -|2: 0-1 d,#add38a, 2-2 d,#314738, 3-28 #becfc4,#314738, 29-37 #dfbce5,#314738, 38-49 #becfc4,#314738, 50-51 #becfc4,#496656, 52-52 #becfc4,#1d2824, 53-78 #b2c3b8,#1d2824, 79-87 #d3b0d9,#1d2824, 88-99 #b2c3b8,#1d2824, -|3: 0-2 d,#314738, 3-49 #becfc4,#314738, 50-52 #becfc4,#1d2824, 53-99 #b2c3b8,#1d2824, +|0: 0-1 d,#1d2824, 2-99 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-49 #becfc4,#314738, 50-51 #becfc4,#887455, 52-99 #b2c3b8,#1d2824, +|2: 0-1 d,#add38a, 2-27 #becfc4,#314738, 28-36 #dfbce5,#314738, 37-49 #becfc4,#314738, 50-51 #becfc4,#496656, 52-77 #b2c3b8,#1d2824, 78-86 #d3b0d9,#1d2824, 87-99 #b2c3b8,#1d2824, +|3: 0-1 d,#314738, 2-49 #becfc4,#314738, 50-51 #becfc4,#1d2824, 52-99 #b2c3b8,#1d2824, |4: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, |6: 0-0 d,#608269, 1-49 d,#0d1410, 50-50 d,#608269, 51-99 d,#0d1410, @@ -38,8 +38,8 @@ |14: 0-0 d,#608269, 1-49 d,#0d1410, 50-50 d,#608269, 51-99 d,#0d1410, |15: 0-0 d,#608269, 1-49 d,#0d1410, 50-50 d,#608269, 51-99 d,#0d1410, |16: 0-0 d,#608269, 1-49 d,#0d1410, 50-50 d,#608269, 51-99 d,#0d1410, -|17: 0-1 d,#496656, 2-2 d,#1d2824, 3-28 #b2c3b8,#1d2824, 29-37 #d3b0d9,#1d2824, 38-49 #b2c3b8,#1d2824, 50-50 #b2c3b8,#608269, 51-99 #b2c3b8,#0d1410, -|18: 0-2 d,#1d2824, 3-49 #b2c3b8,#1d2824, 50-50 #b2c3b8,#608269, 51-99 #b2c3b8,#0d1410, +|17: 0-1 d,#496656, 2-27 #b2c3b8,#1d2824, 28-36 #d3b0d9,#1d2824, 37-49 #b2c3b8,#1d2824, 50-50 #b2c3b8,#608269, 51-99 #b2c3b8,#0d1410, +|18: 0-1 d,#1d2824, 2-49 #b2c3b8,#1d2824, 50-50 #b2c3b8,#608269, 51-99 #b2c3b8,#0d1410, |19: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, |20: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, |21: 0-0 d,#608269, 1-49 d,#0d1410, 50-50 d,#608269, 51-99 d,#0d1410, diff --git a/test/snapshots/emptycol.golden b/test/snapshots/emptycol.golden index 9bac8492..bd00a2cd 100644 --- a/test/snapshots/emptycol.golden +++ b/test/snapshots/emptycol.golden @@ -1,17 +1,17 @@ -== snap newcol grid=100x24 cursor=53,1 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/emptycol/cwd/notes.txt Save Tt -| y Collapse Del +== snap newcol grid=100x24 cursor=52,1 +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/emptycol/cwd/notes.txt Save Tty +| Collapse Del | 1 one | 2 two == snap filled grid=100x24 cursor=54,6 -|2: /tmp/pardes-snap/emptycol/cwd/notes.txt Save Tt /tmp/pardes-snap/emptycol/cwd Tty+bash Save Mod -|3: y Collapse Del e Filter Collapse Del +|2: /tmp/pardes-snap/emptycol/cwd/notes.txt Save Tty /tmp/pardes-snap/emptycol/cwd Tty+bash Save Mode +|3: Collapse Del Filter Collapse Del |4: 1 one ls |5: 2 two notes.txt -== snap emptied grid=100x24 cursor=53,1 -|2: /tmp/pardes-snap/emptycol/cwd/notes.txt Save Tt -|3: y Collapse Del +== snap emptied grid=100x24 cursor=52,1 +|2: /tmp/pardes-snap/emptycol/cwd/notes.txt Save Tty +|3: Collapse Del |4: 1 one |5: 2 two diff --git a/test/snapshots/exec-bigdrag.golden b/test/snapshots/exec-bigdrag.golden index a2ac6610..f3cd71b1 100644 --- a/test/snapshots/exec-bigdrag.golden +++ b/test/snapshots/exec-bigdrag.golden @@ -1,7 +1,7 @@ == snap alive grid=200x61 cursor=119,38 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/exec-bigdrag/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/exec-bigdrag/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/exec-bigdrag/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/exec-bigdrag/cwd Tty+bash Save Mode Filter Collapse Del | ls 2 | big.txt bash: 91line: command not found | 802line 2803line 2804line 2805line 2806line 2807line 2808line 2809line 2810line 2811line 2812lin @@ -31,7 +31,7 @@ | 89line 2890line 2891line 2892line 2893line 2894line 2895line 2896line 2897line 2898line 2899line | 2 | bash: 89line: command not found -| /tmp/pardes-snap/exec-bigdrag/cwd Tty+bash Save Mode Filter Collapse Del 900line 2901line 2902line 2903line 2904line 2905line 2906line 2907line 2908line 2909line 2910lin +| /tmp/pardes-snap/exec-bigdrag/cwd Tty+bash Save Mode Filter Collapse Del 900line 2901line 2902line 2903line 2904line 2905line 2906line 2907line 2908line 2909line 2910lin | ls e | big.txt bash: 900line: command not found | 2911line 2912line 2913line 2914line 2915line 2916line 2917line 2918line 2919line 2920line 2921li diff --git a/test/snapshots/exec.golden b/test/snapshots/exec.golden index a9f8716e..df49336c 100644 --- a/test/snapshots/exec.golden +++ b/test/snapshots/exec.golden @@ -1,7 +1,7 @@ == snap exec grid=140x31 cursor=16,8 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/exec/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/exec/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/exec/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/exec/cwd Tty+bash Save Mode Filter Collapse Del | ls Exec ls | e.txt e.txt | @@ -16,7 +16,7 @@ | | | -| /tmp/pardes-snap/exec/cwd Tty+bash Save Mode Filter Collapse Del +| /tmp/pardes-snap/exec/cwd Tty+bash Save Mode Filter Collapse Del | ls | e.txt == snap kept grid=140x31 cursor=6,3 diff --git a/test/snapshots/fileedit.golden b/test/snapshots/fileedit.golden index 5ba6e18a..b484177b 100644 --- a/test/snapshots/fileedit.golden +++ b/test/snapshots/fileedit.golden @@ -1,11 +1,11 @@ == snap edited grid=150x31 cursor=17,7 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/fileedit/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/fileedit/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/fileedit/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/fileedit/cwd Tty+bash Save Mode Filter Collapse Del | ls ls | f.txt f.txt | -| * /tmp/pardes-snap/fileedit/cwd/f.txt Save Tty Collapse Del +| */tmp/pardes-snap/fileedit/cwd/f.txt Save Tty Collapse Del | 1 liEDIT''MEne 1 | 2 line 2 | 3 line 3 @@ -16,7 +16,7 @@ | 8 line 8 | 9 line 9 | 10 line 10 -| /tmp/pardes-snap/fileedit/cwd Tty+bash Save Mode Filter Collapse Del +| /tmp/pardes-snap/fileedit/cwd Tty+bash Save Mode Filter Collapse Del | ls | f.txt == snap deleted grid=150x31 cursor=7,8 diff --git a/test/snapshots/filewatch.golden b/test/snapshots/filewatch.golden index 36f51582..ebd68fee 100644 --- a/test/snapshots/filewatch.golden +++ b/test/snapshots/filewatch.golden @@ -1,11 +1,11 @@ == snap edited grid=210x31 cursor=15,7 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/filewatch/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/filewatch/cwd Tty+bash Save Mode Filter Collapse Del | ls | sub w.txt | -| * /tmp/pardes-snap/filewatch/cwd/w.txt Save Tty Collapse Del +| */tmp/pardes-snap/filewatch/cwd/w.txt Save Tty Collapse Del | 1 liMYEDITne 1 | 2 line 2 | 3 /tmp/pardes-snap/filewatch/cwd/sub/s.txt @@ -18,7 +18,7 @@ | 10 line 10 | 11 line 11 | 12 line 12 -| /tmp/pardes-snap/filewatch/cwd/sub/s.txt Save Tty Collapse Del +| /tmp/pardes-snap/filewatch/cwd/sub/s.txt Save Tty Collapse Del | 1 line 1 | 2 line 2 | 3 line 3 diff --git a/test/snapshots/find.golden b/test/snapshots/find.golden index c9c6b755..47480b83 100644 --- a/test/snapshots/find.golden +++ b/test/snapshots/find.golden @@ -1,7 +1,7 @@ == snap group grid=120x41 cursor=7,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/find/cwd/here.txt Save Tty Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/find/cwd/here.txt Save Tty Collapse Del | 1 Find SPC f == snap armed grid=120x41 cursor=119,4 |3: 1 Find Find @@ -11,25 +11,25 @@ |4: == snap results grid=120x41 cursor=7,3 |3: 1 Find -|5: /tmp/pardes-snap/find/cwd/+Search Save Tty Collapse Del +|5: /tmp/pardes-snap/find/cwd/+Search Save Tty Collapse Del |6: 1 sub/ZQMARK-beta.txt |7: 2 sub/nest/zqmark-gamma.txt |8: 3 zqmark-alpha.txt |9: 4 == snap first grid=120x41 cursor=7,10 -|9: /tmp/pardes-snap/find/cwd/sub/ZQMARK-beta.txt Save Tty Collapse Del +|9: /tmp/pardes-snap/find/cwd/sub/ZQMARK-beta.txt Save Tty Collapse Del |10: 1 beta body == style first grid=120x41 -|0: 0-119 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-119 #becfc4,#314738, -|2: 0-1 d,#496656, 2-2 d,#1d2824, 3-28 #b2c3b8,#1d2824, 29-37 #d3b0d9,#1d2824, 38-119 #b2c3b8,#1d2824, +|0: 0-1 d,#1d2824, 2-119 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-119 #becfc4,#314738, +|2: 0-1 d,#496656, 2-27 #b2c3b8,#1d2824, 28-36 #d3b0d9,#1d2824, 37-119 #b2c3b8,#1d2824, |3: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-119 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-119 d,#0d1410, -|5: 0-1 d,#496656, 2-2 d,#1d2824, 3-28 #b2c3b8,#1d2824, 29-36 #d3b0d9,#1d2824, 37-119 #b2c3b8,#1d2824, +|5: 0-1 d,#496656, 2-27 #b2c3b8,#1d2824, 28-35 #d3b0d9,#1d2824, 36-119 #b2c3b8,#1d2824, |6: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-119 #e5eee5,#0d1410, |7: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-119 #e5eee5,#0d1410, |8: 0-0 d,#152019, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-119 #e5eee5,#0d1410, -|9: 0-1 d,#add38a, 2-2 d,#314738, 3-32 #becfc4,#314738, 33-48 #dfbce5,#314738, 49-119 #becfc4,#314738, +|9: 0-1 d,#add38a, 2-31 #becfc4,#314738, 32-47 #dfbce5,#314738, 48-119 #becfc4,#314738, |10: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-119 #e5eee5,#0d1410, |11: 0-0 d,#608269, 1-119 d,#0d1410, |12: 0-0 d,#608269, 1-119 d,#0d1410, @@ -62,10 +62,10 @@ |39: 0-0 d,#608269, 1-119 d,#0d1410, |40: 0-0 d,#608269, 1-119 d,#0d1410, == snap second grid=120x41 cursor=7,13 -|12: /tmp/pardes-snap/find/cwd/sub/nest/zqmark-gamma.txt Save Tty Collapse Del +|12: /tmp/pardes-snap/find/cwd/sub/nest/zqmark-gamma.txt Save Tty Collapse Del |13: 1 gamma body == snap third grid=120x41 cursor=7,16 -|15: /tmp/pardes-snap/find/cwd/zqmark-alpha.txt Save Tty Collapse Del +|15: /tmp/pardes-snap/find/cwd/zqmark-alpha.txt Save Tty Collapse Del |16: 1 alpha body == snap back grid=120x41 cursor=7,13 == snap word grid=120x41 cursor=7,13 diff --git a/test/snapshots/fsearch.golden b/test/snapshots/fsearch.golden index 7ba94492..62c37c25 100644 --- a/test/snapshots/fsearch.golden +++ b/test/snapshots/fsearch.golden @@ -1,11 +1,11 @@ == snap opened grid=180x31 cursor=7,7 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/fsearch/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/fsearch/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/fsearch/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/fsearch/cwd Tty+bash Save Mode Filter Collapse Del | ls ls | g.txt g.txt | -| /tmp/pardes-snap/fsearch/cwd/g.txt Save Tty Collapse Del +| /tmp/pardes-snap/fsearch/cwd/g.txt Save Tty Collapse Del | 1 l1 | 2 MARK a | 3 l3 @@ -16,14 +16,14 @@ | 8 l8 | 9 l9 | 10 MARK c -| /tmp/pardes-snap/fsearch/cwd Tty+bash Save Mode Filter Collapse Del +| /tmp/pardes-snap/fsearch/cwd Tty+bash Save Mode Filter Collapse Del | ls | g.txt == snap typing grid=180x31 cursor=89,7 |7: 1 l1 /MARK == snap results grid=180x31 cursor=10,8 |7: 1 l1 -|21: /tmp/pardes-snap/fsearch/cwd/+Search Save Tty Collapse Del LocationsConfig +|21: /tmp/pardes-snap/fsearch/cwd/+Search Save Tty Collapse LocationsConfig Del |22: 1 g.txt:2:1-4 |23: 2 MARK a |24: 3 g.txt:6:1-4 @@ -32,13 +32,13 @@ |27: 6 MARK c |28: 7 == style results grid=180x31 -|0: 0-179 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-89 #becfc4,#314738, 90-91 #becfc4,#887455, 92-92 #becfc4,#1d2824, 93-179 #b2c3b8,#1d2824, -|2: 0-1 d,#496656, 2-2 d,#1d2824, 3-31 #b2c3b8,#1d2824, 32-40 #d3b0d9,#1d2824, 41-89 #b2c3b8,#1d2824, 90-91 #b2c3b8,#496656, 92-121 #b2c3b8,#1d2824, 122-130 #d3b0d9,#1d2824, 131-179 #b2c3b8,#1d2824, +|0: 0-1 d,#1d2824, 2-179 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-89 #becfc4,#314738, 90-91 #becfc4,#887455, 92-179 #b2c3b8,#1d2824, +|2: 0-1 d,#496656, 2-30 #b2c3b8,#1d2824, 31-39 #d3b0d9,#1d2824, 40-89 #b2c3b8,#1d2824, 90-91 #b2c3b8,#496656, 92-120 #b2c3b8,#1d2824, 121-129 #d3b0d9,#1d2824, 130-179 #b2c3b8,#1d2824, |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 #e5eee5,#608269, 91-179 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 #e5eee5,#608269, 91-179 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-179 d,#0d1410, -|6: 0-1 d,#add38a, 2-2 d,#314738, 3-31 #becfc4,#314738, 32-37 #dfbce5,#314738, 38-89 #becfc4,#314738, 90-90 #becfc4,#608269, 91-179 #becfc4,#0d1410, +|6: 0-1 d,#add38a, 2-30 #becfc4,#314738, 31-36 #dfbce5,#314738, 37-89 #becfc4,#314738, 90-90 #becfc4,#608269, 91-179 #becfc4,#0d1410, |7: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-89 #e5eee5,#0d1410, 90-90 #e5eee5,#608269, 91-179 #e5eee5,#0d1410, |8: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-10 #f5f7ee,#3c614a, 11-11 #f5f7ee,#0d1410, 12-89 #e5eee5,#0d1410, 90-90 #e5eee5,#608269, 91-179 #e5eee5,#0d1410, |9: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-89 #e5eee5,#0d1410, 90-90 #e5eee5,#608269, 91-179 #e5eee5,#0d1410, @@ -49,11 +49,11 @@ |14: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-89 #e5eee5,#0d1410, 90-90 #e5eee5,#608269, 91-179 #e5eee5,#0d1410, |15: 0-0 d,#152019, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-89 #e5eee5,#0d1410, 90-90 #e5eee5,#608269, 91-179 #e5eee5,#0d1410, |16: 0-0 d,#152019, 1-3 d,#0d1410, 4-6 #59675c,#0d1410, 7-89 #e5eee5,#0d1410, 90-90 #e5eee5,#608269, 91-179 #e5eee5,#0d1410, -|17: 0-1 d,#496656, 2-2 d,#1d2824, 3-31 #b2c3b8,#1d2824, 32-40 #d3b0d9,#1d2824, 41-89 #b2c3b8,#1d2824, 90-90 #b2c3b8,#608269, 91-179 #b2c3b8,#0d1410, +|17: 0-1 d,#496656, 2-30 #b2c3b8,#1d2824, 31-39 #d3b0d9,#1d2824, 40-89 #b2c3b8,#1d2824, 90-90 #b2c3b8,#608269, 91-179 #b2c3b8,#0d1410, |18: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 #e5eee5,#608269, 91-179 #e5eee5,#0d1410, |19: 0-0 d,#608269, 1-1 d,#0d1410, 2-89 #e5eee5,#0d1410, 90-90 #e5eee5,#608269, 91-179 #e5eee5,#0d1410, |20: 0-0 d,#608269, 1-89 d,#0d1410, 90-90 d,#608269, 91-179 d,#0d1410, -|21: 0-1 d,#496656, 2-2 d,#1d2824, 3-31 #b2c3b8,#1d2824, 32-39 #d3b0d9,#1d2824, 40-89 #b2c3b8,#1d2824, 90-90 #b2c3b8,#608269, 91-179 #b2c3b8,#0d1410, +|21: 0-1 d,#496656, 2-30 #b2c3b8,#1d2824, 31-38 #d3b0d9,#1d2824, 39-89 #b2c3b8,#1d2824, 90-90 #b2c3b8,#608269, 91-179 #b2c3b8,#0d1410, |22: 0-0 d,#608269, 1-4 d,#0d1410, 5-89 #59675c,#0d1410, 90-90 #59675c,#608269, 91-179 #59675c,#0d1410, |23: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-10 #f7e4a5,#5e4923, 11-11 #f7e4a5,#0d1410, 12-89 #e5eee5,#0d1410, 90-90 #e5eee5,#608269, 91-179 #e5eee5,#0d1410, |24: 0-0 d,#608269, 1-4 d,#0d1410, 5-89 #59675c,#0d1410, 90-90 #59675c,#608269, 91-179 #59675c,#0d1410, @@ -88,7 +88,7 @@ |16: 10 MARK c == snap cancel grid=180x31 cursor=10,12 == snap nomatch grid=180x31 cursor=7,26 -|11: /tmp/pardes-snap/fsearch/cwd/+Search Save Tty Collapse Del LocationsConfig +|11: /tmp/pardes-snap/fsearch/cwd/+Search Save Tty Collapse LocationsConfig Del |12: 1 |13: |14: diff --git a/test/snapshots/ghostty-mid.golden b/test/snapshots/ghostty-mid.golden index 4bd8bf1f..6f61736e 100644 --- a/test/snapshots/ghostty-mid.golden +++ b/test/snapshots/ghostty-mid.golden @@ -1,8 +1,8 @@ == snap ghostty-mid grid=100x31 cursor=4,8 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/ghostty-mid/cwd Tty+bash Save /tmp/pardes-snap/ghostty-mid/cwd Tty+bash Save -| Mode Filter Collapse Del Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/ghostty-mid/cwd Tty+bash Save M /tmp/pardes-snap/ghostty-mid/cwd Tty+bash Save M +| ode Filter Collapse Del ode Filter Collapse Del | ZZPAD ls | ./g.sh g.txt | ./g.sh @@ -16,7 +16,7 @@ | | | -| /tmp/pardes-snap/ghostty-mid/cwd Tty+bash Save -| Mode Filter Collapse Del +| /tmp/pardes-snap/ghostty-mid/cwd Tty+bash Save M +| ode Filter Collapse Del | ls | g.txt diff --git a/test/snapshots/grep.golden b/test/snapshots/grep.golden index 687d7099..957096c3 100644 --- a/test/snapshots/grep.golden +++ b/test/snapshots/grep.golden @@ -1,11 +1,11 @@ == snap opened grid=180x31 cursor=7,7 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/grep/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/grep/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/grep/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/grep/cwd Tty+bash Save Mode Filter Collapse Del | ls ls | a.txt noise.txt sub a.txt noise.txt sub | -| /tmp/pardes-snap/grep/cwd/a.txt Save Tty Collapse Del +| /tmp/pardes-snap/grep/cwd/a.txt Save Tty Collapse Del | 1 hello TARGET one | 2 nothing here | 3 last TARGET line @@ -16,25 +16,25 @@ | | | -| /tmp/pardes-snap/grep/cwd Tty+bash Save Mode Filter Collapse Del +| /tmp/pardes-snap/grep/cwd Tty+bash Save Mode Filter Collapse Del | ls | a.txt noise.txt sub == snap typing grid=180x31 cursor=89,7 |7: 1 hello TARGET one Grep /TARGET == snap results grid=180x31 cursor=7,7 |7: 1 hello TARGET one -|21: /tmp/pardes-snap/grep/cwd/+Search Save Tty Collapse Del LocationsConfig +|21: /tmp/pardes-snap/grep/cwd/+Search Save Tty Collapse LocationsConfig Del |22: 1 a.txt:1:7-12 hello TARGET one |23: 2 a.txt:3:6-11 last TARGET line |24: 3 sub/b.txt:2:1-6 TARGET inside sub |25: 4 == snap first grid=180x31 cursor=18,7 == snap opened-hit grid=180x31 cursor=12,12 -|10: /tmp/pardes-snap/grep/cwd/sub/b.txt Save Tty Collapse Del +|10: /tmp/pardes-snap/grep/cwd/sub/b.txt Save Tty Collapse Del |11: 1 deep |12: 2 TARGET inside sub == snap nomatch grid=180x31 cursor=2,4 -|25: /tmp/pardes-snap/grep/cwd/sub/+Search Save Tty Collapse Del LocationsConfig +|25: /tmp/pardes-snap/grep/cwd/sub/+Search Save Tty Collapse LocationsConfig Del |26: 1 == snap chordsel grid=180x31 cursor=19,7 == snap chord grid=180x31 cursor=19,7 diff --git a/test/snapshots/headersweep-restored.golden b/test/snapshots/headersweep-restored.golden index 176520dd..522945bd 100644 --- a/test/snapshots/headersweep-restored.golden +++ b/test/snapshots/headersweep-restored.golden @@ -1,8 +1,8 @@ == style col-sweeping grid=120x21 -|0: 0-119 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-35 #becfc4,#314738, 36-43 #f5f7ee,#5b7e5a, 44-59 #becfc4,#314738, 60-61 #becfc4,#887455, 62-62 #becfc4,#1d2824, 63-119 #b2c3b8,#1d2824, -|2: 0-1 d,#add38a, 2-2 d,#314738, 3-44 #becfc4,#314738, 45-53 #dfbce5,#314738, 54-59 #becfc4,#314738, 60-61 #becfc4,#496656, 62-62 #becfc4,#1d2824, 63-104 #b2c3b8,#1d2824, 105-113 #d3b0d9,#1d2824, 114-119 #b2c3b8,#1d2824, -|3: 0-2 d,#314738, 3-59 #becfc4,#314738, 60-62 #becfc4,#1d2824, 63-119 #b2c3b8,#1d2824, +|0: 0-1 d,#1d2824, 2-119 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-34 #becfc4,#314738, 35-42 #f5f7ee,#5b7e5a, 43-59 #becfc4,#314738, 60-61 #becfc4,#887455, 62-119 #b2c3b8,#1d2824, +|2: 0-1 d,#add38a, 2-43 #becfc4,#314738, 44-52 #dfbce5,#314738, 53-59 #becfc4,#314738, 60-61 #becfc4,#496656, 62-103 #b2c3b8,#1d2824, 104-112 #d3b0d9,#1d2824, 113-119 #b2c3b8,#1d2824, +|3: 0-1 d,#314738, 2-59 #becfc4,#314738, 60-61 #becfc4,#1d2824, 62-119 #b2c3b8,#1d2824, |4: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, |6: 0-0 d,#608269, 1-1 d,#0d1410, 2-23 #e5eee5,#0d1410,f 24-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-61 #e5eee5,#0d1410, 62-83 #e5eee5,#0d1410,f 84-119 #e5eee5,#0d1410, @@ -11,8 +11,8 @@ |9: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, |10: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, |11: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, -|12: 0-1 d,#496656, 2-2 d,#1d2824, 3-44 #b2c3b8,#1d2824, 45-53 #d3b0d9,#1d2824, 54-59 #b2c3b8,#1d2824, 60-60 #b2c3b8,#608269, 61-119 #b2c3b8,#0d1410, -|13: 0-2 d,#1d2824, 3-59 #b2c3b8,#1d2824, 60-60 #b2c3b8,#608269, 61-119 #b2c3b8,#0d1410, +|12: 0-1 d,#496656, 2-43 #b2c3b8,#1d2824, 44-52 #d3b0d9,#1d2824, 53-59 #b2c3b8,#1d2824, 60-60 #b2c3b8,#608269, 61-119 #b2c3b8,#0d1410, +|13: 0-1 d,#1d2824, 2-59 #b2c3b8,#1d2824, 60-60 #b2c3b8,#608269, 61-119 #b2c3b8,#0d1410, |14: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, |15: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, |16: 0-0 d,#608269, 1-1 d,#0d1410, 2-23 #e5eee5,#0d1410,f 24-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, @@ -21,10 +21,10 @@ |19: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, |20: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, == snap col-swept grid=120x21 cursor=4,7 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit Restore /tmp/pardes-snap/headersweep-restore -| New Tty Find Grep Joincol Delcol echo RE''STORED-COL New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/headersweep-restored/cwd Tty+bash Save M /tmp/pardes-snap/headersweep-restored/cwd Tty+bash Save M -| ode Filter Collapse Del ode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit Restore /tmp/pardes-snap/headersweep-resto +| New Tty Find Grep Joincol Delcol echo RE''STORED-COL New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/headersweep-restored/cwd Tty+bash Save Mo /tmp/pardes-snap/headersweep-restored/cwd Tty+bash Save Mo +| de Filter Collapse Del de Filter Collapse Del | $ ls $ ls | $ $ | ── restored history ── ── restored history ── @@ -33,22 +33,22 @@ | | | -| /tmp/pardes-snap/headersweep-restored/cwd Tty+bash Save M -| ode Filter Collapse Del +| /tmp/pardes-snap/headersweep-restored/cwd Tty+bash Save Mo +| de Filter Collapse Del | $ | ── restored history ── | -| /tmp/pardes-snap/headersweep-restored/cwd (echo RE''STORE -| D-COL) exit 0 Kill Save Collapse Del +| /tmp/pardes-snap/headersweep-restored/cwd (echo RE''STORED +| -COL) exit 0 Kill Save Collapse Del | exit 0 == style ws-sweeping grid=120x21 -|0: 0-100 #b2c3b8,#1d2824, 101-108 #f5f7ee,#5b7e5a, 109-119 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-59 #becfc4,#314738, 60-61 #becfc4,#887455, 62-62 #becfc4,#1d2824, 63-119 #b2c3b8,#1d2824, +|0: 0-1 d,#1d2824, 2-100 #b2c3b8,#1d2824, 101-108 #f5f7ee,#5b7e5a, 109-119 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-59 #becfc4,#314738, 60-61 #becfc4,#887455, 62-119 #b2c3b8,#1d2824, |15: 0-0 d,#608269, 1-1 d,#0d1410, 2-23 #e5eee5,#0d1410,f 24-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, |16: 0-0 d,#152019, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, -|17: 0-1 d,#496656, 2-2 d,#1d2824, 3-59 #b2c3b8,#1d2824, 60-60 #b2c3b8,#608269, 61-119 #b2c3b8,#0d1410, -|18: 0-2 d,#1d2824, 3-59 #b2c3b8,#1d2824, 60-60 #b2c3b8,#608269, 61-119 #b2c3b8,#0d1410, +|17: 0-1 d,#496656, 2-59 #b2c3b8,#1d2824, 60-60 #b2c3b8,#608269, 61-119 #b2c3b8,#0d1410, +|18: 0-1 d,#1d2824, 2-59 #b2c3b8,#1d2824, 60-60 #b2c3b8,#608269, 61-119 #b2c3b8,#0d1410, |19: 0-0 d,#152019, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, == snap ws-swept grid=120x21 cursor=4,7 -|0: Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit Restore /tmp/pardes-snap/headersweep-rest ec -|18: D-WS) exit 0 Kill Save Collapse Del +|0: Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit Restore /tmp/pardes-snap/headersweep-re ec +|18: -WS) exit 0 Kill Save Collapse Del diff --git a/test/snapshots/headersweep.golden b/test/snapshots/headersweep.golden index c22120ca..a178306f 100644 --- a/test/snapshots/headersweep.golden +++ b/test/snapshots/headersweep.golden @@ -1,7 +1,7 @@ == style col-sweeping grid=120x21 -|0: 0-119 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-35 #becfc4,#314738, 36-43 #f5f7ee,#5b7e5a, 44-59 #becfc4,#314738, 60-61 #becfc4,#887455, 62-62 #becfc4,#1d2824, 63-119 #b2c3b8,#1d2824, -|2: 0-1 d,#add38a, 2-2 d,#314738, 3-35 #becfc4,#314738, 36-44 #dfbce5,#314738, 45-59 #becfc4,#314738, 60-61 #becfc4,#496656, 62-62 #becfc4,#1d2824, 63-95 #b2c3b8,#1d2824, 96-104 #d3b0d9,#1d2824, 105-119 #b2c3b8,#1d2824, +|0: 0-1 d,#1d2824, 2-119 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-34 #becfc4,#314738, 35-42 #f5f7ee,#5b7e5a, 43-59 #becfc4,#314738, 60-61 #becfc4,#887455, 62-119 #b2c3b8,#1d2824, +|2: 0-1 d,#add38a, 2-34 #becfc4,#314738, 35-43 #dfbce5,#314738, 44-59 #becfc4,#314738, 60-61 #becfc4,#496656, 62-94 #b2c3b8,#1d2824, 95-103 #d3b0d9,#1d2824, 104-119 #b2c3b8,#1d2824, |3: 0-2 d,#314738, 3-59 #becfc4,#314738, 60-62 #becfc4,#1d2824, 63-119 #b2c3b8,#1d2824, |4: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, @@ -11,7 +11,7 @@ |9: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, |10: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, |11: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, -|12: 0-1 d,#496656, 2-2 d,#1d2824, 3-35 #b2c3b8,#1d2824, 36-44 #d3b0d9,#1d2824, 45-59 #b2c3b8,#1d2824, 60-60 #b2c3b8,#608269, 61-119 #b2c3b8,#0d1410, +|12: 0-1 d,#496656, 2-34 #b2c3b8,#1d2824, 35-43 #d3b0d9,#1d2824, 44-59 #b2c3b8,#1d2824, 60-60 #b2c3b8,#608269, 61-119 #b2c3b8,#0d1410, |13: 0-2 d,#1d2824, 3-59 #b2c3b8,#1d2824, 60-60 #b2c3b8,#608269, 61-119 #b2c3b8,#0d1410, |14: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, |15: 0-0 d,#608269, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, @@ -21,10 +21,10 @@ |19: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, |20: 0-0 d,#608269, 1-59 d,#0d1410, 60-60 d,#608269, 61-119 d,#0d1410, == snap col-swept grid=120x21 cursor=4,6 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol echo SW''EPT-COL New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/headersweep/cwd Tty+bash Save Mode Filte /tmp/pardes-snap/headersweep/cwd Tty+bash Save Mode Filte -| r Collapse Del r Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol echo SW''EPT-COL New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/headersweep/cwd Tty+bash Save Mode Filter /tmp/pardes-snap/headersweep/cwd Tty+bash Save Mode Filter +| Collapse Del Collapse Del | ls ls | hay.txt hay.txt | @@ -33,31 +33,31 @@ | | | -| /tmp/pardes-snap/headersweep/cwd Tty+bash Save Mode Filte -| r Collapse Del +| /tmp/pardes-snap/headersweep/cwd Tty+bash Save Mode Filter +| Collapse Del | ls | hay.txt | -| /tmp/pardes-snap/headersweep/cwd (echo SW''EPT-COL) exit -| 0 Kill Save Collapse Del +| /tmp/pardes-snap/headersweep/cwd (echo SW''EPT-COL) exit 0 +| Kill Save Collapse Del | exit 0 == snap ws-swept grid=120x21 cursor=4,6 -|0: Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit echo SW''EPT-WS -|17: /tmp/pardes-snap/headersweep/cwd (echo SW''EPT-WS) exit 0 -|18: Kill Save Collapse Del +|0: Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit echo SW''EPT-WS +|17: /tmp/pardes-snap/headersweep/cwd (echo SW''EPT-WS) exit 0 +|18: Kill Save Collapse Del == snap ws-looked grid=120x21 cursor=7,9 -|0: Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit echo SW''EPT-WS xxhay.txtxx -|7: /tmp/pardes-snap/headersweep/cwd/hay.txt Save Tty Collaps -|8: e Del +|0: Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit echo SW''EPT-WS xxhay.txtxx +|7: /tmp/pardes-snap/headersweep/cwd/hay.txt Save Tty Collapse +|8: Del |9: 1 ZQNEEDLE == snap cancelled grid=120x21 cursor=7,9 == style selected grid=120x21 -|1: 0-1 d,#887455, 2-2 d,#1d2824, 3-59 #b2c3b8,#1d2824, 60-61 #b2c3b8,#887455, 62-62 #b2c3b8,#314738, 63-70 #becfc4,#314738, 71-79 #f5f7ee,#3c614a, 80-80 #f5f7ee,#314738, 81-119 #becfc4,#314738, -|2: 0-1 d,#496656, 2-2 d,#1d2824, 3-35 #b2c3b8,#1d2824, 36-44 #d3b0d9,#1d2824, 45-59 #b2c3b8,#1d2824, 60-61 #b2c3b8,#add38a, 62-62 #b2c3b8,#314738, 63-95 #becfc4,#314738, 96-104 #dfbce5,#314738, 105-119 #becfc4,#314738, +|1: 0-1 d,#887455, 2-59 #b2c3b8,#1d2824, 60-61 #b2c3b8,#887455, 62-69 #becfc4,#314738, 70-78 #f5f7ee,#3c614a, 79-79 #f5f7ee,#314738, 80-119 #becfc4,#314738, +|2: 0-1 d,#496656, 2-34 #b2c3b8,#1d2824, 35-43 #d3b0d9,#1d2824, 44-59 #b2c3b8,#1d2824, 60-61 #b2c3b8,#add38a, 62-94 #becfc4,#314738, 95-103 #dfbce5,#314738, 104-119 #becfc4,#314738, |3: 0-2 d,#1d2824, 3-59 #b2c3b8,#1d2824, 60-62 #b2c3b8,#314738, 63-119 #becfc4,#314738, -|7: 0-1 d,#496656, 2-2 d,#1d2824, 3-35 #b2c3b8,#1d2824, 36-43 #d3b0d9,#1d2824, 44-59 #b2c3b8,#1d2824, 60-60 #b2c3b8,#608269, 61-119 #b2c3b8,#0d1410, +|7: 0-1 d,#496656, 2-34 #b2c3b8,#1d2824, 35-42 #d3b0d9,#1d2824, 43-59 #b2c3b8,#1d2824, 60-60 #b2c3b8,#608269, 61-119 #b2c3b8,#0d1410, |8: 0-2 d,#1d2824, 3-59 #b2c3b8,#1d2824, 60-60 #b2c3b8,#608269, 61-119 #b2c3b8,#0d1410, |9: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, -|17: 0-1 d,#496656, 2-2 d,#1d2824, 3-59 #b2c3b8,#1d2824, 60-60 #b2c3b8,#608269, 61-119 #b2c3b8,#0d1410, -|18: 0-3 d,#1d2824, 4-59 #b2c3b8,#1d2824, 60-60 #b2c3b8,#608269, 61-119 #b2c3b8,#0d1410, +|17: 0-1 d,#496656, 2-59 #b2c3b8,#1d2824, 60-60 #b2c3b8,#608269, 61-119 #b2c3b8,#0d1410, +|18: 0-1 d,#1d2824, 2-59 #b2c3b8,#1d2824, 60-60 #b2c3b8,#608269, 61-119 #b2c3b8,#0d1410, |19: 0-0 d,#152019, 1-1 d,#0d1410, 2-59 #e5eee5,#0d1410, 60-60 #e5eee5,#608269, 61-119 #e5eee5,#0d1410, diff --git a/test/snapshots/hscroll.golden b/test/snapshots/hscroll.golden index e73bf4c3..23bb6279 100644 --- a/test/snapshots/hscroll.golden +++ b/test/snapshots/hscroll.golden @@ -1,13 +1,13 @@ == snap opened grid=90x31 cursor=7,9 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/hscroll/cwd Tty+bash Save /tmp/pardes-snap/hscroll/cwd Tty+bash Save -| Mode Filter Collapse Del Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/hscroll/cwd Tty+bash Save /tmp/pardes-snap/hscroll/cwd Tty+bash Save +| Mode Filter Collapse Del Mode Filter Collapse Del | ls ls | wide.txt wide.txt | -| /tmp/pardes-snap/hscroll/cwd/wide.txt Save -| Tty Collapse Del +| /tmp/pardes-snap/hscroll/cwd/wide.txt Save +| Tty Collapse Del | 1 short1 END_A_MARKER_WAY_OUT_RIGHT_padp | | @@ -16,8 +16,8 @@ | | | -| /tmp/pardes-snap/hscroll/cwd Tty+bash Save -| Mode Filter Collapse Del +| /tmp/pardes-snap/hscroll/cwd Tty+bash Save +| Mode Filter Collapse Del | ls | wide.txt == snap wheeled grid=90x31 cursor=7,9 diff --git a/test/snapshots/images.golden b/test/snapshots/images.golden index 0f15804b..51cb4922 100644 --- a/test/snapshots/images.golden +++ b/test/snapshots/images.golden @@ -1,12 +1,12 @@ == snap img-open grid=150x31 cursor=11,8 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/images/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/images/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/images/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/images/cwd Tty+bash Save Mode Filter Collapse Del | ls ls | pic.ppm pic.ppm | -| img petscii:on palette:commodore ascii:on /tmp/pardes-snap/images/cwd/pi -| c.ppm Tty Collapse Del +| img petscii:on palette:commodore ascii:on /tmp/pardes-snap/images/cwd/pic +| .ppm Tty Collapse Del | x🬱\╲🬌\~▄🬥4▟g*🬺🬶_🬆🬻 | >A8🬌Cq&.\H&🬹🬜C▛🬻 | >0p' | $ '\033_Ga=q,i=1,s=1,v=1,f=24,t=d;AAAA\033\\\033[>0p'Gi=1;OK diff --git a/test/snapshots/look-center.golden b/test/snapshots/look-center.golden index c861bb8f..fcc65ceb 100644 --- a/test/snapshots/look-center.golden +++ b/test/snapshots/look-center.golden @@ -1,11 +1,11 @@ == snap center-open grid=150x31 cursor=15,12 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/look-center/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/look-center/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/look-center/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/look-center/cwd Tty+bash Save Mode Filter Collapse Del | ls ls | big.txt big.txt | -| /tmp/pardes-snap/look-center/cwd/big.txt Save Tty Collapse Del +| /tmp/pardes-snap/look-center/cwd/big.txt Save Tty Collapse Del | 95 line 95 | 96 line 96 | 97 line 97 @@ -16,7 +16,7 @@ | 102 line 102 | 103 line 103 | 104 line 104 -| /tmp/pardes-snap/look-center/cwd Tty+bash Save Mode Filter Collapse Del +| /tmp/pardes-snap/look-center/cwd Tty+bash Save Mode Filter Collapse Del | ls | big.txt == snap center-dedup grid=150x31 cursor=15,12 diff --git a/test/snapshots/look-dir.golden b/test/snapshots/look-dir.golden index 29e67d5f..4acc0d79 100644 --- a/test/snapshots/look-dir.golden +++ b/test/snapshots/look-dir.golden @@ -1,13 +1,13 @@ == snap dir-open grid=100x31 cursor=4,11 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/look-dir/cwd Tty+bash Save Mod /tmp/pardes-snap/look-dir/cwd Tty+bash Save Mod -| e Filter Collapse Del e Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/look-dir/cwd Tty+bash Save Mode /tmp/pardes-snap/look-dir/cwd Tty+bash Save Mode +| Filter Collapse Del Filter Collapse Del | ls ls | sub top.txt sub top.txt | -| /tmp/pardes-snap/look-dir/cwd/sub Tty+bash Save -| Mode Filter Collapse Del +| /tmp/pardes-snap/look-dir/cwd/sub Tty+bash Save +| Mode Filter Collapse Del | ls | inner.txt | @@ -16,7 +16,7 @@ | | | -| /tmp/pardes-snap/look-dir/cwd Tty+bash Save Mod -| e Filter Collapse Del +| /tmp/pardes-snap/look-dir/cwd Tty+bash Save Mode +| Filter Collapse Del | ls | sub top.txt diff --git a/test/snapshots/look-file-1col.golden b/test/snapshots/look-file-1col.golden index 81ba4ded..53fc4237 100644 --- a/test/snapshots/look-file-1col.golden +++ b/test/snapshots/look-file-1col.golden @@ -1,11 +1,11 @@ == snap file-open-1col grid=100x31 cursor=14,19 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/look-file-1col/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/look-file-1col/cwd Tty+bash Save Mode Filter Collapse Del | ls | big.txt | -| /tmp/pardes-snap/look-file-1col/cwd/big.txt Save Tty Collapse Del +| /tmp/pardes-snap/look-file-1col/cwd/big.txt Save Tty Collapse Del | 28 line 28 | 29 line 29 | 30 line 30 diff --git a/test/snapshots/look-file.golden b/test/snapshots/look-file.golden index 4d4bbdfe..bf46f854 100644 --- a/test/snapshots/look-file.golden +++ b/test/snapshots/look-file.golden @@ -1,11 +1,11 @@ == snap file-open grid=150x31 cursor=14,12 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/look-file/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/look-file/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/look-file/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/look-file/cwd Tty+bash Save Mode Filter Collapse Del | ls ls | big.txt big.txt | -| /tmp/pardes-snap/look-file/cwd/big.txt Save Tty Collapse Del +| /tmp/pardes-snap/look-file/cwd/big.txt Save Tty Collapse Del | 35 line 35 | 36 line 36 | 37 line 37 @@ -16,17 +16,17 @@ | 42 line 42 | 43 line 43 | 44 line 44 -| /tmp/pardes-snap/look-file/cwd Tty+bash Save Mode Filter Collapse Del +| /tmp/pardes-snap/look-file/cwd Tty+bash Save Mode Filter Collapse Del | ls | big.txt == style file-open grid=150x31 -|0: 0-149 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-74 #becfc4,#314738, 75-76 #becfc4,#887455, 77-77 #becfc4,#1d2824, 78-149 #b2c3b8,#1d2824, -|2: 0-1 d,#496656, 2-2 d,#1d2824, 3-33 #b2c3b8,#1d2824, 34-42 #d3b0d9,#1d2824, 43-74 #b2c3b8,#1d2824, 75-76 #b2c3b8,#496656, 77-108 #b2c3b8,#1d2824, 109-117 #d3b0d9,#1d2824, 118-149 #b2c3b8,#1d2824, +|0: 0-1 d,#1d2824, 2-149 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-74 #becfc4,#314738, 75-76 #becfc4,#887455, 77-149 #b2c3b8,#1d2824, +|2: 0-1 d,#496656, 2-32 #b2c3b8,#1d2824, 33-41 #d3b0d9,#1d2824, 42-74 #b2c3b8,#1d2824, 75-76 #b2c3b8,#496656, 77-107 #b2c3b8,#1d2824, 108-116 #d3b0d9,#1d2824, 117-149 #b2c3b8,#1d2824, |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, -|6: 0-1 d,#add38a, 2-2 d,#314738, 3-33 #becfc4,#314738, 34-41 #dfbce5,#314738, 42-74 #becfc4,#314738, 75-75 #becfc4,#608269, 76-149 #becfc4,#0d1410, +|6: 0-1 d,#add38a, 2-32 #becfc4,#314738, 33-40 #dfbce5,#314738, 41-74 #becfc4,#314738, 75-75 #becfc4,#608269, 76-149 #becfc4,#0d1410, |7: 0-0 d,#152019, 1-3 d,#0d1410, 4-6 #59675c,#0d1410, 7-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |8: 0-0 d,#152019, 1-3 d,#0d1410, 4-6 #59675c,#0d1410, 7-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |9: 0-0 d,#152019, 1-3 d,#0d1410, 4-6 #59675c,#0d1410, 7-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, @@ -37,7 +37,7 @@ |14: 0-0 d,#152019, 1-3 d,#0d1410, 4-6 #59675c,#0d1410, 7-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |15: 0-0 d,#152019, 1-3 d,#0d1410, 4-6 #59675c,#0d1410, 7-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |16: 0-0 d,#152019, 1-3 d,#0d1410, 4-6 #59675c,#0d1410, 7-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, -|17: 0-1 d,#496656, 2-2 d,#1d2824, 3-33 #b2c3b8,#1d2824, 34-42 #d3b0d9,#1d2824, 43-74 #b2c3b8,#1d2824, 75-75 #b2c3b8,#608269, 76-149 #b2c3b8,#0d1410, +|17: 0-1 d,#496656, 2-32 #b2c3b8,#1d2824, 33-41 #d3b0d9,#1d2824, 42-74 #b2c3b8,#1d2824, 75-75 #b2c3b8,#608269, 76-149 #b2c3b8,#0d1410, |18: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |19: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |20: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, diff --git a/test/snapshots/lookloaded.golden b/test/snapshots/lookloaded.golden index a968a6dc..62028dc6 100644 --- a/test/snapshots/lookloaded.golden +++ b/test/snapshots/lookloaded.golden @@ -1,13 +1,13 @@ == snap file-open grid=100x31 cursor=14,13 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/lookloaded/cwd Tty+bash Save M /tmp/pardes-snap/lookloaded/cwd Tty+bash Save M -| ode Filter Collapse Del ode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/lookloaded/cwd Tty+bash Save Mo /tmp/pardes-snap/lookloaded/cwd Tty+bash Save Mo +| de Filter Collapse Del de Filter Collapse Del | ls ls | big.txt big.txt | -| /tmp/pardes-snap/lookloaded/cwd/big.txt Save Tt -| y Collapse Del +| /tmp/pardes-snap/lookloaded/cwd/big.txt Save Tty +| Collapse Del | 36 line 36 | 37 line 37 | 38 line 38 @@ -16,15 +16,15 @@ | 41 line 41 | 42 line 42 | 43 line 43 -| /tmp/pardes-snap/lookloaded/cwd Tty+bash Save M -| ode Filter Collapse Del +| /tmp/pardes-snap/lookloaded/cwd Tty+bash Save Mo +| de Filter Collapse Del | ls | big.txt == snap removed grid=100x31 cursor=54,8 |6: rm big.txt; echo GO''NE -|7: * /tmp/pardes-snap/lookloaded/cwd/big.txt Save Tt GONE +|7: */tmp/pardes-snap/lookloaded/cwd/big.txt Save Tty GONE == snap look-noFS grid=100x31 cursor=14,13 -|8: y Collapse Del big.txt:10 +|8: Collapse Del big.txt:10 |9: 6 line 6 |10: 7 line 7 |11: 8 line 8 diff --git a/test/snapshots/lookpanes.golden b/test/snapshots/lookpanes.golden index e0f55f5f..6689c710 100644 --- a/test/snapshots/lookpanes.golden +++ b/test/snapshots/lookpanes.golden @@ -1,48 +1,48 @@ == snap shells grid=130x51 cursor=122,4 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/lookpanes/cwd/beta/bmark.txt Save Tty Collaps /tmp/pardes-snap/lookpanes/cwd Tty+bash Save Mode Filter Colla -| e Del pse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/lookpanes/cwd/beta/bmark.txt Save Tty Collapse /tmp/pardes-snap/lookpanes/cwd Tty+bash Save Mode Filter Collap +| Del se Del | 1 both.txt ls zqonly.txt pick.txt twin.txt | 2 b-marker alpha beta zzboot.txt | -| /tmp/pardes-snap/lookpanes/cwd/alpha Tty+bash Save Mode Filter -| Collapse Del +| /tmp/pardes-snap/lookpanes/cwd/alpha Tty+bash Save Mode Filter +| Collapse Del | ls | amark.txt both.txt pick.txt twin.txt zqonly.txt == snap other-dir grid=130x51 cursor=7,8 -|6: /tmp/pardes-snap/lookpanes/cwd/alpha/zqonly.txt Save Tty Colla -|7: pse Del /tmp/pardes-snap/lookpanes/cwd/alpha Tty+bash Save Mode Filter -|8: 1 ONLY-IN-ALPHA Collapse Del +|6: /tmp/pardes-snap/lookpanes/cwd/alpha/zqonly.txt Save Tty Collap +|7: se Del /tmp/pardes-snap/lookpanes/cwd/alpha Tty+bash Save Mode Filter +|8: 1 ONLY-IN-ALPHA Collapse Del == snap clicked-wins grid=130x51 cursor=7,12 -|10: /tmp/pardes-snap/lookpanes/cwd/beta/both.txt Save Tty Collapse amark.txt both.txt pick.txt twin.txt zqonly.txt -|11: Del +|10: /tmp/pardes-snap/lookpanes/cwd/beta/both.txt Save Tty Collapse amark.txt both.txt pick.txt twin.txt zqonly.txt +|11: Del |12: 1 BOTH-FROM-BETA == snap mru-alpha grid=130x51 cursor=72,14 -|12: 1 BOTH-FROM-BETA /tmp/pardes-snap/lookpanes/cwd/alpha/pick.txt Save Tty Collaps -|13: e Del +|12: 1 BOTH-FROM-BETA /tmp/pardes-snap/lookpanes/cwd/alpha/pick.txt Save Tty Collapse +|13: Del |14: 1 PICK-FROM-ALPHA == snap mru-beta grid=130x51 cursor=7,16 -|14: /tmp/pardes-snap/lookpanes/cwd/beta/twin.txt Save Tty Collapse 1 PICK-FROM-ALPHA -|15: Del +|14: /tmp/pardes-snap/lookpanes/cwd/beta/twin.txt Save Tty Collapse 1 PICK-FROM-ALPHA +|15: Del |16: 1 TWIN-FROM-BETA == style mru-beta grid=130x51 -|0: 0-129 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-64 #becfc4,#314738, 65-66 #becfc4,#887455, 67-67 #becfc4,#1d2824, 68-129 #b2c3b8,#1d2824, -|2: 0-1 d,#496656, 2-2 d,#1d2824, 3-38 #b2c3b8,#1d2824, 39-48 #d3b0d9,#1d2824, 49-64 #b2c3b8,#1d2824, 65-66 #b2c3b8,#496656, 67-98 #b2c3b8,#1d2824, 99-107 #d3b0d9,#1d2824, 108-129 #b2c3b8,#1d2824, +|0: 0-1 d,#1d2824, 2-129 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-64 #becfc4,#314738, 65-66 #becfc4,#887455, 67-129 #b2c3b8,#1d2824, +|2: 0-1 d,#496656, 2-37 #b2c3b8,#1d2824, 38-47 #d3b0d9,#1d2824, 48-64 #b2c3b8,#1d2824, 65-66 #b2c3b8,#496656, 67-97 #b2c3b8,#1d2824, 98-106 #d3b0d9,#1d2824, 107-129 #b2c3b8,#1d2824, |3: 0-2 d,#1d2824, 3-129 #b2c3b8,#1d2824, |4: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-64 #e5eee5,#0d1410, 65-65 #e5eee5,#608269, 66-129 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-64 #e5eee5,#0d1410, 65-65 #e5eee5,#608269, 66-129 #e5eee5,#0d1410, -|6: 0-1 d,#496656, 2-2 d,#1d2824, 3-39 #b2c3b8,#1d2824, 40-50 #d3b0d9,#1d2824, 51-64 #b2c3b8,#1d2824, 65-65 #b2c3b8,#608269, 66-129 #b2c3b8,#0d1410, -|7: 0-2 d,#1d2824, 3-64 #b2c3b8,#1d2824, 65-66 #b2c3b8,#496656, 67-104 #b2c3b8,#1d2824, 105-113 #d3b0d9,#1d2824, 114-129 #b2c3b8,#1d2824, -|8: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-64 #e5eee5,#0d1410, 65-68 #e5eee5,#1d2824, 69-129 #b2c3b8,#1d2824, +|6: 0-1 d,#496656, 2-38 #b2c3b8,#1d2824, 39-49 #d3b0d9,#1d2824, 50-64 #b2c3b8,#1d2824, 65-65 #b2c3b8,#608269, 66-129 #b2c3b8,#0d1410, +|7: 0-1 d,#1d2824, 2-64 #b2c3b8,#1d2824, 65-66 #b2c3b8,#496656, 67-103 #b2c3b8,#1d2824, 104-112 #d3b0d9,#1d2824, 113-129 #b2c3b8,#1d2824, +|8: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-64 #e5eee5,#0d1410, 65-66 #e5eee5,#1d2824, 67-129 #b2c3b8,#1d2824, |9: 0-0 d,#608269, 1-64 d,#0d1410, 65-65 d,#608269, 66-66 d,#0d1410, 67-129 #e5eee5,#0d1410, -|10: 0-1 d,#496656, 2-2 d,#1d2824, 3-38 #b2c3b8,#1d2824, 39-47 #d3b0d9,#1d2824, 48-64 #b2c3b8,#1d2824, 65-65 #b2c3b8,#608269, 66-66 #b2c3b8,#0d1410, 67-129 #e5eee5,#0d1410, -|11: 0-3 d,#1d2824, 4-64 #b2c3b8,#1d2824, 65-65 #b2c3b8,#608269, 66-129 #b2c3b8,#0d1410, -|12: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-64 #e5eee5,#0d1410, 65-66 #e5eee5,#496656, 67-67 #e5eee5,#1d2824, 68-104 #b2c3b8,#1d2824, 105-113 #d3b0d9,#1d2824, 114-129 #b2c3b8,#1d2824, +|10: 0-1 d,#496656, 2-37 #b2c3b8,#1d2824, 38-46 #d3b0d9,#1d2824, 47-64 #b2c3b8,#1d2824, 65-65 #b2c3b8,#608269, 66-66 #b2c3b8,#0d1410, 67-129 #e5eee5,#0d1410, +|11: 0-1 d,#1d2824, 2-64 #b2c3b8,#1d2824, 65-65 #b2c3b8,#608269, 66-129 #b2c3b8,#0d1410, +|12: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-64 #e5eee5,#0d1410, 65-66 #e5eee5,#496656, 67-103 #b2c3b8,#1d2824, 104-112 #d3b0d9,#1d2824, 113-129 #b2c3b8,#1d2824, |13: 0-0 d,#608269, 1-64 d,#0d1410, 65-67 d,#1d2824, 68-129 #b2c3b8,#1d2824, -|14: 0-1 d,#add38a, 2-2 d,#314738, 3-38 #becfc4,#314738, 39-47 #dfbce5,#314738, 48-64 #becfc4,#314738, 65-65 #becfc4,#608269, 66-69 #becfc4,#0d1410, 70-71 #59675c,#0d1410, 72-129 #e5eee5,#0d1410, -|15: 0-3 d,#314738, 4-64 #becfc4,#314738, 65-65 #becfc4,#608269, 66-129 #becfc4,#0d1410, +|14: 0-1 d,#add38a, 2-37 #becfc4,#314738, 38-46 #dfbce5,#314738, 47-64 #becfc4,#314738, 65-65 #becfc4,#608269, 66-69 #becfc4,#0d1410, 70-71 #59675c,#0d1410, 72-129 #e5eee5,#0d1410, +|15: 0-1 d,#314738, 2-64 #becfc4,#314738, 65-65 #becfc4,#608269, 66-129 #becfc4,#0d1410, |16: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-64 #e5eee5,#0d1410, 65-65 #e5eee5,#608269, 66-129 #e5eee5,#0d1410, |17: 0-0 d,#608269, 1-64 d,#0d1410, 65-65 d,#608269, 66-129 d,#0d1410, |18: 0-0 d,#608269, 1-64 d,#0d1410, 65-65 d,#608269, 66-129 d,#0d1410, diff --git a/test/snapshots/lookrange.golden b/test/snapshots/lookrange.golden index f57ee457..4a286faa 100644 --- a/test/snapshots/lookrange.golden +++ b/test/snapshots/lookrange.golden @@ -1,13 +1,13 @@ == snap opened grid=150x31 cursor=7,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/lookrange/cwd/look.txt Save Tty Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/lookrange/cwd/look.txt Save Tty Collapse Del | 1 r.txt:3-5 | 2 r.txt:7:4-9 | 3 r.txt:3:2-5:3 | 4 r.txt:8:6-99:9 == snap wholelines grid=150x31 cursor=11,12 -|7: /tmp/pardes-snap/lookrange/cwd/r.txt Save Tty Collapse Del +|7: /tmp/pardes-snap/lookrange/cwd/r.txt Save Tty Collapse Del |8: 1 aaaa |9: 2 bbbb |10: 3 cccc dccc @@ -18,14 +18,14 @@ |15: 8 hhhh NEEDLE |16: 9 iiii == style wholelines grid=150x31 -|0: 0-149 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-149 #becfc4,#314738, -|2: 0-1 d,#496656, 2-2 d,#1d2824, 3-33 #b2c3b8,#1d2824, 34-42 #d3b0d9,#1d2824, 43-149 #b2c3b8,#1d2824, +|0: 0-1 d,#1d2824, 2-149 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-149 #becfc4,#314738, +|2: 0-1 d,#496656, 2-32 #b2c3b8,#1d2824, 33-41 #d3b0d9,#1d2824, 42-149 #b2c3b8,#1d2824, |3: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-149 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-149 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-149 #e5eee5,#0d1410, |6: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-149 #e5eee5,#0d1410, -|7: 0-1 d,#add38a, 2-2 d,#314738, 3-33 #becfc4,#314738, 34-39 #dfbce5,#314738, 40-149 #becfc4,#314738, +|7: 0-1 d,#add38a, 2-32 #becfc4,#314738, 33-38 #dfbce5,#314738, 39-149 #becfc4,#314738, |8: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-149 #e5eee5,#0d1410, |9: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-149 #e5eee5,#0d1410, |10: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-149 #f5f7ee,#3c614a, @@ -69,7 +69,7 @@ |15: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-11 #e5eee5,#0d1410, 12-149 #f5f7ee,#3c614a, |16: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-10 #f5f7ee,#3c614a, 11-149 #f5f7ee,#0d1410, == snap hit1 grid=150x31 cursor=15,14 -|17: /tmp/pardes-snap/lookrange/cwd/+Search Save Tty Collapse Del LocationsConfig +|17: /tmp/pardes-snap/lookrange/cwd/+Search Save Tty Collapse LocationsConfig Del |18: 1 r.txt:7:4-9 |19: 2 gg NEEDLE gg |20: 3 r.txt:8:6-11 @@ -79,7 +79,7 @@ |14: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-9 #e5eee5,#0d1410, 10-15 #f5f7ee,#3c614a, 16-16 #f5f7ee,#0d1410, 17-149 #e5eee5,#0d1410, |15: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-149 #e5eee5,#0d1410, |16: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-149 #e5eee5,#0d1410, -|17: 0-1 d,#496656, 2-2 d,#1d2824, 3-33 #b2c3b8,#1d2824, 34-41 #d3b0d9,#1d2824, 42-149 #b2c3b8,#1d2824, +|17: 0-1 d,#496656, 2-32 #b2c3b8,#1d2824, 33-40 #d3b0d9,#1d2824, 41-149 #b2c3b8,#1d2824, |18: 0-0 d,#608269, 1-4 d,#0d1410, 5-149 #59675c,#0d1410, |19: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-9 #e5eee5,#0d1410, 10-15 #f7e4a5,#5e4923, 16-16 #f7e4a5,#0d1410, 17-149 #e5eee5,#0d1410, |20: 0-0 d,#608269, 1-4 d,#0d1410, 5-149 #59675c,#0d1410, diff --git a/test/snapshots/lsp-client-edit.golden b/test/snapshots/lsp-client-edit.golden index c9d93379..b4a16b22 100644 --- a/test/snapshots/lsp-client-edit.golden +++ b/test/snapshots/lsp-client-edit.golden @@ -1,7 +1,7 @@ == snap formatted grid=100x25 cursor=7,4 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| * /tmp/pardes-snap/lsp-client-edit/cwd/main.rs Save Tty Collapse Del TreeContext Def Refs +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| */tmp/pardes-snap/lsp-client-edit/cwd/main.rs Save Tty Collapse TreeContext Def Refs Del | 1 // formatted by mock formatted 1 range(s) | 2 mod lib; | 3 @@ -12,7 +12,7 @@ | 8 } | 9 == snap unformatted grid=100x25 cursor=7,3 -|2: /tmp/pardes-snap/lsp-client-edit/cwd/main.rs Save Tty Collapse Del TreeContext Def Refs +|2: /tmp/pardes-snap/lsp-client-edit/cwd/main.rs Save Tty Collapse TreeContext Def Refs Del |3: 1 mod lib; |4: 2 |5: 3 fn main() { @@ -23,12 +23,12 @@ |10: 8 |11: == snap renamed grid=100x25 cursor=12,5 -|2: * /tmp/pardes-snap/lsp-client-edit/cwd/main.rs Save Tty Collapse Del TreeContext Def Refs +|2: */tmp/pardes-snap/lsp-client-edit/cwd/main.rs Save Tty Collapse TreeContext Def Refs Del |3: 1 mod lib; renamed 2 range(s) |6: 4 let x = sum(1, 2); |7: 5 let y = sum(3, 4); == snap unrenamed grid=100x25 cursor=12,5 -|2: /tmp/pardes-snap/lsp-client-edit/cwd/main.rs Save Tty Collapse Del TreeContext Def Refs +|2: /tmp/pardes-snap/lsp-client-edit/cwd/main.rs Save Tty Collapse TreeContext Def Refs Del |3: 1 mod lib; |6: 4 let x = add(1, 2); |7: 5 let y = add(3, 4); diff --git a/test/snapshots/lsp-client.golden b/test/snapshots/lsp-client.golden index 13771394..c9fad7b7 100644 --- a/test/snapshots/lsp-client.golden +++ b/test/snapshots/lsp-client.golden @@ -1,7 +1,7 @@ == snap gd-jumped grid=100x25 cursor=16,12 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/lsp-client/cwd/main.rs Save Tty Collapse Del TreeContext Def Refs +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/lsp-client/cwd/main.rs Save Tty Collapse TreeContext Def Refs Del | 1 mod lib; --:--:-- lsp rust-analyzer: ready | 2 | 3 fn main() { @@ -9,7 +9,7 @@ | 5 let y = add(3, 4); | 6 let _ = x + y; | 7 } -| /tmp/pardes-snap/lsp-client/cwd/lib.rs Save Tty Collapse Del TreeContext Def Refs +| /tmp/pardes-snap/lsp-client/cwd/lib.rs Save Tty Collapse TreeContext Def Refs Del | 1 // mock fixture | 2 pub fn add(a: i32, b: i32) -> i32 { | 3 a + b @@ -17,7 +17,7 @@ | 5 == snap gr-list grid=100x25 cursor=21,6 |3: 1 mod lib; -|15: /tmp/pardes-snap/lsp-client/cwd/+Search Save Tty Collapse Del LocationsConfig +|15: /tmp/pardes-snap/lsp-client/cwd/+Search Save Tty Collapse LocationsConfig Del |16: 1 lib.rs:2:8-10 |17: 2 pub fn add(a: i32, b: i32) -> i32 { |18: 3 main.rs:4:13-15 diff --git a/test/snapshots/lsp-rename-files.golden b/test/snapshots/lsp-rename-files.golden index 4f71424e..1d239d34 100644 --- a/test/snapshots/lsp-rename-files.golden +++ b/test/snapshots/lsp-rename-files.golden @@ -1,12 +1,12 @@ == snap opened grid=100x25 cursor=7,8 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/lsp-rename-files/cwd/lib.rs Save Tty Collapse Del TreeContext Def Refs +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/lsp-rename-files/cwd/lib.rs Save Tty Collapse TreeContext Def Refs Del | 1 // main.rs | 2 pub fn add(a: i32, b: i32) -> i32 { | 3 a + b | 4 } -| /tmp/pardes-snap/lsp-rename-files/cwd/main.rs Save Tty Collapse Del TreeContext Def Refs +| /tmp/pardes-snap/lsp-rename-files/cwd/main.rs Save Tty Collapse TreeContext Def Refs Del | 1 mod lib; | 2 | 3 fn main() { @@ -17,7 +17,7 @@ | 8 == snap previewed grid=100x25 cursor=14,4 |3: 1 // main.rs Rename: 3 edit(s) across files, previewed, not applied -|15: /tmp/pardes-snap/lsp-rename-files/cwd/+Search Save Tty Collapse Del LocationsConfig +|15: /tmp/pardes-snap/lsp-rename-files/cwd/+Search Save Tty Collapse LocationsConfig Del |16: 1 lib.rs:2:8-10 |17: 2 sum |18: 3 main.rs:4:13-15 diff --git a/test/snapshots/lsp-rename.golden b/test/snapshots/lsp-rename.golden index 6b85822c..f5dc718d 100644 --- a/test/snapshots/lsp-rename.golden +++ b/test/snapshots/lsp-rename.golden @@ -1,7 +1,7 @@ == snap renamed grid=110x25 cursor=17,10 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| * /tmp/pardes-snap/lsp-rename/cwd/rename.zig Save Tty Collapse Del TreeContext Def Refs +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| */tmp/pardes-snap/lsp-rename/cwd/rename.zig Save Tty Collapse TreeContext Def Refs Del | 1 const std = @import("std"); renamed 2 range(s) | 2 | 3 fn renamed_helper(x: u32) u32 { @@ -18,11 +18,11 @@ | 14 } | 15 == snap undone grid=110x25 cursor=17,10 -|2: /tmp/pardes-snap/lsp-rename/cwd/rename.zig Save Tty Collapse Del TreeContext Def Refs +|2: /tmp/pardes-snap/lsp-rename/cwd/rename.zig Save Tty Collapse TreeContext Def Refs Del |3: 1 const std = @import("std"); |5: 3 fn helper(x: u32) u32 { |10: 8 _ = helper(41); == snap redone grid=110x25 cursor=17,10 -|2: * /tmp/pardes-snap/lsp-rename/cwd/rename.zig Save Tty Collapse Del TreeContext Def Refs +|2: */tmp/pardes-snap/lsp-rename/cwd/rename.zig Save Tty Collapse TreeContext Def Refs Del |5: 3 fn renamed_helper(x: u32) u32 { |10: 8 _ = renamed_helper(41); diff --git a/test/snapshots/lsp.golden b/test/snapshots/lsp.golden index 2225de00..de52523c 100644 --- a/test/snapshots/lsp.golden +++ b/test/snapshots/lsp.golden @@ -1,7 +1,7 @@ == snap opened grid=120x41 cursor=7,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/lsp/cwd/a.zig Save Tty Collapse Del TreeContext Def Refs +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/lsp/cwd/a.zig Save Tty Collapse TreeContext Def Refs Del | 1 const std = @import("std"); | 2 | 3 fn helper(x: u32) u32 { @@ -17,13 +17,13 @@ |3: 1 const std = @import("std"); --:--:-- lsp zls ready — /tmp/pardes-snap/lsp/cwd == snap hover grid=120x41 cursor=15,5 |3: 1 const std = @import("std"); Hover -|12: /tmp/pardes-snap/lsp/cwd/+Hover Save Tty Collapse Del +|12: /tmp/pardes-snap/lsp/cwd/+Hover Save Tty Collapse Del |13: 1 fn helper(x: u32) u32 |14: 2 (fn (u32) u32) |15: 3 == snap symbols grid=120x41 cursor=15,5 |3: 1 const std = @import("std"); Symbols -|15: /tmp/pardes-snap/lsp/cwd/+Search Save Tty Collapse Del LocationsConfig +|15: /tmp/pardes-snap/lsp/cwd/+Search Save Tty Collapse LocationsConfig Del |16: 1 a.zig:1:7-9 |17: 2 std |18: 3 a.zig:3:4-9 diff --git a/test/snapshots/lspcomplete.golden b/test/snapshots/lspcomplete.golden index 85c26e30..dd1e5c7e 100644 --- a/test/snapshots/lspcomplete.golden +++ b/test/snapshots/lspcomplete.golden @@ -1,7 +1,7 @@ == snap opened grid=120x41 cursor=7,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/lspcomplete/cwd/a.zig Save Tty Collapse Del TreeContext Def Refs +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/lspcomplete/cwd/a.zig Save Tty Collapse TreeContext Def Refs Del | 1 const Shade = enum { | 2 verdigris, | 3 cinnabar, @@ -16,7 +16,7 @@ | 12 // note. see below | 13 == snap indent grid=120x41 cursor=11,12 -|2: ^* /tmp/pardes-snap/lspcomplete/cwd/a.zig Save Tty Collapse Del TreeContext Def Refs +|2: ^*/tmp/pardes-snap/lspcomplete/cwd/a.zig Save Tty Collapse TreeContext Def Refs Del |12: 10 } == snap commentindent grid=120x41 cursor=19,14 |3: 1 const Shade = enum { --:--:-- lsp zls ready — /tmp/pardes-snap/lspcomplete/cwd @@ -25,23 +25,23 @@ |3: 1 const Shade = enum { |10: 8 . == snap completion grid=120x41 cursor=16,10 -|15: /tmp/pardes-snap/lspcomplete/cwd/+Search Save Tty Collapse Del +|15: /tmp/pardes-snap/lspcomplete/cwd/+Search Save Tty Collapse Del |16: 1 a.zig:8:10 verdigris |17: 2 a.zig:8:10 cinnabar |18: 3 == snap refill grid=120x41 cursor=16,10 == snap step grid=120x41 cursor=16,10 -|2: * /tmp/pardes-snap/lspcomplete/cwd/a.zig Save Tty Collapse Del TreeContext Def Refs +|2: */tmp/pardes-snap/lspcomplete/cwd/a.zig Save Tty Collapse TreeContext Def Refs Del == snap txtindent grid=120x41 cursor=15,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -|^* /tmp/pardes-snap/lspcomplete/cwd/notes.txt Save Tty Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +|^*/tmp/pardes-snap/lspcomplete/cwd/notes.txt Save Tty Collapse Del | 1 abc. def ghi | 2 == snap nosemi grid=100x19 cursor=29,9 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -|^* /tmp/pardes-snap/lspcomplete/cwd/c.zig Save Tty Collapse Del TreeContext Def Refs +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +|^*/tmp/pardes-snap/lspcomplete/cwd/c.zig Save Tty Collapse TreeContext Def Refs Del | 1 const Shade = enum { --:--:-- lsp zls ready — /tmp/pardes-snap/lspcomplete/cwd | 2 verdigris, | 3 cinnabar, @@ -50,14 +50,14 @@ | 6 pub fn nosemi() void { | 7 const z: Shade = . | 8 } -| /tmp/pardes-snap/lspcomplete/cwd/+Search Save Tty Collapse Del +| /tmp/pardes-snap/lspcomplete/cwd/+Search Save Tty Collapse Del | 1 c.zig:7:23 verdigris Shade | 2 c.zig:7:23 cinnabar Shade | 3 == snap nobrace grid=100x19 cursor=16,10 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -|^* /tmp/pardes-snap/lspcomplete/cwd/d.zig Save Tty Collapse Del TreeContext Def Refs +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +|^*/tmp/pardes-snap/lspcomplete/cwd/d.zig Save Tty Collapse TreeContext Def Refs Del | 1 const Shade = enum { --:--:-- lsp zls ready — /tmp/pardes-snap/lspcomplete/cwd | 2 verdigris, | 3 cinnabar, @@ -65,7 +65,7 @@ | 5 | 6 pub fn nobrace(s: Shade) void { | 7 switch (s) { -| /tmp/pardes-snap/lspcomplete/cwd/+Search Save Tty Collapse Del +| /tmp/pardes-snap/lspcomplete/cwd/+Search Save Tty Collapse Del | 1 d.zig:8:10 verdigris | 2 d.zig:8:10 cinnabar | 3 diff --git a/test/snapshots/lspcompletemoved.golden b/test/snapshots/lspcompletemoved.golden index 403c6931..7b3ed250 100644 --- a/test/snapshots/lspcompletemoved.golden +++ b/test/snapshots/lspcompletemoved.golden @@ -1,7 +1,7 @@ == snap typedthrough grid=120x21 cursor=16,14 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -|^* /tmp/pardes-snap/lspcompletemoved/cwd/a.zig Save Tty Collapse Del TreeContext Def Refs +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +|^*/tmp/pardes-snap/lspcompletemoved/cwd/a.zig Save Tty Collapse TreeContext Def Refs Del | 1 const Shade = enum { --:--:-- lsp zls ready — /tmp/pardes-snap/lspcompletemoved/cwd | 2 verdigris, | 3 cinnabar, diff --git a/test/snapshots/lspdebug.golden b/test/snapshots/lspdebug.golden index 4beda019..5c415033 100644 --- a/test/snapshots/lspdebug.golden +++ b/test/snapshots/lspdebug.golden @@ -1,7 +1,7 @@ == snap opened grid=120x45 cursor=7,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/lspdebug/cwd/z.zig Save Tty Collapse Del TreeContext Def Refs +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/lspdebug/cwd/z.zig Save Tty Collapse TreeContext Def Refs Del | 1 const std = @import("std"); | 2 | 3 fn helper() u32 { diff --git a/test/snapshots/lsprelpath.golden b/test/snapshots/lsprelpath.golden index a3760316..d961d6bd 100644 --- a/test/snapshots/lsprelpath.golden +++ b/test/snapshots/lsprelpath.golden @@ -1,7 +1,7 @@ == snap absrow grid=100x35 cursor=21,16 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/lsprelpath/cwd/sub/parent.zig Save Tty Collapse Del TreeContext Def Refs +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/lsprelpath/cwd/sub/parent.zig Save Tty Collapse TreeContext Def Refs Del | 1 const shade = @import("../shad --:--:-- lsp zls ready — /tmp/pardes-snap/lsprelpath/cwd/sub | 2 | 3 pub fn pick(s: shade.Shade) u8 { @@ -9,12 +9,12 @@ | 5 | 6 }; | 7 } -| /tmp/pardes-snap/lsprelpath/cwd/sub/+Search Save Tty Collapse Del LocationsConfig +| /tmp/pardes-snap/lsprelpath/cwd/sub/+Search Save Tty Collapse LocationsConfig Del | 1 /tmp/pardes-snap/lsprelpath/cwd/shade.zig:1:11-15 | 2 pub const Shade = enum { | 3 parent.zig:3:22-26 | 4 pub fn pick(s: shade.Shade) u8 { -| /tmp/pardes-snap/lsprelpath/cwd/shade.zig Save Tty Collapse Del TreeContext Def Refs +| /tmp/pardes-snap/lsprelpath/cwd/shade.zig Save Tty Collapse TreeContext Def Refs Del | 1 pub const Shade = enum { | 2 verdigris, | 3 cinnabar, @@ -23,9 +23,9 @@ == snap abslook grid=100x35 cursor=32,5 |3: 1 const shade = @import("../shade.zig"); == style abslook grid=100x35 -|0: 0-99 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-99 #becfc4,#314738, -|2: 0-1 d,#add38a, 2-2 d,#314738, 3-38 #becfc4,#314738, 39-49 #dfbce5,#314738, 50-99 #becfc4,#314738, +|0: 0-1 d,#1d2824, 2-99 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-99 #becfc4,#314738, +|2: 0-1 d,#add38a, 2-37 #becfc4,#314738, 38-48 #dfbce5,#314738, 49-99 #becfc4,#314738, |3: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-20 #e5eee5,#0d1410, 21-27 #c9a7ed,#0d1410, 28-28 #e5eee5,#0d1410, 29-42 #b8d88a,#0d1410, 43-99 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-4 d,#0d1410, 5-99 #59675c,#0d1410, |5: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-10 #e5eee5,#0d1410, 11-13 #c9a7ed,#0d1410, 14-27 #e5eee5,#0d1410, 28-32 #f5f7ee,#3c614a, 33-99 #e5eee5,#0d1410, @@ -33,12 +33,12 @@ |7: 0-0 d,#608269, 1-4 d,#0d1410, 5-99 #59675c,#0d1410, |8: 0-0 d,#608269, 1-4 d,#0d1410, 5-10 #59675c,#0d1410, 11-99 #e5eee5,#0d1410, |9: 0-0 d,#152019, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-99 #e5eee5,#0d1410, -|10: 0-1 d,#496656, 2-2 d,#1d2824, 3-38 #b2c3b8,#1d2824, 39-46 #d3b0d9,#1d2824, 47-99 #b2c3b8,#1d2824, +|10: 0-1 d,#496656, 2-37 #b2c3b8,#1d2824, 38-45 #d3b0d9,#1d2824, 46-99 #b2c3b8,#1d2824, |11: 0-0 d,#608269, 1-4 d,#0d1410, 5-99 #59675c,#0d1410, |12: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-16 #e5eee5,#0d1410, 17-21 #f7e4a5,#5e4923, 22-22 #f7e4a5,#0d1410, 23-24 #e5eee5,#0d1410, 25-29 #c9a7ed,#0d1410, 30-99 #e5eee5,#0d1410, |13: 0-0 d,#608269, 1-4 d,#0d1410, 5-99 #59675c,#0d1410, |14: 0-0 d,#152019, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-13 #c9a7ed,#0d1410, 14-27 #e5eee5,#0d1410, 28-32 #f7e4a5,#5e4923, 33-99 #e5eee5,#0d1410, -|15: 0-1 d,#496656, 2-2 d,#1d2824, 3-34 #b2c3b8,#1d2824, 35-44 #d3b0d9,#1d2824, 45-99 #b2c3b8,#1d2824, +|15: 0-1 d,#496656, 2-33 #b2c3b8,#1d2824, 34-43 #d3b0d9,#1d2824, 44-99 #b2c3b8,#1d2824, |16: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-16 #e5eee5,#0d1410, 17-21 #f5f7ee,#3c614a, 22-22 #f5f7ee,#0d1410, 23-24 #e5eee5,#0d1410, 25-29 #c9a7ed,#0d1410, 30-99 #e5eee5,#0d1410, |17: 0-0 d,#608269, 1-4 d,#0d1410, 5-10 #59675c,#0d1410, 11-99 #e5eee5,#0d1410, |18: 0-0 d,#608269, 1-4 d,#0d1410, 5-10 #59675c,#0d1410, 11-99 #e5eee5,#0d1410, @@ -59,9 +59,9 @@ |33: 0-0 d,#608269, 1-99 d,#0d1410, |34: 0-0 d,#608269, 1-99 d,#0d1410, == snap subrow grid=100x35 cursor=20,16 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/lsprelpath/cwd/sub/subdir.zig Save Tty Collapse Del TreeContext Def Refs +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/lsprelpath/cwd/sub/subdir.zig Save Tty Collapse TreeContext Def Refs Del | 1 const tint = @import("inner/ti --:--:-- lsp zls ready — /tmp/pardes-snap/lsprelpath/cwd/sub | 2 | 3 pub fn hue(t: tint.Tint) u8 { @@ -69,12 +69,12 @@ | 5 | 6 }; | 7 } -| /tmp/pardes-snap/lsprelpath/cwd/sub/+Search Save Tty Collapse Del LocationsConfig +| /tmp/pardes-snap/lsprelpath/cwd/sub/+Search Save Tty Collapse LocationsConfig Del | 1 inner/tint.zig:1:11-14 | 2 pub const Tint = enum { | 3 subdir.zig:3:20-23 | 4 pub fn hue(t: tint.Tint) u8 { -| /tmp/pardes-snap/lsprelpath/cwd/sub/inner/tint.zig Save Tty Collapse Del TreeContext Def Refs +| /tmp/pardes-snap/lsprelpath/cwd/sub/inner/tint.zig Save Tty Collapse TreeContext Def Refs Del | 1 pub const Tint = enum { | 2 ochre, | 3 indigo, @@ -83,9 +83,9 @@ == snap sublook grid=100x35 cursor=29,5 |3: 1 const tint = @import("inner/tint.zig"); == style sublook grid=100x35 -|0: 0-99 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-99 #becfc4,#314738, -|2: 0-1 d,#add38a, 2-2 d,#314738, 3-38 #becfc4,#314738, 39-49 #dfbce5,#314738, 50-99 #becfc4,#314738, +|0: 0-1 d,#1d2824, 2-99 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-99 #becfc4,#314738, +|2: 0-1 d,#add38a, 2-37 #becfc4,#314738, 38-48 #dfbce5,#314738, 49-99 #becfc4,#314738, |3: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-19 #e5eee5,#0d1410, 20-26 #c9a7ed,#0d1410, 27-27 #e5eee5,#0d1410, 28-43 #b8d88a,#0d1410, 44-99 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-4 d,#0d1410, 5-99 #59675c,#0d1410, |5: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-10 #e5eee5,#0d1410, 11-13 #c9a7ed,#0d1410, 14-25 #e5eee5,#0d1410, 26-29 #f5f7ee,#3c614a, 30-99 #e5eee5,#0d1410, @@ -93,12 +93,12 @@ |7: 0-0 d,#608269, 1-4 d,#0d1410, 5-99 #59675c,#0d1410, |8: 0-0 d,#608269, 1-4 d,#0d1410, 5-10 #59675c,#0d1410, 11-99 #e5eee5,#0d1410, |9: 0-0 d,#152019, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-99 #e5eee5,#0d1410, -|10: 0-1 d,#496656, 2-2 d,#1d2824, 3-38 #b2c3b8,#1d2824, 39-46 #d3b0d9,#1d2824, 47-99 #b2c3b8,#1d2824, +|10: 0-1 d,#496656, 2-37 #b2c3b8,#1d2824, 38-45 #d3b0d9,#1d2824, 46-99 #b2c3b8,#1d2824, |11: 0-0 d,#608269, 1-4 d,#0d1410, 5-99 #59675c,#0d1410, |12: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-16 #e5eee5,#0d1410, 17-20 #f7e4a5,#5e4923, 21-21 #f7e4a5,#0d1410, 22-23 #e5eee5,#0d1410, 24-28 #c9a7ed,#0d1410, 29-99 #e5eee5,#0d1410, |13: 0-0 d,#608269, 1-4 d,#0d1410, 5-99 #59675c,#0d1410, |14: 0-0 d,#152019, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-13 #c9a7ed,#0d1410, 14-25 #e5eee5,#0d1410, 26-29 #f7e4a5,#5e4923, 30-99 #e5eee5,#0d1410, -|15: 0-1 d,#496656, 2-2 d,#1d2824, 3-44 #b2c3b8,#1d2824, 45-53 #d3b0d9,#1d2824, 54-99 #b2c3b8,#1d2824, +|15: 0-1 d,#496656, 2-43 #b2c3b8,#1d2824, 44-52 #d3b0d9,#1d2824, 53-99 #b2c3b8,#1d2824, |16: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-16 #e5eee5,#0d1410, 17-20 #f5f7ee,#3c614a, 21-21 #f5f7ee,#0d1410, 22-23 #e5eee5,#0d1410, 24-28 #c9a7ed,#0d1410, 29-99 #e5eee5,#0d1410, |17: 0-0 d,#608269, 1-4 d,#0d1410, 5-10 #59675c,#0d1410, 11-99 #e5eee5,#0d1410, |18: 0-0 d,#608269, 1-4 d,#0d1410, 5-10 #59675c,#0d1410, 11-99 #e5eee5,#0d1410, diff --git a/test/snapshots/markup.golden b/test/snapshots/markup.golden index 6991cdf6..0d086770 100644 --- a/test/snapshots/markup.golden +++ b/test/snapshots/markup.golden @@ -1,7 +1,7 @@ == snap typst grid=92x25 cursor=7,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/markup/cwd/paper.typ Save Tty Collapse Del TreeContext +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/markup/cwd/paper.typ Save Tty Collapse TreeContext Del | 1 = Typst heading | 2 | 3 Prose with *bold* and _italic_ words, a `raw` span, @@ -12,9 +12,9 @@ | 8 ``` | 9 == style typst grid=92x25 -|0: 0-91 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-91 #becfc4,#314738, -|2: 0-1 d,#add38a, 2-2 d,#314738, 3-30 #becfc4,#314738, 31-40 #dfbce5,#314738, 41-91 #becfc4,#314738, +|0: 0-1 d,#1d2824, 2-91 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-91 #becfc4,#314738, +|2: 0-1 d,#add38a, 2-29 #becfc4,#314738, 30-39 #dfbce5,#314738, 40-91 #becfc4,#314738, |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-91 #c9a7ed,#0d1410, |4: 0-0 d,#608269, 1-4 d,#0d1410, 5-91 #59675c,#0d1410, |5: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-17 #e5eee5,#0d1410, 18-24 #b9f480,#0d1410, 25-28 #e5eee5,#0d1410, 29-37 #f8c082,#0d1410, 38-46 #e5eee5,#0d1410, 47-52 #b8d88a,#0d1410, 53-91 #e5eee5,#0d1410, @@ -38,9 +38,9 @@ |23: 0-0 d,#608269, 1-91 d,#0d1410, |24: 0-0 d,#608269, 1-91 d,#0d1410, == snap markdown grid=92x25 cursor=7,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/markup/cwd/notes.md Save Tty Collapse Del TreeContext +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/markup/cwd/notes.md Save Tty Collapse TreeContext Del | 1 # Markdown heading with *italic* | 2 | 3 Prose with **bold**, *italic* and an `inline` span. @@ -50,9 +50,9 @@ | 7 ``` | 8 == style markdown grid=92x25 -|0: 0-91 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-91 #becfc4,#314738, -|2: 0-1 d,#add38a, 2-2 d,#314738, 3-30 #becfc4,#314738, 31-39 #dfbce5,#314738, 40-91 #becfc4,#314738, +|0: 0-1 d,#1d2824, 2-91 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-91 #becfc4,#314738, +|2: 0-1 d,#add38a, 2-29 #becfc4,#314738, 30-38 #dfbce5,#314738, 39-91 #becfc4,#314738, |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-8 #e5eee5,#0d1410, 9-30 #c9a7ed,#0d1410, 31-91 #f8c082,#0d1410, |4: 0-0 d,#608269, 1-4 d,#0d1410, 5-91 #59675c,#0d1410, |5: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-17 #e5eee5,#0d1410, 18-25 #b9f480,#0d1410, 26-27 #e5eee5,#0d1410, 28-36 #f8c082,#0d1410, 37-43 #e5eee5,#0d1410, 44-52 #b8d88a,#0d1410, 53-91 #e5eee5,#0d1410, diff --git a/test/snapshots/mini.golden b/test/snapshots/mini.golden index 8d0205f7..cba3c6d0 100644 --- a/test/snapshots/mini.golden +++ b/test/snapshots/mini.golden @@ -1,21 +1,21 @@ == snap opened grid=90x23 cursor=7,6 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/mini/cwd/commands.txt Save Tty Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/mini/cwd/commands.txt Save Tty Collapse Del | 1 @`Mini demo.zig` Mini | -| /tmp/pardes-snap/mini/cwd/Mini demo.zig Save Tty Collapse Del +| /tmp/pardes-snap/mini/cwd/Mini demo.zig Save Tty Collapse Del | 1 ⠭⠍⣥⢩⣭⡭⣭⣬⣌⢭⣭⠌⠬⠅⠍⠁ | 2 ⣂⢀⣉⣉⢉⣈⢁⣀⣀⢀⣀⣀⣀⢀⣀⣀⣀⣀⣀ | 3 ⠉⠉⠁⠉⠉⠉⠈⠈⠉⠉⠉⠉⠉⠉ | 4 == style opened grid=90x23 -|0: 0-89 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-89 #becfc4,#314738, -|2: 0-1 d,#496656, 2-2 d,#1d2824, 3-28 #b2c3b8,#1d2824, 29-41 #d3b0d9,#1d2824, 42-89 #b2c3b8,#1d2824, +|0: 0-1 d,#1d2824, 2-89 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-89 #becfc4,#314738, +|2: 0-1 d,#496656, 2-27 #b2c3b8,#1d2824, 28-40 #d3b0d9,#1d2824, 41-89 #b2c3b8,#1d2824, |3: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-83 #e5eee5,#0d1410, 84-84 #e5eee5,#1d2824, 85-89 #b2c3b8,#1d2824, |4: 0-0 d,#608269, 1-89 d,#0d1410, -|5: 0-1 d,#add38a, 2-2 d,#314738, 3-28 #becfc4,#314738, 29-42 #dfbce5,#314738, 43-89 #becfc4,#314738, +|5: 0-1 d,#add38a, 2-27 #becfc4,#314738, 28-41 #dfbce5,#314738, 42-89 #becfc4,#314738, |6: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-8 #e5eee5,#0d1410, 9-9 #c9a7ed,#0d1410, 10-12 #e5eee5,#0d1410, 13-15 #c9a7ed,#0d1410, 16-21 #b8d88a,#0d1410, 22-89 #e5eee5,#0d1410, |7: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-8 #b9f480,#0d1410, 9-11 #c9a7ed,#0d1410, 12-89 #b9f480,#0d1410, |8: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-17 #e5eee5,#0d1410, 18-19 #f8c082,#0d1410, 20-89 #e5eee5,#0d1410, @@ -34,18 +34,18 @@ |21: 0-0 d,#608269, 1-89 d,#0d1410, |22: 0-0 d,#608269, 1-89 d,#0d1410, == 9p opened grid=90x23 cursor=7,6,block -|0: Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -@0: 0-74 #b2c3b8,#1d2824,,tagline 75-89 d,#1d2824,,tagline -|1: New Tty Find Grep Joincol Delcol -@1: 0-1 #ffffff,#887455,,tagline 2-2 d,#314738,,tagline 3-34 #becfc4,#314738,,tagline 35-89 d,#314738,,tagline -|2: /tmp/pardes-snap/mini/cwd/commands.txt Save Tty Collapse Del -@2: 0-1 #ffffff,#496656,,tagline 2-2 d,#1d2824,,tagline 3-28 #b2c3b8,#1d2824,,tagline 29-40 #d3b0d9,#1d2824,,tagline 41-62 #b2c3b8,#1d2824,,tagline 63-89 d,#1d2824,,tagline +|0: Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +@0: 0-76 #b2c3b8,#1d2824,,tagline 77-89 d,#1d2824,,tagline +|1: New Tty Find Grep Joincol Delcol +@1: 0-1 #ffffff,#887455,,tagline 2-33 #becfc4,#314738,,tagline 34-89 d,#314738,,tagline +|2: /tmp/pardes-snap/mini/cwd/commands.txt Save Tty Collapse Del +@2: 0-1 #ffffff,#496656,,tagline 2-27 #b2c3b8,#1d2824,,tagline 28-39 #d3b0d9,#1d2824,,tagline 40-61 #b2c3b8,#1d2824,,tagline 62-89 d,#1d2824,,tagline |3: 1 @`Mini demo.zig` Mini @3: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-22 #e5eee5,#0d1410,,body 23-83 d,#0d1410,,body 84-84 d,#1d2824,,tagline 85-88 #b2c3b8,#1d2824,,tagline 89-89 d,#1d2824,,tagline |4: @4: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body -|5: /tmp/pardes-snap/mini/cwd/Mini demo.zig Save Tty Collapse Del -@5: 0-1 #000000,#add38a,,tagline 2-2 d,#314738,,tagline 3-28 #becfc4,#314738,,tagline 29-41 #dfbce5,#314738,,tagline 42-63 #becfc4,#314738,,tagline 64-89 d,#314738,,tagline +|5: /tmp/pardes-snap/mini/cwd/Mini demo.zig Save Tty Collapse Del +@5: 0-1 #000000,#add38a,,tagline 2-27 #becfc4,#314738,,tagline 28-40 #dfbce5,#314738,,tagline 41-62 #becfc4,#314738,,tagline 63-89 d,#314738,,tagline |6: 1 ⠭⠍⣥⢩⣭⡭⣭⣬⣌⢭⣭⠌⠬⠅⠍⠁ +6: 7="⠭" 8="⠍" 9="⣥" 10="⢩" 11="⣭" 12="⡭" 13="⣭" 14="⣬" 15="⣌" 16="⢭" 17="⣭" 18="⠌" 19="⠬" 20="⠅" 21="⠍" 22="⠁" @6: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-8 #e5eee5,#0d1410,,body 9-9 #c9a7ed,#0d1410,,body 10-12 #e5eee5,#0d1410,,body 13-15 #c9a7ed,#0d1410,,body 16-21 #b8d88a,#0d1410,,body 22-22 #e5eee5,#0d1410,,body 23-89 d,#0d1410,,body @@ -105,32 +105,32 @@ |7: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-8 #b9f480,#0d1410, 9-11 #c9a7ed,#0d1410, 12-89 #b9f480,#0d1410, |8: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-17 #e5eee5,#0d1410, 18-19 #f8c082,#0d1410, 20-89 #e5eee5,#0d1410, == snap resized grid=105x27 cursor=7,7 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/mini/cwd/commands.txt Save Tty Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/mini/cwd/commands.txt Save Tty Collapse Del | 1 @`Mini demo.zig` | | -| /tmp/pardes-snap/mini/cwd/Mini demo.zig Save Tty Collapse Del +| /tmp/pardes-snap/mini/cwd/Mini demo.zig Save Tty Collapse Del | 1 ⠭⠍⣥⢩⣭⡭⣭⣬⣌⢭⣭⠌⠬⠅⠍⠁ Colors | 2 ⣂⢀⣉⣉⢉⣈⢁⣀⣀⢀⣀⣀⣀⢀⣀⣀⣀⣀⣀ | 3 ⠉⠉⠁⠉⠉⠉⠈⠈⠉⠉⠉⠉⠉⠉ | 4 == 9p resized grid=105x27 cursor=7,7,block -|0: Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -@0: 0-74 #b2c3b8,#1d2824,,tagline 75-104 d,#1d2824,,tagline -|1: New Tty Find Grep Joincol Delcol -@1: 0-1 #ffffff,#887455,,tagline 2-2 d,#314738,,tagline 3-34 #becfc4,#314738,,tagline 35-104 d,#314738,,tagline -|2: /tmp/pardes-snap/mini/cwd/commands.txt Save Tty Collapse Del -@2: 0-1 #ffffff,#496656,,tagline 2-2 d,#1d2824,,tagline 3-28 #b2c3b8,#1d2824,,tagline 29-40 #d3b0d9,#1d2824,,tagline 41-62 #b2c3b8,#1d2824,,tagline 63-104 d,#1d2824,,tagline +|0: Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +@0: 0-76 #b2c3b8,#1d2824,,tagline 77-104 d,#1d2824,,tagline +|1: New Tty Find Grep Joincol Delcol +@1: 0-1 #ffffff,#887455,,tagline 2-33 #becfc4,#314738,,tagline 34-104 d,#314738,,tagline +|2: /tmp/pardes-snap/mini/cwd/commands.txt Save Tty Collapse Del +@2: 0-1 #ffffff,#496656,,tagline 2-27 #b2c3b8,#1d2824,,tagline 28-39 #d3b0d9,#1d2824,,tagline 40-61 #b2c3b8,#1d2824,,tagline 62-104 d,#1d2824,,tagline |3: 1 @`Mini demo.zig` @3: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-22 #e5eee5,#0d1410,,body 23-104 d,#0d1410,,body |4: @4: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body |5: @5: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body -|6: /tmp/pardes-snap/mini/cwd/Mini demo.zig Save Tty Collapse Del -@6: 0-1 #000000,#add38a,,tagline 2-2 d,#314738,,tagline 3-28 #becfc4,#314738,,tagline 29-41 #dfbce5,#314738,,tagline 42-63 #becfc4,#314738,,tagline 64-104 d,#314738,,tagline +|6: /tmp/pardes-snap/mini/cwd/Mini demo.zig Save Tty Collapse Del +@6: 0-1 #000000,#add38a,,tagline 2-27 #becfc4,#314738,,tagline 28-40 #dfbce5,#314738,,tagline 41-62 #becfc4,#314738,,tagline 63-104 d,#314738,,tagline |7: 1 ⠭⠍⣥⢩⣭⡭⣭⣬⣌⢭⣭⠌⠬⠅⠍⠁ Colors +7: 7="⠭" 8="⠍" 9="⣥" 10="⢩" 11="⣭" 12="⡭" 13="⣭" 14="⣬" 15="⣌" 16="⢭" 17="⣭" 18="⠌" 19="⠬" 20="⠅" 21="⠍" 22="⠁" @7: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-8 #e5eee5,#0d1410,,body 9-9 #c9a7ed,#0d1410,,body 10-12 #e5eee5,#0d1410,,body 13-15 #c9a7ed,#0d1410,,body 16-21 #b8d88a,#0d1410,,body 22-22 #e5eee5,#0d1410,,body 23-96 d,#0d1410,,body 97-97 d,#1d2824,,tagline 98-103 #b2c3b8,#1d2824,,tagline 104-104 d,#1d2824,,tagline diff --git a/test/snapshots/modal.golden b/test/snapshots/modal.golden index 6dc6376d..9ebc72e9 100644 --- a/test/snapshots/modal.golden +++ b/test/snapshots/modal.golden @@ -1,8 +1,8 @@ == snap top grid=100x31 cursor=2,4 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/modal/cwd Tty+bash Save Mode F /tmp/pardes-snap/modal/cwd Tty+bash Save Mode F -| ilter Collapse Del ilter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/modal/cwd Tty+bash Save Mode Fi /tmp/pardes-snap/modal/cwd Tty+bash Save Mode Fi +| lter Collapse Del lter Collapse Del | ls ls | words.txt words.txt | printf 'one two three\nfour five six\nseven ei @@ -16,17 +16,17 @@ | | | -| /tmp/pardes-snap/modal/cwd Tty+bash Save Mode F -| ilter Collapse Del +| /tmp/pardes-snap/modal/cwd Tty+bash Save Mode Fi +| lter Collapse Del | ls | words.txt == snap moved grid=100x31 cursor=8,6 == snap xsel grid=100x31 cursor=48,6 == style xsel grid=100x31 -|0: 0-99 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-49 #becfc4,#314738, 50-51 #becfc4,#887455, 52-52 #becfc4,#1d2824, 53-99 #b2c3b8,#1d2824, -|2: 0-1 d,#add38a, 2-2 d,#314738, 3-29 #becfc4,#314738, 30-38 #dfbce5,#314738, 39-49 #becfc4,#314738, 50-51 #becfc4,#496656, 52-52 #becfc4,#1d2824, 53-79 #b2c3b8,#1d2824, 80-88 #d3b0d9,#1d2824, 89-99 #b2c3b8,#1d2824, -|3: 0-2 d,#314738, 3-49 #becfc4,#314738, 50-52 #becfc4,#1d2824, 53-99 #b2c3b8,#1d2824, +|0: 0-1 d,#1d2824, 2-99 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-49 #becfc4,#314738, 50-51 #becfc4,#887455, 52-99 #b2c3b8,#1d2824, +|2: 0-1 d,#add38a, 2-28 #becfc4,#314738, 29-37 #dfbce5,#314738, 38-49 #becfc4,#314738, 50-51 #becfc4,#496656, 52-78 #b2c3b8,#1d2824, 79-87 #d3b0d9,#1d2824, 88-99 #b2c3b8,#1d2824, +|3: 0-1 d,#314738, 2-49 #becfc4,#314738, 50-51 #becfc4,#1d2824, 52-99 #b2c3b8,#1d2824, |4: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, |6: 0-0 d,#608269, 1-1 d,#0d1410, 2-48 #f5f7ee,#3c614a, 49-49 #f5f7ee,#0d1410, 50-50 #f5f7ee,#608269, 51-99 #f5f7ee,#0d1410, @@ -40,8 +40,8 @@ |14: 0-0 d,#608269, 1-49 d,#0d1410, 50-50 d,#608269, 51-99 d,#0d1410, |15: 0-0 d,#608269, 1-49 d,#0d1410, 50-50 d,#608269, 51-99 d,#0d1410, |16: 0-0 d,#608269, 1-49 d,#0d1410, 50-50 d,#608269, 51-99 d,#0d1410, -|17: 0-1 d,#496656, 2-2 d,#1d2824, 3-29 #b2c3b8,#1d2824, 30-38 #d3b0d9,#1d2824, 39-49 #b2c3b8,#1d2824, 50-50 #b2c3b8,#608269, 51-99 #b2c3b8,#0d1410, -|18: 0-2 d,#1d2824, 3-49 #b2c3b8,#1d2824, 50-50 #b2c3b8,#608269, 51-99 #b2c3b8,#0d1410, +|17: 0-1 d,#496656, 2-28 #b2c3b8,#1d2824, 29-37 #d3b0d9,#1d2824, 38-49 #b2c3b8,#1d2824, 50-50 #b2c3b8,#608269, 51-99 #b2c3b8,#0d1410, +|18: 0-1 d,#1d2824, 2-49 #b2c3b8,#1d2824, 50-50 #b2c3b8,#608269, 51-99 #b2c3b8,#0d1410, |19: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, |20: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, |21: 0-0 d,#608269, 1-49 d,#0d1410, 50-50 d,#608269, 51-99 d,#0d1410, diff --git a/test/snapshots/msg.golden b/test/snapshots/msg.golden index caa234d3..24018546 100644 --- a/test/snapshots/msg.golden +++ b/test/snapshots/msg.golden @@ -1,7 +1,7 @@ == snap opened grid=70x15 cursor=7,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/msg/cwd/a.txt Save Tty Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Deb +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/msg/cwd/a.txt Save Tty Collapse Del | 1 line 1 | 2 line 2 | 3 line 3 @@ -12,9 +12,9 @@ == snap saved grid=70x15 cursor=7,3 |3: 1 line 1 --:--:-- saved /tmp/pardes-snap/msg/cwd/a.txt == snap repainted grid=70x17 cursor=7,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/msg/cwd/a.txt Save Tty Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Deb +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/msg/cwd/a.txt Save Tty Collapse Del | 1 line 1 --:--:-- saved /tmp/pardes-snap/msg/cwd/a.txt | 2 line 2 | 3 line 3 @@ -45,7 +45,7 @@ |3: 1 AGAIN |4: 2 == snap msgbuiltin grid=70x17 cursor=29,5 -|2: * /tmp/pardes-snap/msg/cwd/a.txt Save Tty Collapse Del +|2: */tmp/pardes-snap/msg/cwd/a.txt Save Tty Collapse Del |3: 1 AGAIN hand-written report |5: 3 Msg hand-written report == snap msgtail grid=70x17 cursor=32,7 diff --git a/test/snapshots/multicursor.golden b/test/snapshots/multicursor.golden index 0b3bbcb2..48ccefbf 100644 --- a/test/snapshots/multicursor.golden +++ b/test/snapshots/multicursor.golden @@ -1,11 +1,11 @@ == snap three-cursors grid=150x31 cursor=7,9 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/multicursor/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/multicursor/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/multicursor/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/multicursor/cwd Tty+bash Save Mode Filter Collapse Del | ls ls | f.txt f.txt | -| /tmp/pardes-snap/multicursor/cwd/f.txt Save Tty Collapse Del +| /tmp/pardes-snap/multicursor/cwd/f.txt Save Tty Collapse Del | 1 line 1 | 2 line 2 | 3 line 3 @@ -16,17 +16,17 @@ | 8 line 8 | 9 line 9 | 10 line 10 -| /tmp/pardes-snap/multicursor/cwd Tty+bash Save Mode Filter Collapse Del +| /tmp/pardes-snap/multicursor/cwd Tty+bash Save Mode Filter Collapse Del | ls | f.txt == style three-cursors grid=150x31 -|0: 0-149 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-74 #becfc4,#314738, 75-76 #becfc4,#887455, 77-77 #becfc4,#1d2824, 78-149 #b2c3b8,#1d2824, -|2: 0-1 d,#496656, 2-2 d,#1d2824, 3-35 #b2c3b8,#1d2824, 36-44 #d3b0d9,#1d2824, 45-74 #b2c3b8,#1d2824, 75-76 #b2c3b8,#496656, 77-110 #b2c3b8,#1d2824, 111-119 #d3b0d9,#1d2824, 120-149 #b2c3b8,#1d2824, +|0: 0-1 d,#1d2824, 2-149 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-74 #becfc4,#314738, 75-76 #becfc4,#887455, 77-149 #b2c3b8,#1d2824, +|2: 0-1 d,#496656, 2-34 #b2c3b8,#1d2824, 35-43 #d3b0d9,#1d2824, 44-74 #b2c3b8,#1d2824, 75-76 #b2c3b8,#496656, 77-109 #b2c3b8,#1d2824, 110-118 #d3b0d9,#1d2824, 119-149 #b2c3b8,#1d2824, |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, -|6: 0-1 d,#add38a, 2-2 d,#314738, 3-35 #becfc4,#314738, 36-41 #dfbce5,#314738, 42-74 #becfc4,#314738, 75-75 #becfc4,#608269, 76-149 #becfc4,#0d1410, +|6: 0-1 d,#add38a, 2-34 #becfc4,#314738, 35-40 #dfbce5,#314738, 41-74 #becfc4,#314738, 75-75 #becfc4,#608269, 76-149 #becfc4,#0d1410, |7: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-7 #3c614a,#f5f7ee, 8-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |8: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-7 #3c614a,#f5f7ee, 8-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |9: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, @@ -37,7 +37,7 @@ |14: 0-0 d,#152019, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |15: 0-0 d,#152019, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |16: 0-0 d,#152019, 1-3 d,#0d1410, 4-6 #59675c,#0d1410, 7-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, -|17: 0-1 d,#496656, 2-2 d,#1d2824, 3-35 #b2c3b8,#1d2824, 36-44 #d3b0d9,#1d2824, 45-74 #b2c3b8,#1d2824, 75-75 #b2c3b8,#608269, 76-149 #b2c3b8,#0d1410, +|17: 0-1 d,#496656, 2-34 #b2c3b8,#1d2824, 35-43 #d3b0d9,#1d2824, 44-74 #b2c3b8,#1d2824, 75-75 #b2c3b8,#608269, 76-149 #b2c3b8,#0d1410, |18: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |19: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |20: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, @@ -52,13 +52,13 @@ |29: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, |30: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, == snap edited-at-three grid=150x31 cursor=9,9 -|6: * /tmp/pardes-snap/multicursor/cwd/f.txt Save Tty Collapse Del +|6: */tmp/pardes-snap/multicursor/cwd/f.txt Save Tty Collapse Del |7: 1 >>line 1 |8: 2 >>line 2 |9: 3 >>line 3 == snap three-selections grid=150x31 cursor=8,9 == style three-selections grid=150x31 -|6: 0-0 d,#add38a, 1-1 #000000,#f9cb70,b 2-2 #000000,#314738, 3-35 #becfc4,#314738, 36-41 #dfbce5,#314738, 42-74 #becfc4,#314738, 75-75 #becfc4,#608269, 76-149 #becfc4,#0d1410, +|6: 0-0 d,#add38a, 1-1 #000000,#f9cb70,b 2-34 #becfc4,#314738, 35-40 #dfbce5,#314738, 41-74 #becfc4,#314738, 75-75 #becfc4,#608269, 76-149 #becfc4,#0d1410, |7: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-7 #f5f7ee,#243a2d, 8-8 #3c614a,#f5f7ee, 9-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |8: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-7 #f5f7ee,#243a2d, 8-8 #3c614a,#f5f7ee, 9-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |9: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-8 #f5f7ee,#3c614a, 9-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, diff --git a/test/snapshots/nested-optout.golden b/test/snapshots/nested-optout.golden index 3539a16c..0cb3b742 100644 --- a/test/snapshots/nested-optout.golden +++ b/test/snapshots/nested-optout.golden @@ -1,10 +1,10 @@ == snap optout-file grid=100x31 cursor=9,6 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -|$ /tmp/pardes-snap/nested-optout/cwd Tty+bash Save Mode Filter Collapse Del | Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/nested-optout/cwd/nested.txt Save Tty Collapse Del +| New Tty Find Grep Joincol Delcol +|$ /tmp/pardes-snap/nested-optout/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/nested-optout/cwd/nested.txt Save Tty Collapse Del | 1 optout-marker | 2 second-optout-line | 3 @@ -20,15 +20,15 @@ | | | -| /tmp/pardes-snap/nested-optout/cwd/+New Save Tty Collapse Del +| /tmp/pardes-snap/nested-optout/cwd/+New Save Tty Collapse Del | 1 == snap inner-shell grid=100x31 cursor=6,6 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -|$ /tmp/pardes-snap/nested-optout/cwd Tty+bash Save Mode Filter Collapse Del | Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| $ /tmp/pardes-snap/nested-optout/cwd/innerdir Tty+bash Save Mode Filter Collapse Del +| New Tty Find Grep Joincol Delcol +|$ /tmp/pardes-snap/nested-optout/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| $ /tmp/pardes-snap/nested-optout/cwd/innerdir Tty+bash Save Mode Filter Collapse Del | $ | | @@ -39,16 +39,16 @@ | | | -| /tmp/pardes-snap/nested-optout/cwd/innerdir/+New Save Tty Collapse Del +| /tmp/pardes-snap/nested-optout/cwd/innerdir/+New Save Tty Collapse Del | 1 | | | -| /tmp/pardes-snap/nested-optout/cwd/+New Save Tty Collapse Del +| /tmp/pardes-snap/nested-optout/cwd/+New Save Tty Collapse Del | 1 == snap inner-launch grid=100x31 cursor=11,9 -|6: Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -|7: New Tty Find Grep Joincol Delcol -|8: /tmp/pardes-snap/nested-optout/cwd/innerdir/deeper.txt Save Tty Collapse Del +|6: Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +|7: New Tty Find Grep Joincol Delcol +|8: /tmp/pardes-snap/nested-optout/cwd/innerdir/deeper.txt Save Tty Collapse Del |9: 1 deepest-marker |10: 2 diff --git a/test/snapshots/nested.golden b/test/snapshots/nested.golden index 44ab4b82..466c34ae 100644 --- a/test/snapshots/nested.golden +++ b/test/snapshots/nested.golden @@ -1,10 +1,10 @@ == snap file-arg grid=100x31 cursor=7,6 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -|$ /tmp/pardes-snap/nested/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +|$ /tmp/pardes-snap/nested/cwd Tty+bash Save Mode Filter Collapse Del | $ $(readlink /proc/$PPID/exe) nested.txt | $ -| /tmp/pardes-snap/nested/cwd/nested.txt Save Tty Collapse Del +| /tmp/pardes-snap/nested/cwd/nested.txt Save Tty Collapse Del | 1 hello-from-nested | 2 second-nested-line | 3 @@ -20,12 +20,12 @@ | | | -| /tmp/pardes-snap/nested/cwd/+New Save Tty Collapse Del +| /tmp/pardes-snap/nested/cwd/+New Save Tty Collapse Del | 1 == snap no-arg grid=100x31 cursor=4,7 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -|$ /tmp/pardes-snap/nested/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +|$ /tmp/pardes-snap/nested/cwd Tty+bash Save Mode Filter Collapse Del | $ $(readlink /proc/$PPID/exe) | pardes: this shell is already inside pardes, and a pardes inside a pardes | is spicy. Name a file or a directory and the outer session opens it, or @@ -44,15 +44,15 @@ | | | -| /tmp/pardes-snap/nested/cwd/+New Save Tty Collapse Del +| /tmp/pardes-snap/nested/cwd/+New Save Tty Collapse Del | 1 == snap dir-arg grid=100x31 cursor=7,6 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -|$ /tmp/pardes-snap/nested/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +|$ /tmp/pardes-snap/nested/cwd Tty+bash Save Mode Filter Collapse Del | $ $(readlink /proc/$PPID/exe) nestdir | $ -| /tmp/pardes-snap/nested/cwd/nestdir/ Get Tty Collapse Del +| /tmp/pardes-snap/nested/cwd/nestdir/ Get Tty Collapse Del | 1 inside-nested.txt | 2 | @@ -68,5 +68,5 @@ | | | -| /tmp/pardes-snap/nested/cwd/+New Save Tty Collapse Del +| /tmp/pardes-snap/nested/cwd/+New Save Tty Collapse Del | 1 diff --git a/test/snapshots/ninep.golden b/test/snapshots/ninep.golden index e524fa30..d10c7181 100644 --- a/test/snapshots/ninep.golden +++ b/test/snapshots/ninep.golden @@ -1,7 +1,7 @@ == snap opened grid=90x15 cursor=7,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/ninep/cwd/demo.zig Save Tty Collapse Del TreeContext Def Refs +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/ninep/cwd/demo.zig Save Tty Collapse TreeContext Def Refs Del | 1 const greeting = "café λ 界 é"; | 2 | 3 pub fn choose(ok: bool) u32 { @@ -10,9 +10,9 @@ | 6 } | 7 == style opened grid=90x15 -|0: 0-89 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-89 #becfc4,#314738, -|2: 0-1 d,#add38a, 2-2 d,#314738, 3-29 #becfc4,#314738, 30-38 #dfbce5,#314738, 39-89 #becfc4,#314738, +|0: 0-1 d,#1d2824, 2-89 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-89 #becfc4,#314738, +|2: 0-1 d,#add38a, 2-28 #becfc4,#314738, 29-37 #dfbce5,#314738, 38-89 #becfc4,#314738, |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-23 #e5eee5,#0d1410, 24-32 #b8d88a,#0d1410, 33-33 d,d, 34-34 d,#0d1410, 35-36 #b8d88a,#0d1410, 37-89 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-4 d,#0d1410, 5-89 #59675c,#0d1410, |5: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-13 #c9a7ed,#0d1410, 14-89 #e5eee5,#0d1410, @@ -26,12 +26,12 @@ |13: 0-0 d,#608269, 1-89 d,#0d1410, |14: 0-0 d,#608269, 1-89 d,#0d1410, == 9p opened grid=90x15 cursor=7,3,block -|0: Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -@0: 0-74 #b2c3b8,#1d2824,,tagline 75-89 d,#1d2824,,tagline -|1: New Tty Find Grep Joincol Delcol -@1: 0-1 #ffffff,#887455,,tagline 2-2 d,#314738,,tagline 3-34 #becfc4,#314738,,tagline 35-89 d,#314738,,tagline -|2: /tmp/pardes-snap/ninep/cwd/demo.zig Save Tty Collapse Del TreeContext Def Refs -@2: 0-1 #000000,#add38a,,tagline 2-2 d,#314738,,tagline 3-29 #becfc4,#314738,,tagline 30-37 #dfbce5,#314738,,tagline 38-80 #becfc4,#314738,,tagline 81-89 d,#314738,,tagline +|0: Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +@0: 0-76 #b2c3b8,#1d2824,,tagline 77-89 d,#1d2824,,tagline +|1: New Tty Find Grep Joincol Delcol +@1: 0-1 #ffffff,#887455,,tagline 2-33 #becfc4,#314738,,tagline 34-89 d,#314738,,tagline +|2: /tmp/pardes-snap/ninep/cwd/demo.zig Save Tty Collapse TreeContext Def Refs Del +@2: 0-1 #000000,#add38a,,tagline 2-28 #becfc4,#314738,,tagline 29-36 #dfbce5,#314738,,tagline 37-79 #becfc4,#314738,,tagline 80-89 d,#314738,,tagline |3: 1 const greeting = "café λ 界 é"; +3: 28="é" 30="λ" 32="界" 33="" 35="é" @3: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #616f64,#0d1410,b,body 7-23 #e5eee5,#0d1410,,body 24-36 #b8d88a,#0d1410,,body 37-37 #e5eee5,#0d1410,,body 38-89 d,#0d1410,,body @@ -73,7 +73,7 @@ |7: 5 return 7; @7: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-19 #e5eee5,#0d1410,,body 20-89 d,#0d1410,,body == snap edited-with-colors-off grid=90x15 cursor=7,4 -|2: * /tmp/pardes-snap/ninep/cwd/demo.zig Save Tty Collapse Del TreeContext Def Refs +|2: */tmp/pardes-snap/ninep/cwd/demo.zig Save Tty Collapse TreeContext Def Refs Del |3: 1 // café λ 界 |4: 2 const greeting = "café λ 界 é"; |5: 3 @@ -83,8 +83,8 @@ |9: 7 } |10: 8 == 9p edited-with-colors-off grid=90x15 cursor=7,4,block -|2: * /tmp/pardes-snap/ninep/cwd/demo.zig Save Tty Collapse Del TreeContext Def Refs -@2: 0-0 #000000,#add38a,,tagline 1-1 #000000,#f9cb70,b,tagline 2-2 d,#314738,,tagline 3-29 #becfc4,#314738,,tagline 30-37 #dfbce5,#314738,,tagline 38-80 #becfc4,#314738,,tagline 81-89 d,#314738,,tagline +|2: */tmp/pardes-snap/ninep/cwd/demo.zig Save Tty Collapse TreeContext Def Refs Del +@2: 0-0 #000000,#add38a,,tagline 1-1 #000000,#f9cb70,b,tagline 2-28 #becfc4,#314738,,tagline 29-36 #dfbce5,#314738,,tagline 37-79 #becfc4,#314738,,tagline 80-89 d,#314738,,tagline |3: 1 // café λ 界 +3: 13="é" 15="λ" 17="界" 18="" @3: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-18 #e5eee5,#0d1410,,body 19-89 d,#0d1410,,body @@ -104,7 +104,7 @@ |10: 8 @10: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-89 d,#0d1410,,body == style colors-on grid=90x15 -|2: 0-0 d,#add38a, 1-1 #000000,#f9cb70,b 2-2 #000000,#314738, 3-29 #becfc4,#314738, 30-38 #dfbce5,#314738, 39-89 #becfc4,#314738, +|2: 0-0 d,#add38a, 1-1 #000000,#f9cb70,b 2-28 #becfc4,#314738, 29-37 #dfbce5,#314738, 38-89 #becfc4,#314738, |3: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-17 #b9f480,#0d1410, 18-18 d,d, 19-81 d,#0d1410, 82-82 d,#1d2824, 83-89 #b2c3b8,#1d2824, |4: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-23 #e5eee5,#0d1410, 24-32 #b8d88a,#0d1410, 33-33 d,d, 34-34 d,#0d1410, 35-36 #b8d88a,#0d1410, 37-89 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-4 d,#0d1410, 5-89 #59675c,#0d1410, @@ -127,9 +127,9 @@ |8: 6 return 7; @8: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-10 #e5eee5,#0d1410,,body 11-16 #c9a7ed,#0d1410,,body 17-17 #e5eee5,#0d1410,,body 18-18 #f8c082,#0d1410,,body 19-19 #e5eee5,#0d1410,,body 20-89 d,#0d1410,,body == style resized grid=105x20 -|0: 0-104 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-104 #becfc4,#314738, -|2: 0-0 d,#add38a, 1-1 #000000,#f9cb70,b 2-2 #000000,#314738, 3-29 #becfc4,#314738, 30-38 #dfbce5,#314738, 39-104 #becfc4,#314738, +|0: 0-1 d,#1d2824, 2-104 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-104 #becfc4,#314738, +|2: 0-0 d,#add38a, 1-1 #000000,#f9cb70,b 2-28 #becfc4,#314738, 29-37 #dfbce5,#314738, 38-104 #becfc4,#314738, |3: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-17 #b9f480,#0d1410, 18-18 d,d, 19-96 d,#0d1410, 97-97 d,#1d2824, 98-104 #b2c3b8,#1d2824, |4: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-23 #e5eee5,#0d1410, 24-32 #b8d88a,#0d1410, 33-33 d,d, 34-34 d,#0d1410, 35-36 #b8d88a,#0d1410, 37-104 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-4 d,#0d1410, 5-104 #59675c,#0d1410, @@ -148,12 +148,12 @@ |18: 0-0 d,#608269, 1-104 d,#0d1410, |19: 0-0 d,#608269, 1-104 d,#0d1410, == 9p resized grid=105x20 cursor=7,4,block -|0: Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -@0: 0-74 #b2c3b8,#1d2824,,tagline 75-104 d,#1d2824,,tagline -|1: New Tty Find Grep Joincol Delcol -@1: 0-1 #ffffff,#887455,,tagline 2-2 d,#314738,,tagline 3-34 #becfc4,#314738,,tagline 35-104 d,#314738,,tagline -|2: * /tmp/pardes-snap/ninep/cwd/demo.zig Save Tty Collapse Del TreeContext Def Refs -@2: 0-0 #000000,#add38a,,tagline 1-1 #000000,#f9cb70,b,tagline 2-2 d,#314738,,tagline 3-29 #becfc4,#314738,,tagline 30-37 #dfbce5,#314738,,tagline 38-80 #becfc4,#314738,,tagline 81-104 d,#314738,,tagline +|0: Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +@0: 0-76 #b2c3b8,#1d2824,,tagline 77-104 d,#1d2824,,tagline +|1: New Tty Find Grep Joincol Delcol +@1: 0-1 #ffffff,#887455,,tagline 2-33 #becfc4,#314738,,tagline 34-104 d,#314738,,tagline +|2: */tmp/pardes-snap/ninep/cwd/demo.zig Save Tty Collapse TreeContext Def Refs Del +@2: 0-0 #000000,#add38a,,tagline 1-1 #000000,#f9cb70,b,tagline 2-28 #becfc4,#314738,,tagline 29-36 #dfbce5,#314738,,tagline 37-79 #becfc4,#314738,,tagline 80-104 d,#314738,,tagline |3: 1 // café λ 界 Colors +3: 13="é" 15="λ" 17="界" 18="" @3: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-18 #b9f480,#0d1410,,body 19-96 d,#0d1410,,body 97-97 d,#1d2824,,tagline 98-103 #b2c3b8,#1d2824,,tagline 104-104 d,#1d2824,,tagline @@ -191,9 +191,9 @@ |19: @19: 0-0 d,#608269,,body 1-1 d,#0d1410,,body 2-6 #59675c,#0d1410,,body 7-104 d,#0d1410,,body == snap resized grid=105x20 cursor=7,4 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| * /tmp/pardes-snap/ninep/cwd/demo.zig Save Tty Collapse Del TreeContext Def Refs +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| */tmp/pardes-snap/ninep/cwd/demo.zig Save Tty Collapse TreeContext Def Refs Del | 1 // café λ 界 Colors | 2 const greeting = "café λ 界 é"; | 3 diff --git a/test/snapshots/pagercolor.golden b/test/snapshots/pagercolor.golden index abd264d1..e84359d8 100644 --- a/test/snapshots/pagercolor.golden +++ b/test/snapshots/pagercolor.golden @@ -1,7 +1,7 @@ == snap pager grid=100x50 cursor=4,5 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -|$ /tmp/pardes-snap/pagercolor/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +|$ /tmp/pardes-snap/pagercolor/cwd Tty+bash Save Mode Filter Collapse Del | $ printf '\033]0;title\007\033[31mred\033[m \033[1;32mbold green\033[m \033[38;2;200;100;0mrgb\033 | [m \033[4mul\033[m N\bNA\bAM\bME\bE _\bu_\bs plain\n' | $(readlink /proc/$PPID/exe) - | $ @@ -33,7 +33,7 @@ | | | -| /tmp/pardes-snap/pagercolor/cwd/+New Save Tty Collapse Del +| /tmp/pardes-snap/pagercolor/cwd/+New Save Tty Collapse Del | 1 | | @@ -41,12 +41,12 @@ | | | -| /tmp/pardes-snap/pagercolor/cwd/+Pager Save Tty Filter Collapse Del +| /tmp/pardes-snap/pagercolor/cwd/+Pager Save Tty Filter Collapse Del | red bold green rgb ul NAME us plain == style pager-colours grid=100x50 -|0: 0-99 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-99 #becfc4,#314738, -|2: 0-1 #000000,#add38a, 2-2 #000000,#314738, 3-34 #becfc4,#314738, 35-43 #dfbce5,#314738, 44-99 #becfc4,#314738, +|0: 0-1 d,#1d2824, 2-99 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-99 #becfc4,#314738, +|2: 0-1 #000000,#add38a, 2-33 #becfc4,#314738, 34-42 #dfbce5,#314738, 43-99 #becfc4,#314738, |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, @@ -78,7 +78,7 @@ |31: 0-0 d,#608269, 1-99 d,#0d1410, |32: 0-0 d,#608269, 1-99 d,#0d1410, |33: 0-0 d,#608269, 1-99 d,#0d1410, -|34: 0-1 d,#496656, 2-2 d,#1d2824, 3-34 #b2c3b8,#1d2824, 35-39 #d3b0d9,#1d2824, 40-99 #b2c3b8,#1d2824, +|34: 0-1 d,#496656, 2-33 #b2c3b8,#1d2824, 34-38 #d3b0d9,#1d2824, 39-99 #b2c3b8,#1d2824, |35: 0-0 d,#608269, 1-4 d,#0d1410, 5-99 #59675c,#0d1410, |36: 0-0 d,#608269, 1-99 d,#0d1410, |37: 0-0 d,#608269, 1-99 d,#0d1410, @@ -86,7 +86,7 @@ |39: 0-0 d,#608269, 1-99 d,#0d1410, |40: 0-0 d,#608269, 1-99 d,#0d1410, |41: 0-0 d,#608269, 1-99 d,#0d1410, -|42: 0-1 d,#496656, 2-2 d,#1d2824, 3-34 #b2c3b8,#1d2824, 35-41 #d3b0d9,#1d2824, 42-99 #b2c3b8,#1d2824, +|42: 0-1 d,#496656, 2-33 #b2c3b8,#1d2824, 34-40 #d3b0d9,#1d2824, 41-99 #b2c3b8,#1d2824, |43: 0-0 d,#608269, 1-1 d,#0d1410, 2-5 #f1a39b,#0d1410, 6-15 #b6ce94,#0d1410,b 16-16 #b6ce94,#0d1410, 17-20 #c5917e,#0d1410, 21-22 #e5eee5,#0d1410,u 23-23 #e5eee5,#0d1410, 24-27 #e5eee5,#0d1410,b 28-28 #e5eee5,#0d1410, 29-30 #e5eee5,#0d1410,u 31-99 #e5eee5,#0d1410, |44: 0-0 d,#608269, 1-99 d,#0d1410, |45: 0-0 d,#608269, 1-99 d,#0d1410, @@ -99,19 +99,33 @@ |6: 3[m\n\033[1m+++ b/x\033[m\n\033[36m@@ -1 +1 @@\033[m\n\033[31m-old\033[m\n\033[32m+new\033[m\n' | |7: $(readlink /proc/$PPID/exe) - |8: $ -|9: /tmp/pardes-snap/pagercolor/cwd/+Diff Save Tty Diff Collapse Del LocationsConfig +|9: /tmp/pardes-snap/pagercolor/cwd/+Diff Save Tty Diff Collapse LocationsConfig Del |10: commit 0123abc |11: x:1 |12: -old |13: +new -|49: /tmp/pardes-snap/pagercolor/cwd/+Pager Save Tty Filter Diff Collapse Del +|34: +|35: +|38: /tmp/pardes-snap/pagercolor/cwd/+New Save Tty Collapse Del +|39: 1 +|42: +|43: +|46: /tmp/pardes-snap/pagercolor/cwd/+Pager Save Tty Filter Collapse Del +|47: red bold green rgb ul NAME us plain == style pager-diff-colours grid=100x50 |6: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, |7: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, |8: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, -|9: 0-1 d,#496656, 2-2 d,#1d2824, 3-34 #b2c3b8,#1d2824, 35-40 #d3b0d9,#1d2824, 41-99 #b2c3b8,#1d2824, +|9: 0-1 d,#496656, 2-33 #b2c3b8,#1d2824, 34-39 #d3b0d9,#1d2824, 40-99 #b2c3b8,#1d2824, |10: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #e5eee5,#0d1410, |11: 0-0 d,#608269, 1-1 d,#0d1410, 2-99 #59675c,#0d1410, |12: 0-0 d,#608269, 1-1 d,#0d1410, 2-2 #f1a39b,#1a1d18,b 3-99 #f8c082,#1a1d18, |13: 0-0 d,#608269, 1-1 d,#0d1410, 2-2 #b6ce94,#171f18,b 3-99 #b8d88a,#171f18, -|49: 0-1 d,#496656, 2-2 d,#1d2824, 3-34 #b2c3b8,#1d2824, 35-41 #d3b0d9,#1d2824, 42-99 #b2c3b8,#1d2824, +|34: 0-0 d,#608269, 1-99 d,#0d1410, +|35: 0-0 d,#608269, 1-99 d,#0d1410, +|38: 0-1 d,#496656, 2-33 #b2c3b8,#1d2824, 34-38 #d3b0d9,#1d2824, 39-99 #b2c3b8,#1d2824, +|39: 0-0 d,#608269, 1-4 d,#0d1410, 5-99 #59675c,#0d1410, +|42: 0-0 d,#608269, 1-99 d,#0d1410, +|43: 0-0 d,#608269, 1-99 d,#0d1410, +|46: 0-1 d,#496656, 2-33 #b2c3b8,#1d2824, 34-40 #d3b0d9,#1d2824, 41-99 #b2c3b8,#1d2824, +|47: 0-0 d,#608269, 1-1 d,#0d1410, 2-5 #f1a39b,#0d1410, 6-15 #b6ce94,#0d1410,b 16-16 #b6ce94,#0d1410, 17-20 #c5917e,#0d1410, 21-22 #e5eee5,#0d1410,u 23-23 #e5eee5,#0d1410, 24-27 #e5eee5,#0d1410,b 28-28 #e5eee5,#0d1410, 29-30 #e5eee5,#0d1410,u 31-99 #e5eee5,#0d1410, diff --git a/test/snapshots/pipe.golden b/test/snapshots/pipe.golden index 2fd54c27..8818499e 100644 --- a/test/snapshots/pipe.golden +++ b/test/snapshots/pipe.golden @@ -1,12 +1,12 @@ == snap prompt grid=180x13 cursor=179,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/pipe/cwd/pipe.txt Save Tty Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/pipe/cwd/pipe.txt Save Tty Collapse Del | 1 alpha beta |tr a-z A-Z | 2 gamma delta == snap filtered grid=180x13 cursor=17,3 -|2: * /tmp/pardes-snap/pipe/cwd/pipe.txt Save Tty Collapse Del +|2: */tmp/pardes-snap/pipe/cwd/pipe.txt Save Tty Collapse Del |3: 1 ALPHA BETA == snap undone grid=180x13 cursor=17,3 -|2: /tmp/pardes-snap/pipe/cwd/pipe.txt Save Tty Collapse Del +|2: /tmp/pardes-snap/pipe/cwd/pipe.txt Save Tty Collapse Del |3: 1 alpha beta diff --git a/test/snapshots/psearch.golden b/test/snapshots/psearch.golden index e830a206..2a845a34 100644 --- a/test/snapshots/psearch.golden +++ b/test/snapshots/psearch.golden @@ -1,7 +1,7 @@ == snap output grid=140x31 cursor=4,9 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/psearch/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/psearch/cwd Tty+bash Save Mode Filter Collapse Del | printf 'x MA''RK a\nzz\nx MA''RK b\nzz\nx MA''RK c\n' | x MARK a | zz @@ -20,13 +20,13 @@ | | | -| /tmp/pardes-snap/psearch/cwd/+New Save Tty Collapse Del +| /tmp/pardes-snap/psearch/cwd/+New Save Tty Collapse Del | 1 == snap typing grid=140x31 cursor=139,3 |3: printf 'x MA''RK a\nzz\nx MA''RK b\nzz\nx MA''RK c\n' /MARK == snap results grid=140x31 cursor=7,4 |3: printf 'x MA''RK a\nzz\nx MA''RK b\nzz\nx MA''RK c\n' -|10: /tmp/pardes-snap/psearch/cwd/+Search Save Tty Collapse Del LocationsConfig +|10: /tmp/pardes-snap/psearch/cwd/+Search Save Tty Collapse LocationsConfig Del |11: 1 @p1:2:3-6 |12: 2 x MARK a |13: 3 @p1:4:3-6 @@ -35,9 +35,9 @@ |16: 6 x MARK c |17: 7 == style results grid=140x31 -|0: 0-139 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-139 #becfc4,#314738, -|2: 0-1 d,#add38a, 2-2 d,#314738, 3-31 #becfc4,#314738, 32-40 #dfbce5,#314738, 41-139 #becfc4,#314738, +|0: 0-1 d,#1d2824, 2-139 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-139 #becfc4,#314738, +|2: 0-1 d,#add38a, 2-30 #becfc4,#314738, 31-39 #dfbce5,#314738, 40-139 #becfc4,#314738, |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-1 d,#0d1410, 2-3 #e5eee5,#0d1410, 4-7 #f5f7ee,#3c614a, 8-8 #f5f7ee,#0d1410, 9-139 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, @@ -45,7 +45,7 @@ |7: 0-0 d,#608269, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, |8: 0-0 d,#608269, 1-1 d,#0d1410, 2-139 #e5eee5,#0d1410, |9: 0-0 d,#608269, 1-139 d,#0d1410, -|10: 0-1 d,#496656, 2-2 d,#1d2824, 3-31 #b2c3b8,#1d2824, 32-39 #d3b0d9,#1d2824, 40-139 #b2c3b8,#1d2824, +|10: 0-1 d,#496656, 2-30 #b2c3b8,#1d2824, 31-38 #d3b0d9,#1d2824, 39-139 #b2c3b8,#1d2824, |11: 0-0 d,#608269, 1-4 d,#0d1410, 5-139 #59675c,#0d1410, |12: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-8 #e5eee5,#0d1410, 9-12 #f7e4a5,#5e4923, 13-13 #f7e4a5,#0d1410, 14-139 #e5eee5,#0d1410, |13: 0-0 d,#608269, 1-4 d,#0d1410, 5-139 #59675c,#0d1410, @@ -56,7 +56,7 @@ |18: 0-0 d,#608269, 1-139 d,#0d1410, |19: 0-0 d,#608269, 1-139 d,#0d1410, |20: 0-0 d,#608269, 1-139 d,#0d1410, -|21: 0-1 d,#496656, 2-2 d,#1d2824, 3-31 #b2c3b8,#1d2824, 32-36 #d3b0d9,#1d2824, 37-139 #b2c3b8,#1d2824, +|21: 0-1 d,#496656, 2-30 #b2c3b8,#1d2824, 31-35 #d3b0d9,#1d2824, 36-139 #b2c3b8,#1d2824, |22: 0-0 d,#608269, 1-4 d,#0d1410, 5-139 #59675c,#0d1410, |23: 0-0 d,#608269, 1-139 d,#0d1410, |24: 0-0 d,#608269, 1-139 d,#0d1410, @@ -69,13 +69,13 @@ == snap second grid=140x31 cursor=7,6 == snap back grid=140x31 cursor=7,4 == snap nomatch grid=140x31 cursor=7,13 -|24: /tmp/pardes-snap/psearch/cwd/+Search Save Tty Collapse Del LocationsConfig +|24: /tmp/pardes-snap/psearch/cwd/+Search Save Tty Collapse LocationsConfig Del |25: 1 == snap ttyinert grid=140x31 cursor=4,9 -|2: $ /tmp/pardes-snap/psearch/cwd Tty+bash Save Mode Filter Collapse Del +|2: $ /tmp/pardes-snap/psearch/cwd Tty+bash Save Mode Filter Collapse Del |3: $ printf 'x MA''RK a\nzz\nx MA''RK b\nzz\nx MA''RK c\n' |9: $ == snap rightsearch grid=140x31 cursor=7,6 -|2: /tmp/pardes-snap/psearch/cwd Tty+bash Save Mode Filter Collapse Del +|2: /tmp/pardes-snap/psearch/cwd Tty+bash Save Mode Filter Collapse Del |3: printf 'x MA''RK a\nzz\nx MA''RK b\nzz\nx MA''RK c\n' |9: diff --git a/test/snapshots/reflow.golden b/test/snapshots/reflow.golden index 17c42d0d..db4b5a77 100644 --- a/test/snapshots/reflow.golden +++ b/test/snapshots/reflow.golden @@ -1,7 +1,7 @@ == snap widened grid=200x25 cursor=4,16 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -|$ /tmp/pardes-snap/reflow/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +|$ /tmp/pardes-snap/reflow/cwd Tty+bash Save Mode Filter Collapse Del | yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy | yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy | yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy @@ -16,5 +16,5 @@ | yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy | yyyyyyyyyyyyyyyyyyyyyyyyyyyyyydone | $ -| /tmp/pardes-snap/reflow/cwd/+New Save Tty Collapse Del +| /tmp/pardes-snap/reflow/cwd/+New Save Tty Collapse Del | 1 diff --git a/test/snapshots/respawn.golden b/test/snapshots/respawn.golden index 1e6425d2..4810f9d3 100644 --- a/test/snapshots/respawn.golden +++ b/test/snapshots/respawn.golden @@ -1,10 +1,10 @@ == snap respawn grid=140x31 cursor=4,9 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/respawn/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/respawn/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/respawn/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/respawn/cwd Tty+bash Save Mode Filter Collapse Del | ls ls | -|$ /tmp/pardes-snap/respawn/cwd Tty+bash Save Mode Filter Collapse Del +|$ /tmp/pardes-snap/respawn/cwd Tty+bash Save Mode Filter Collapse Del | $ ls | $ echo RESP''AWNOK | RESPAWNOK diff --git a/test/snapshots/restore.golden b/test/snapshots/restore.golden index 0bb53676..a8e39308 100644 --- a/test/snapshots/restore.golden +++ b/test/snapshots/restore.golden @@ -1,12 +1,12 @@ == snap dumped grid=100x31 cursor=4,6 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit Restore /tmp/pardes-snap -| New Tty Find Grep Joincol Delcol -|$ /tmp/pardes-snap/restore/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit Restore /tmp/pardes-sn +| New Tty Find Grep Joincol Delcol +|$ /tmp/pardes-snap/restore/cwd Tty+bash Save Mode Filter Collapse Del | $ ls Dump | $ echo KEEP''ME | KEEPME | $ == snap restored grid=100x31 cursor=4,8 -|2: /tmp/pardes-snap/restore/cwd Tty+bash Save Mode Filter Collapse Del +|2: /tmp/pardes-snap/restore/cwd Tty+bash Save Mode Filter Collapse Del |3: $ ls |7: ── restored history ── diff --git a/test/snapshots/rsearch.golden b/test/snapshots/rsearch.golden index 870831b4..d69feb7a 100644 --- a/test/snapshots/rsearch.golden +++ b/test/snapshots/rsearch.golden @@ -1,17 +1,17 @@ == snap opened grid=210x31 cursor=7,7 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/rsearch/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/rsearch/cwd Tty+bash Save Mode Filter Collapse Del | ls | code.txt sub | -| /tmp/pardes-snap/rsearch/cwd/code.txt Save Tty Collapse Del +| /tmp/pardes-snap/rsearch/cwd/code.txt Save Tty Collapse Del | 1 run count_x now | 2 open sub/dep.txt:3 here | 3 count_x again | 4 pick two words == snap search grid=210x31 cursor=13,9 -|11: /tmp/pardes-snap/rsearch/cwd/+Search Save Tty Collapse Del LocationsConfig +|11: /tmp/pardes-snap/rsearch/cwd/+Search Save Tty Collapse LocationsConfig Del |12: 1 code.txt:1:5-11 |13: 2 run count_x now |14: 3 code.txt:3:1-7 @@ -24,7 +24,7 @@ |15: |16: == snap path-open grid=210x31 cursor=16,17 -|14: /tmp/pardes-snap/rsearch/cwd/sub/dep.txt Save Tty Collapse Del +|14: /tmp/pardes-snap/rsearch/cwd/sub/dep.txt Save Tty Collapse Del |15: 1 d1 |16: 2 d2 |17: 3 DEPTARGET diff --git a/test/snapshots/savepane.golden b/test/snapshots/savepane.golden index bea7146b..256b0074 100644 --- a/test/snapshots/savepane.golden +++ b/test/snapshots/savepane.golden @@ -1,7 +1,7 @@ == snap scratch grid=100x31 cursor=20,18 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/savepane/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/savepane/cwd Tty+bash Save Mode Filter Collapse Del | ls | | @@ -16,13 +16,13 @@ | | | -| * /tmp/pardes-snap/savepane/cwd/+New Save Tty Collapse Del +| */tmp/pardes-snap/savepane/cwd/+New Save Tty Collapse Del | 1 scratch bytes == snap prompt grid=100x31 cursor=99,19 |18: 1 scratch bytes Save |19: Save /tmp/pardes-snap/savepane/cwd/ == snap saved grid=100x31 cursor=20,18 -|17: /tmp/pardes-snap/savepane/cwd/saved.txt Save Tty Collapse Del +|17: /tmp/pardes-snap/savepane/cwd/saved.txt Save Tty Collapse Del |18: 1 scratch bytes --:--:-- saved /tmp/pardes-snap/savepane/cwd/saved.txt |19: == file bytes diff --git a/test/snapshots/scroll.golden b/test/snapshots/scroll.golden index 44b6b264..25bcd6ac 100644 --- a/test/snapshots/scroll.golden +++ b/test/snapshots/scroll.golden @@ -1,8 +1,8 @@ == snap bottom grid=100x31 cursor=4,16 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/scroll/cwd Tty+bash Save Mode /tmp/pardes-snap/scroll/cwd Tty+bash Save Mode -| Filter Collapse Del Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/scroll/cwd Tty+bash Save Mode F /tmp/pardes-snap/scroll/cwd Tty+bash Save Mode F +| ilter Collapse Del ilter Collapse Del | 189 ls | 190 s.txt | 191 @@ -16,8 +16,8 @@ | 199 | 200 | -| /tmp/pardes-snap/scroll/cwd Tty+bash Save Mode -| Filter Collapse Del +| /tmp/pardes-snap/scroll/cwd Tty+bash Save Mode F +| ilter Collapse Del | ls | s.txt == snap wheel3 grid=100x31 cursor=4,16 @@ -77,10 +77,10 @@ |15: 193 |16: 194 == style wheel-down grid=100x31 -|0: 0-99 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-49 #becfc4,#314738, 50-51 #becfc4,#887455, 52-52 #becfc4,#1d2824, 53-99 #b2c3b8,#1d2824, -|2: 0-1 d,#add38a, 2-2 d,#314738, 3-30 #becfc4,#314738, 31-39 #dfbce5,#314738, 40-49 #becfc4,#314738, 50-51 #becfc4,#496656, 52-52 #becfc4,#1d2824, 53-80 #b2c3b8,#1d2824, 81-89 #d3b0d9,#1d2824, 90-99 #b2c3b8,#1d2824, -|3: 0-2 d,#314738, 3-49 #becfc4,#314738, 50-52 #becfc4,#1d2824, 53-99 #b2c3b8,#1d2824, +|0: 0-1 d,#1d2824, 2-99 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-49 #becfc4,#314738, 50-51 #becfc4,#887455, 52-99 #b2c3b8,#1d2824, +|2: 0-1 d,#add38a, 2-29 #becfc4,#314738, 30-38 #dfbce5,#314738, 39-49 #becfc4,#314738, 50-51 #becfc4,#496656, 52-79 #b2c3b8,#1d2824, 80-88 #d3b0d9,#1d2824, 89-99 #b2c3b8,#1d2824, +|3: 0-1 d,#314738, 2-49 #becfc4,#314738, 50-51 #becfc4,#1d2824, 52-99 #b2c3b8,#1d2824, |4: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, |5: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, |6: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, @@ -94,8 +94,8 @@ |14: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, |15: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, |16: 0-0 d,#152019, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, -|17: 0-1 d,#496656, 2-2 d,#1d2824, 3-30 #b2c3b8,#1d2824, 31-39 #d3b0d9,#1d2824, 40-49 #b2c3b8,#1d2824, 50-50 #b2c3b8,#608269, 51-99 #b2c3b8,#0d1410, -|18: 0-2 d,#1d2824, 3-49 #b2c3b8,#1d2824, 50-50 #b2c3b8,#608269, 51-99 #b2c3b8,#0d1410, +|17: 0-1 d,#496656, 2-29 #b2c3b8,#1d2824, 30-38 #d3b0d9,#1d2824, 39-49 #b2c3b8,#1d2824, 50-50 #b2c3b8,#608269, 51-99 #b2c3b8,#0d1410, +|18: 0-1 d,#1d2824, 2-49 #b2c3b8,#1d2824, 50-50 #b2c3b8,#608269, 51-99 #b2c3b8,#0d1410, |19: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, |20: 0-0 d,#608269, 1-1 d,#0d1410, 2-49 #e5eee5,#0d1410, 50-50 #e5eee5,#608269, 51-99 #e5eee5,#0d1410, |21: 0-0 d,#608269, 1-49 d,#0d1410, 50-50 d,#608269, 51-99 d,#0d1410, diff --git a/test/snapshots/scrolloff.golden b/test/snapshots/scrolloff.golden index 299df49d..b56d2c36 100644 --- a/test/snapshots/scrolloff.golden +++ b/test/snapshots/scrolloff.golden @@ -1,11 +1,11 @@ == snap top grid=210x16 cursor=7,7 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/scrolloff/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/scrolloff/cwd Tty+bash Save Mode Filter Collapse Del | ls | g.txt | -| /tmp/pardes-snap/scrolloff/cwd/g.txt Save Tty Collapse Del +| /tmp/pardes-snap/scrolloff/cwd/g.txt Save Tty Collapse Del | 1 line 1 | 2 line 2 | 3 line 3 diff --git a/test/snapshots/selarg.golden b/test/snapshots/selarg.golden index 741864ef..33338c6e 100644 --- a/test/snapshots/selarg.golden +++ b/test/snapshots/selarg.golden @@ -1,8 +1,8 @@ == snap kept grid=100x31 cursor=6,4 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/selarg/cwd Tty+bash Save Mode /tmp/pardes-snap/selarg/cwd Tty+bash Save Mode -| Filter Collapse Del Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/selarg/cwd Tty+bash Save Mode F /tmp/pardes-snap/selarg/cwd Tty+bash Save Mode F +| ilter Collapse Del ilter Collapse Del | ZZARG ZZVEE ./c.sh | | @@ -16,8 +16,8 @@ | | | -| /tmp/pardes-snap/selarg/cwd Tty+bash Save Mode -| Filter Collapse Del +| /tmp/pardes-snap/selarg/cwd Tty+bash Save Mode F +| ilter Collapse Del | ls | s.txt == snap crosspane grid=100x31 cursor=6,4 diff --git a/test/snapshots/selregex.golden b/test/snapshots/selregex.golden index 480ad8a2..3fdab698 100644 --- a/test/snapshots/selregex.golden +++ b/test/snapshots/selregex.golden @@ -1,7 +1,7 @@ == snap prompt-armed grid=160x25 cursor=159,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/selregex/cwd/m.zig Save Tty Collapse Del TreeContext Def Refs +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/selregex/cwd/m.zig Save Tty Collapse TreeContext Def Refs Del | 1 const one = 1; Select / | 2 const two = 2; | 3 const three = 3; @@ -9,9 +9,9 @@ == snap preview grid=160x25 cursor=159,3 |3: 1 const one = 1; Select /const == style preview grid=160x25 -|0: 0-159 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-159 #becfc4,#314738, -|2: 0-1 d,#add38a, 2-2 d,#314738, 3-32 #becfc4,#314738, 33-38 #dfbce5,#314738, 39-159 #becfc4,#314738, +|0: 0-1 d,#1d2824, 2-159 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-159 #becfc4,#314738, +|2: 0-1 d,#add38a, 2-31 #becfc4,#314738, 32-37 #dfbce5,#314738, 38-159 #becfc4,#314738, |3: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-10 #f5f7ee,#3c614a, 11-11 #3c614a,#f5f7ee, 12-12 #3c614a,#0d1410, 13-18 #e5eee5,#0d1410, 19-19 #f8c082,#0d1410, 20-143 #e5eee5,#0d1410, 144-145 #e5eee5,#1d2824, 146-159 #b2c3b8,#1d2824, |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, @@ -51,12 +51,12 @@ |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 commented grid=160x25 cursor=14,3 -|2: * /tmp/pardes-snap/selregex/cwd/m.zig Save Tty Collapse Del TreeContext Def Refs +|2: */tmp/pardes-snap/selregex/cwd/m.zig Save Tty Collapse TreeContext Def Refs Del |3: 1 // const one = 1; |4: 2 // const two = 2; |5: 3 // const three = 3; == snap uncommented grid=160x25 cursor=11,3 -|2: /tmp/pardes-snap/selregex/cwd/m.zig Save Tty Collapse Del TreeContext Def Refs +|2: /tmp/pardes-snap/selregex/cwd/m.zig Save Tty Collapse TreeContext Def Refs Del |3: 1 const one = 1; |4: 2 const two = 2; |5: 3 const three = 3; diff --git a/test/snapshots/shellset.golden b/test/snapshots/shellset.golden index 9d566be7..21875eca 100644 --- a/test/snapshots/shellset.golden +++ b/test/snapshots/shellset.golden @@ -1,13 +1,13 @@ == snap boot grid=90x21 cursor=7,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/shellset/cwd/cmd.txt Save Tty Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/shellset/cwd/cmd.txt Save Tty Collapse Del | 1 Shell zznosuchshell == snap builtin-ran grid=90x21 cursor=25,3 |3: Shell: shell "zznosuchshell" not found (a name on the usual paths, or a path to one) == snap fallback-shell grid=90x21 cursor=49,6 -|1: New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -|2: /tmp/pardes-snap/shellset/cwd/cmd.txt Save /tmp/pardes-snap/shellset/cwd Tty+bash Sav -|3: Tty Collapse Del e Mode Filter Collapse Del +|1: New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +|2: /tmp/pardes-snap/shellset/cwd/cmd.txt Save /tmp/pardes-snap/shellset/cwd Tty+bash Save +|3: Tty Collapse Del Mode Filter Collapse Del |4: 1 Shell zznosuchshell ls |5: cmd.txt zmarkfile.txt diff --git a/test/snapshots/shrinktag.golden b/test/snapshots/shrinktag.golden index 6e64d89b..dc27a579 100644 --- a/test/snapshots/shrinktag.golden +++ b/test/snapshots/shrinktag.golden @@ -1,8 +1,8 @@ == snap before grid=100x31 cursor=4,9 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/shrinktag/cwd Tty+bash Save Mo /tmp/pardes-snap/shrinktag/cwd Tty+bash Save Mo -| de Filter Collapse Del de Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/shrinktag/cwd Tty+bash Save Mod /tmp/pardes-snap/shrinktag/cwd Tty+bash Save Mod +| e Filter Collapse Del e Filter Collapse Del | ls ls | w.txt w.txt | @@ -16,15 +16,15 @@ | | | -| /tmp/pardes-snap/shrinktag/cwd Tty+bash Save Mo -| de Filter Collapse Del +| /tmp/pardes-snap/shrinktag/cwd Tty+bash Save Mod +| e Filter Collapse Del | ls | w.txt == snap shrunk grid=100x31 cursor=4,9 |4: w.txt ls |5: w.txt -|6: /tmp/pardes-snap/shrinktag/cwd Tty+bash Save Mo -|7: de Filter Collapse Del +|6: /tmp/pardes-snap/shrinktag/cwd Tty+bash Save Mod +|7: e Filter Collapse Del |8: ls |9: w.txt |17: @@ -40,8 +40,8 @@ |7: |8: echo one; echo two |9: -|17: /tmp/pardes-snap/shrinktag/cwd Tty+bash Save Mo -|18: de Filter Collapse Del +|17: /tmp/pardes-snap/shrinktag/cwd Tty+bash Save Mod +|18: e Filter Collapse Del |19: ls |20: w.txt == snap bottom-shrunk grid=100x31 cursor=4,9 @@ -49,6 +49,6 @@ |18: |19: |20: -|27: /tmp/pardes-snap/shrinktag/cwd Tty+bash Save Mo -|28: de Filter Collapse Del +|27: /tmp/pardes-snap/shrinktag/cwd Tty+bash Save Mod +|28: e Filter Collapse Del |29: w.txt diff --git a/test/snapshots/splitparent.golden b/test/snapshots/splitparent.golden index f83bbb66..0e870a37 100644 --- a/test/snapshots/splitparent.golden +++ b/test/snapshots/splitparent.golden @@ -1,35 +1,35 @@ == snap shrunk grid=100x31 cursor=4,5 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/splitparent/cwd Tty+bash Save /tmp/pardes-snap/splitparent/cwd Tty+bash Save -| Mode Filter Collapse Del Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/splitparent/cwd Tty+bash Save M /tmp/pardes-snap/splitparent/cwd Tty+bash Save M +| ode Filter Collapse Del ode Filter Collapse Del | ls ls | -| /tmp/pardes-snap/splitparent/cwd Tty+bash Save -| Mode Filter Collapse Del +| /tmp/pardes-snap/splitparent/cwd Tty+bash Save M +| ode Filter Collapse Del | ls == snap swap-parent grid=100x31 cursor=4,13 -|10: /tmp/pardes-snap/splitparent/cwd Tty+bash Save -|11: Mode Filter Collapse Del +|10: /tmp/pardes-snap/splitparent/cwd Tty+bash Save M +|11: ode Filter Collapse Del |12: ls == snap tallest grid=100x6 cursor=4,5 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/splitparent/cwd Tty+bash Save /tmp/pardes-snap/splitparent/cwd Tty+bash Save -| /tmp/pardes-snap/splitparent/cwd Tty+bash Save Mode Filter Collapse Del -| /tmp/pardes-snap/splitparent/cwd Tty+bash Save ls +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/splitparent/cwd Tty+bash Save M /tmp/pardes-snap/splitparent/cwd Tty+bash Save M +| /tmp/pardes-snap/splitparent/cwd Tty+bash Save M ode Filter Collapse Del +| /tmp/pardes-snap/splitparent/cwd Tty+bash Save M ls | e in that column: each keeps its tag and 2 rows == snap regrown grid=100x31 cursor=4,13 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/splitparent/cwd Tty+bash Save /tmp/pardes-snap/splitparent/cwd Tty+bash Save -| Mode Filter Collapse Del Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/splitparent/cwd Tty+bash Save M /tmp/pardes-snap/splitparent/cwd Tty+bash Save M +| ode Filter Collapse Del ode Filter Collapse Del | ls ls | -| /tmp/pardes-snap/splitparent/cwd Tty+bash Save -| Mode Filter Collapse Del +| /tmp/pardes-snap/splitparent/cwd Tty+bash Save M +| ode Filter Collapse Del | ls | -| /tmp/pardes-snap/splitparent/cwd Tty+bash Save -| Mode Filter Collapse Del +| /tmp/pardes-snap/splitparent/cwd Tty+bash Save M +| ode Filter Collapse Del | e in that column: each keeps its tag and 2 rows diff --git a/test/snapshots/stepgrain.golden b/test/snapshots/stepgrain.golden index 7c445492..3101b920 100644 --- a/test/snapshots/stepgrain.golden +++ b/test/snapshots/stepgrain.golden @@ -1,10 +1,10 @@ == snap results grid=150x31 cursor=7,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/stepgrain/cwd/a.txt Save Tty Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/stepgrain/cwd/a.txt Save Tty Collapse Del | 1 hello ZQMARK one | 2 see also sub/b.txt for ZQMARK two -| /tmp/pardes-snap/stepgrain/cwd/+Search Save Tty Collapse Del LocationsConfig +| /tmp/pardes-snap/stepgrain/cwd/+Search Save Tty Collapse LocationsConfig Del | 1 a.txt:1:7-12 | 2 hello ZQMARK one | 3 a.txt:2:24-29 @@ -14,12 +14,12 @@ | 7 == snap step-row1 grid=150x31 cursor=7,6 == style step-row1 grid=150x31 -|0: 0-149 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-149 #becfc4,#314738, -|2: 0-1 d,#496656, 2-2 d,#1d2824, 3-33 #b2c3b8,#1d2824, 34-39 #d3b0d9,#1d2824, 40-149 #b2c3b8,#1d2824, +|0: 0-1 d,#1d2824, 2-149 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-149 #becfc4,#314738, +|2: 0-1 d,#496656, 2-32 #b2c3b8,#1d2824, 33-38 #d3b0d9,#1d2824, 39-149 #b2c3b8,#1d2824, |3: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-149 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-149 #e5eee5,#0d1410, -|5: 0-1 d,#add38a, 2-2 d,#314738, 3-33 #becfc4,#314738, 34-41 #dfbce5,#314738, 42-149 #becfc4,#314738, +|5: 0-1 d,#add38a, 2-32 #becfc4,#314738, 33-40 #dfbce5,#314738, 41-149 #becfc4,#314738, |6: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-18 #f5f7ee,#3c614a, 19-149 #f5f7ee,#0d1410, |7: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-12 #e5eee5,#0d1410, 13-18 #f7e4a5,#5e4923, 19-19 #f7e4a5,#0d1410, 20-149 #e5eee5,#0d1410, |8: 0-0 d,#608269, 1-4 d,#0d1410, 5-149 #59675c,#0d1410, @@ -52,7 +52,7 @@ == snap step-row3 grid=150x31 cursor=7,10 == snap step-wrap grid=150x31 cursor=7,6 == snap blank-in-path grid=150x31 cursor=7,6 -|5: /tmp/pardes-snap/stepgrain/cwd/+Search Save Tty Collapse Del +|5: /tmp/pardes-snap/stepgrain/cwd/+Search Save Tty Collapse Del |6: 1 two words.txt |7: 2 |8: @@ -69,5 +69,5 @@ |11: 0-0 d,#608269, 1-149 d,#0d1410, |12: 0-0 d,#608269, 1-149 d,#0d1410, == snap blank-opened grid=150x31 cursor=7,9 -|8: /tmp/pardes-snap/stepgrain/cwd/two words.txt Save Tty Collapse Del +|8: /tmp/pardes-snap/stepgrain/cwd/two words.txt Save Tty Collapse Del |9: 1 diff --git a/test/snapshots/syntax.golden b/test/snapshots/syntax.golden index 43bfe485..c4f44b86 100644 --- a/test/snapshots/syntax.golden +++ b/test/snapshots/syntax.golden @@ -1,12 +1,12 @@ == snap zig-open grid=150x31 cursor=7,8 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/syntax/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/syntax/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/syntax/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/syntax/cwd Tty+bash Save Mode Filter Collapse Del | ls ls | demo.zig demo.zig | -| /tmp/pardes-snap/syntax/cwd/demo.zig Save Tty Collapse Del TreeContext D -| ef Refs +| /tmp/pardes-snap/syntax/cwd/demo.zig Save Tty Collapse TreeContext Def Re +| fs Del | 1 const std = @import("std"); // greet | 2 pub fn main() void { | 3 var x: u32 = 42; @@ -16,18 +16,18 @@ | | | -| /tmp/pardes-snap/syntax/cwd Tty+bash Save Mode Filter Collapse Del +| /tmp/pardes-snap/syntax/cwd Tty+bash Save Mode Filter Collapse Del | ls | demo.zig == style zig-open grid=150x31 -|0: 0-149 #b2c3b8,#1d2824, -|1: 0-1 d,#887455, 2-2 d,#314738, 3-74 #becfc4,#314738, 75-76 #becfc4,#887455, 77-77 #becfc4,#1d2824, 78-149 #b2c3b8,#1d2824, -|2: 0-1 d,#496656, 2-2 d,#1d2824, 3-30 #b2c3b8,#1d2824, 31-39 #d3b0d9,#1d2824, 40-74 #b2c3b8,#1d2824, 75-76 #b2c3b8,#496656, 77-105 #b2c3b8,#1d2824, 106-114 #d3b0d9,#1d2824, 115-149 #b2c3b8,#1d2824, +|0: 0-1 d,#1d2824, 2-149 #b2c3b8,#1d2824, +|1: 0-1 d,#887455, 2-74 #becfc4,#314738, 75-76 #becfc4,#887455, 77-149 #b2c3b8,#1d2824, +|2: 0-1 d,#496656, 2-29 #b2c3b8,#1d2824, 30-38 #d3b0d9,#1d2824, 39-74 #b2c3b8,#1d2824, 75-76 #b2c3b8,#496656, 77-104 #b2c3b8,#1d2824, 105-113 #d3b0d9,#1d2824, 114-149 #b2c3b8,#1d2824, |3: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |4: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |5: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, -|6: 0-1 d,#add38a, 2-2 d,#314738, 3-30 #becfc4,#314738, 31-39 #dfbce5,#314738, 40-74 #becfc4,#314738, 75-75 #becfc4,#608269, 76-149 #becfc4,#0d1410, -|7: 0-2 d,#314738, 3-74 #becfc4,#314738, 75-75 #becfc4,#608269, 76-149 #becfc4,#0d1410, +|6: 0-1 d,#add38a, 2-29 #becfc4,#314738, 30-38 #dfbce5,#314738, 39-74 #becfc4,#314738, 75-75 #becfc4,#608269, 76-149 #becfc4,#0d1410, +|7: 0-1 d,#314738, 2-74 #becfc4,#314738, 75-75 #becfc4,#608269, 76-149 #becfc4,#0d1410, |8: 0-0 d,#608269, 1-1 d,#0d1410, 2-4 d,#0d1410,b 5-6 #616f64,#0d1410,b 7-18 #e5eee5,#0d1410, 19-25 #c9a7ed,#0d1410, 26-26 #e5eee5,#0d1410, 27-31 #b8d88a,#0d1410, 32-34 #e5eee5,#0d1410, 35-74 #b9f480,#0d1410, 75-75 #b9f480,#608269, 76-149 #b9f480,#0d1410, |9: 0-0 d,#608269, 1-4 d,#0d1410, 5-6 #59675c,#0d1410, 7-10 #e5eee5,#0d1410, 11-13 #c9a7ed,#0d1410, 14-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |10: 0-0 d,#608269, 1-4 d,#0d1410, 5-10 #59675c,#0d1410, 11-23 #e5eee5,#0d1410, 24-25 #f8c082,#0d1410, 26-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, @@ -37,7 +37,7 @@ |14: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, |15: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, |16: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, -|17: 0-1 d,#496656, 2-2 d,#1d2824, 3-30 #b2c3b8,#1d2824, 31-39 #d3b0d9,#1d2824, 40-74 #b2c3b8,#1d2824, 75-75 #b2c3b8,#608269, 76-149 #b2c3b8,#0d1410, +|17: 0-1 d,#496656, 2-29 #b2c3b8,#1d2824, 30-38 #d3b0d9,#1d2824, 39-74 #b2c3b8,#1d2824, 75-75 #b2c3b8,#608269, 76-149 #b2c3b8,#0d1410, |18: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |19: 0-0 d,#608269, 1-1 d,#0d1410, 2-74 #e5eee5,#0d1410, 75-75 #e5eee5,#608269, 76-149 #e5eee5,#0d1410, |20: 0-0 d,#608269, 1-74 d,#0d1410, 75-75 d,#608269, 76-149 d,#0d1410, diff --git a/test/snapshots/tag.golden b/test/snapshots/tag.golden index 0d20859a..6e86f042 100644 --- a/test/snapshots/tag.golden +++ b/test/snapshots/tag.golden @@ -1,7 +1,7 @@ -== snap tag-focus grid=150x31 cursor=36,2 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/tag/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/tag/cwd Tty+bash Save Mode Filter Collapse Del +== snap tag-focus grid=150x31 cursor=35,2 +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/tag/cwd Tty+bash Save Mode Filter Collapse Del /tmp/pardes-snap/tag/cwd Tty+bash Save Mode Filter Collapse Del | ls ls | t.txt t.txt | @@ -16,15 +16,15 @@ | | | -| /tmp/pardes-snap/tag/cwd Tty+bash Save Mode Filter Collapse Del +| /tmp/pardes-snap/tag/cwd Tty+bash Save Mode Filter Collapse Del | ls | t.txt -== snap tag-typed grid=150x31 cursor=42,2 -|2: /tmp/pardes-snap/tag/cwd Tty+bash t.txt Save Mode Filter Collapse Del /tmp/pardes-snap/tag/cwd Tty+bash Save Mode Filter Collapse Del -== snap tag-del grid=150x31 cursor=38,2 -|2: /tmp/pardes-snap/tag/cwd Tty+bash t Save Mode Filter Collapse Del /tmp/pardes-snap/tag/cwd Tty+bash Save Mode Filter Collapse Del +== snap tag-typed grid=150x31 cursor=41,2 +|2: /tmp/pardes-snap/tag/cwd Tty+bash t.txt Save Mode Filter Collapse Del /tmp/pardes-snap/tag/cwd Tty+bash Save Mode Filter Collapse Del +== snap tag-del grid=150x31 cursor=37,2 +|2: /tmp/pardes-snap/tag/cwd Tty+bash t Save Mode Filter Collapse Del /tmp/pardes-snap/tag/cwd Tty+bash Save Mode Filter Collapse Del == snap tag-exit grid=150x31 cursor=4,5 -|2: /tmp/pardes-snap/tag/cwd Tty+bash t.txt Save Mode Filter Collapse Del /tmp/pardes-snap/tag/cwd Tty+bash Save Mode Filter Collapse Del +|2: /tmp/pardes-snap/tag/cwd Tty+bash t.txt Save Mode Filter Collapse Del /tmp/pardes-snap/tag/cwd Tty+bash Save Mode Filter Collapse Del == snap tag-look grid=150x31 cursor=7,7 -|6: /tmp/pardes-snap/tag/cwd/t.txt Save Tty Collapse Del +|6: /tmp/pardes-snap/tag/cwd/t.txt Save Tty Collapse Del |7: 1 ZZLOOKED diff --git a/test/snapshots/tagalign.golden b/test/snapshots/tagalign.golden index a557ff95..0fa4807a 100644 --- a/test/snapshots/tagalign.golden +++ b/test/snapshots/tagalign.golden @@ -1,60 +1,58 @@ == snap aligned grid=100x31 cursor=4,9 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/tagalign/cwd/deep/nested-project-directory/document.txt Save Tty Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/tagalign/cwd/deep/nested-project-directory/document.txt Save Tty Collapse Del | 1 alpha | 2 beta | 3 gamma -| /tmp/pardes-snap/tagalign/cwd Tty+bash Save Mode Filter Collapse Del +| /tmp/pardes-snap/tagalign/cwd Tty+bash Save Mode Filter Collapse Del | ls | deep == snap fits grid=87x31 cursor=4,9 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/tagalign/cwd/deep/nested-project-directory/document.txt Save Tty Co -| llapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/tagalign/cwd/deep/nested-project-directory/document.txt Save Tty Col +| lapse Del | 1 alpha | 2 beta -| /tmp/pardes-snap/tagalign/cwd Tty+bash Save Mode Filter Collapse Del +| /tmp/pardes-snap/tagalign/cwd Tty+bash Save Mode Filter Collapse Del | ls | deep == snap overby1 grid=86x31 cursor=4,9 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/tagalign/cwd/deep/nested-project-directory/document.txt Save Tty C -| ollapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/tagalign/cwd/deep/nested-project-directory/document.txt Save Tty Co +| llapse Del | 1 alpha | 2 beta -| /tmp/pardes-snap/tagalign/cwd Tty+bash Save Mode Filter Collapse Del +| /tmp/pardes-snap/tagalign/cwd Tty+bash Save Mode Filter Collapse Del | ls | deep == snap clicked grid=100x31 cursor=11,2 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/tagalign/cwd/deep/nested-project-directory/document.txt Save Tty Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/tagalign/cwd/deep/nested-project-directory/document.txt Save Tty Collapse Del | 1 alpha | 2 beta | 3 gamma -| /tmp/pardes-snap/tagalign/cwd Tty+bash Save Mode Filter Collapse Del +| /tmp/pardes-snap/tagalign/cwd Tty+bash Save Mode Filter Collapse Del | ls | deep -== snap revealed grid=70x31 cursor=30,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/tagalign/cwd/deep/nested-project-directory/documen -| t.txt Save Tty Collapse Del +== snap revealed grid=70x31 cursor=28,3 +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Deb +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/tagalign/cwd/deep/nested-project-directory/document +| .txt Save Tty Collapse Del | 1 alpha | 2 beta -| /tmp/pardes-snap/tagalign/cwd Tty+bash Save Mode Filter Collapse De -| l +| /tmp/pardes-snap/tagalign/cwd Tty+bash Save Mode Filter Collapse Del | ls | deep -== snap alone grid=70x31 cursor=4,6 -|2: /tmp/pardes-snap/tagalign/cwd Tty+bash Save Mode Filter Collapse De -|3: l -|4: ls -|5: deep +== snap alone grid=70x31 cursor=4,5 +|2: /tmp/pardes-snap/tagalign/cwd Tty+bash Save Mode Filter Collapse Del +|3: ls +|4: deep +|5: |6: |7: |8: -|9: diff --git a/test/snapshots/tagalign2col.golden b/test/snapshots/tagalign2col.golden index 129141b6..6c4b997a 100644 --- a/test/snapshots/tagalign2col.golden +++ b/test/snapshots/tagalign2col.golden @@ -1,26 +1,25 @@ -== snap onecol grid=160x31 cursor=7,4 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/tagalign2col/cwd/deep/proj/document.txt Save Tty Collapse De /tmp/pardes-snap/tagalign2col/cwd Tty+bash Save Mode Filter Collapse Del -| l ls Left -| 1 alpha deep -| 2 beta +== snap onecol grid=160x31 cursor=7,3 +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/tagalign2col/cwd/deep/proj/document.txt Save Tty Collapse Del /tmp/pardes-snap/tagalign2col/cwd Tty+bash Save Mode Filter Collapse Del +| 1 alpha ls Left +| 2 beta deep | 3 gamma -== snap aligned grid=160x31 cursor=4,10 -|3: l ls -|7: /tmp/pardes-snap/tagalign2col/cwd Tty+bash Save Mode Filter Collapse Del -|8: ls -|9: deep -== snap widened grid=160x31 cursor=4,10 -|1: New Tty Find Grep Joincol Delcol ╎ New Tty Find Grep Joincol Delcol -|2: /tmp/pardes-snap/tagalign2col/cwd/deep/proj/document.txt Save Tty Collapse Del ╎ /tmp/pardes-snap/tagalign2col/cwd Tty+bash Save Mode Filt -|3: 1 alpha ╎ er Collapse Del +== snap aligned grid=160x31 cursor=4,9 +|3: 1 alpha ls +|6: /tmp/pardes-snap/tagalign2col/cwd Tty+bash Save Mode Filter Collapse Del +|7: ls +|8: deep +== snap widened grid=160x31 cursor=4,9 +|1: New Tty Find Grep Joincol Delcol ╎ New Tty Find Grep Joincol Delcol +|2: /tmp/pardes-snap/tagalign2col/cwd/deep/proj/document.txt Save Tty Collapse Del ╎ /tmp/pardes-snap/tagalign2col/cwd Tty+bash Save Mode Filte +|3: 1 alpha ╎ r Collapse Del |4: 2 beta ╎ ls |5: 3 gamma ╎ deep -|6: ╎ -|7: /tmp/pardes-snap/tagalign2col/cwd Tty+bash Save Mode Filter Collapse Del ╎ -|8: ls ╎ -|9: deep ╎ +|6: /tmp/pardes-snap/tagalign2col/cwd Tty+bash Save Mode Filter Collapse Del ╎ +|7: ls ╎ +|8: deep ╎ +|9: ╎ |10: ╎ |11: ╎ |12: ╎ diff --git a/test/snapshots/tagbottom.golden b/test/snapshots/tagbottom.golden index 8469c741..ef1bab3a 100644 --- a/test/snapshots/tagbottom.golden +++ b/test/snapshots/tagbottom.golden @@ -1,7 +1,7 @@ == snap boot grid=100x31 cursor=7,3 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del | 1 aaa | 2 bbb | 3 ccc @@ -56,9 +56,9 @@ |26: 25 yyy |27: 26 zzz |28: -|30: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del +|30: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del == snap off grid=100x31 cursor=7,3 -|2: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del +|2: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del |3: 1 aaa |4: 2 bbb |5: 3 ccc @@ -86,7 +86,7 @@ |27: 25 yyy |28: 26 zzz |30: -== snap tag-typed grid=100x31 cursor=74,30 +== snap tag-typed grid=100x31 cursor=73,30 |2: 1 aaa |3: 2 bbb |4: 3 ccc @@ -114,9 +114,9 @@ |26: 25 yyy |27: 26 zzz |28: -|30: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del bottom.txt +|30: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del bottom.txt == snap look-bottom-tag grid=100x31 cursor=7,16 -|15: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del bottom.txt +|15: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del bottom.txt |16: 1 ZZONE |17: 2 ZZTWO |18: @@ -129,11 +129,11 @@ |25: |26: |27: -|30: /tmp/pardes-snap/tagbottom/cwd/bottom.txt Save Tty Collapse Del +|30: /tmp/pardes-snap/tagbottom/cwd/bottom.txt Save Tty Collapse Del == snap body-cursor grid=100x31 cursor=9,6 == snap seam-noop grid=100x31 cursor=12,16 == snap seam-dragged grid=100x31 cursor=12,12 -|11: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del bottom.txt +|11: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del bottom.txt |12: 1 ZZONE |13: 2 ZZTWO |14: @@ -164,7 +164,7 @@ |8: 7 mmm |9: 8 nnn |10: 9 ooo -|11: * /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del bottom.txt +|11: */tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del bottom.txt |12: 1 ZZONE == file cut-buffer aaa @@ -200,9 +200,9 @@ zzz |19: 18 xxx |20: 19 yyy |21: 20 zzz -|30: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del bottom.txt +|30: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del bottom.txt == snap off-again grid=100x31 cursor=7,6 -|2: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del bottom.txt +|2: /tmp/pardes-snap/tagbottom/cwd/top.txt Save Tty Collapse Del bottom.txt |3: 1 aaa |4: 2 bbb |5: 3 ccc diff --git a/test/snapshots/tagbottomimage.golden b/test/snapshots/tagbottomimage.golden index ce6948bf..9f3ff2fd 100644 --- a/test/snapshots/tagbottomimage.golden +++ b/test/snapshots/tagbottomimage.golden @@ -1,11 +1,11 @@ == snap img-top grid=150x31 cursor=11,8 -|Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -| /tmp/pardes-snap/tagbottomimage/cwd Tty+bash Save Mode Filter Collapse Del +| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit +| New Tty Find Grep Joincol Delcol +| /tmp/pardes-snap/tagbottomimage/cwd Tty+bash Save Mode Filter Collapse Del | ls | pic.ppm | -| img petscii:on palette:commodore ascii:on /tmp/pardes-snap/tagbottomimage/cwd/pic.ppm Tty Collapse Del +| img petscii:on palette:commodore ascii:on /tmp/pardes-snap/tagbottomimage/cwd/pic.ppm Tty Collapse Del | 4*🬹~F~N🬰|G🬏▚Y~KF🬴s>T&zZ/🬻iTY=`S~╳bkZR37v🬦🬵d4QHZ8X▛▟ | ^🬪🬛$}DrydNU&wsz=`*r🬒🬓🬳🬟*Y🬴G6🬧f🬮/>t🬧u🬲1Rg1t🬝🬻█ @@ -34,7 +34,7 @@ |2: ls |3: pic.ppm |4: -|5: /tmp/pardes-snap/tagbottomimage/cwd Tty+bash Save Mode Filter Collapse Del +|5: /tmp/pardes-snap/tagbottomimage/cwd Tty+bash Save Mode Filter Collapse Del |6: Tagbottom |7: {DbgY🬲s▜M^#▐FUJ[zNq=🬝g/y╱?V@🬱🬙▌UK╱🬍("🬕KJ8hSo🬝🬻 |8: tX🬆s>🬌`🬵 Date: Wed, 21 Oct 2026 14:35:15 -0300 Subject: Build with Zig 0.17 ghostty, libvaxis and uucode move to ghostty's 0.17 pins, cloud9 to its 0.17 main, SDL to castholm's release-3.4.x (3.4.18), zstbi and tree-sitter to forks with 0.17 build files (see build.zig.zon). A bare zig build copies the binaries into ~/.local/bin (-Dhome-install=false leaves it out): 0.17 keeps the prefix from build scripts. A terminal's edited copy goes when the program clears the screen. tinywin.snap is gone; perf baselines are re-recorded. Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- build.zig | 289 +++++++++++++++----------------- build.zig.zon | 45 ++--- build/snap.zig | 6 +- docs/typ/building.typ | 12 +- docs/typ/install.typ | 2 +- mupdf.zig | 6 +- src/9p_io.zig | 14 +- src/CHANGELOG.md | 8 + src/Layer.zig | 4 +- src/Messages.zig | 14 +- src/TerminalImages.zig | 82 ++++++++- src/builtins.zig | 26 +-- src/colors.zig | 70 ++++---- src/config.zig | 21 ++- src/detached/client.zig | 8 +- src/detached/wire.zig | 39 +++-- src/draw.zig | 22 +-- src/dump.zig | 24 +-- src/esp32p4.zig | 2 +- src/esp32p4/input_rescue.zig | 2 +- src/esp32p4/selftest.zig | 2 +- src/fs.zig | 8 +- src/gui/Post.zig | 14 +- src/gui/gui.zig | 20 +-- src/host_io.zig | 14 +- src/image.zig | 6 +- src/linux/v9fs.zig | 4 +- src/locations.zig | 24 +-- src/look.zig | 6 +- src/lsp/lsp.zig | 2 +- src/lsp/lsp_client.zig | 2 +- src/macos.zig | 26 +-- src/main.zig | 6 + src/memory.zig | 2 +- src/modal.zig | 2 +- src/ninep/addr.zig | 2 +- src/ninep/cols.zig | 10 +- src/ninep/ctl.zig | 14 +- src/ninep/events.zig | 10 +- src/ninep/pane.zig | 11 +- src/ninep/pty.zig | 6 +- src/ninep/screen.zig | 2 +- src/ninep/tree.zig | 16 +- src/normal.zig | 2 +- src/pager.zig | 2 +- src/panes.zig | 2 +- src/pardes.zig | 32 ++-- src/pdf.zig | 10 +- src/regexp.zig | 12 +- src/sam_edit.zig | 2 +- src/syntax.zig | 2 +- src/terminal.zig | 30 +++- src/tty/tty.zig | 22 +-- test/deck/replay.zig | 5 +- test/deck/schema.zig | 10 +- test/e2e_harness.zig | 2 +- test/fs_bench.zig | 4 +- test/history.zig | 10 +- test/hxdiff.zig | 14 +- test/image_harness.zig | 2 +- test/lspbench.zig | 2 +- test/monkey.zig | 2 +- test/panes.zig | 50 +++--- test/pdf.zig | 8 +- test/pdf_scroll_bench.zig | 2 +- test/pdf_sections_bench.zig | 2 +- test/perf-baseline-gui-Debug.json | 1 - test/perf-baseline-gui-debug.json | 1 + test/perf-baseline-tty-Debug.json | 1 - test/perf-baseline-tty-ReleaseFast.json | 1 - test/perf-baseline-tty-debug.json | 1 + test/perf-baseline-tty-fast.json | 1 + test/perf.zig | 15 +- test/snapshot.zig | 40 ++--- test/snapshots/exec.golden | 8 +- test/snapshots/tinywin.golden | 83 --------- test/snapshots/tinywin.snap | 31 ---- test/unit_profile_test.zig | 7 +- tools/gen_themes.zig | 15 +- 80 files changed, 664 insertions(+), 677 deletions(-) delete mode 100644 test/perf-baseline-gui-Debug.json create mode 100644 test/perf-baseline-gui-debug.json delete mode 100644 test/perf-baseline-tty-Debug.json delete mode 100644 test/perf-baseline-tty-ReleaseFast.json create mode 100644 test/perf-baseline-tty-debug.json create mode 100644 test/perf-baseline-tty-fast.json delete mode 100644 test/snapshots/tinywin.golden delete mode 100644 test/snapshots/tinywin.snap (limited to 'docs/typ') diff --git a/README.md b/README.md index 3a566d2a..0a03bdba 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ looks; the keys are helix's; every session is a virtual filesystem, served over 9P, that any program can drive. Get the source with `git clone https://git.sr.ht/~gbrls/pardes && cd pardes` -(also at https://git.0x4200.cafe/pardes). Install with Zig 0.16: +(also at https://git.0x4200.cafe/pardes). Install with Zig 0.17: `zig build -Dplatform=tty --prefix ~/.local` for `pardes` in a terminal, or `-Dplatform=gui` for the `pardes-gui` window. The terminal should report the mouse; Shift-Esc needs the kitty keyboard diff --git a/build.zig b/build.zig index 0246d55f..ddd41a03 100644 --- a/build.zig +++ b/build.zig @@ -59,13 +59,14 @@ pub fn build(b: *std.Build) void { const requested_platform = b.option(Platform, "platform", "which shell to build (tty, gui, web, macos, esp32p4); absent builds the tty cli and the SDL gui together"); const platform = requested_platform orelse .tty; const also_gui = requested_platform == null; - const home_install = also_gui and prefixIsUntouched(b); - if (home_install) { - if (b.graph.environ_map.get("HOME")) |home| { - b.resolveInstallPrefix(b.pathJoin(&.{ home, ".local" }), .{}); - std.debug.print("pardes: installing into {s} (override with --prefix)\n", .{b.install_prefix}); - } - } + // A bare `zig build` also copies the binaries into ~/.local/bin. Zig + // 0.17 keeps the prefix in the maker process, out of this script's + // reach, so `--prefix` no longer turns it off: -Dhome-install=false does. + const home_bin: ?[]const u8 = if (also_gui and (b.option(bool, "home-install", "a bare `zig build` also copies the binaries into ~/.local/bin (default: true)") orelse true)) + if (b.graph.environ_map.get("HOME")) |home| b.pathJoin(&.{ home, ".local", "bin" }) else null + else + null; + const home_install = home_bin != null; const esp32p4_target: std.Target.Query = .{ .cpu_arch = .riscv32, .os_tag = .freestanding, @@ -114,18 +115,18 @@ pub fn build(b: *std.Build) void { const is_web_target = target.result.cpu.arch == .wasm32 and target.result.os.tag == .freestanding; const is_esp32p4_target = target.result.cpu.arch == .riscv32 and target.result.os.tag == .freestanding; const optimize = if (is_web) - .ReleaseSmall - else if (is_esp32p4_target and requested_optimize == .Debug) - .ReleaseFast + .small + else if (is_esp32p4_target and requested_optimize == .debug) + .fast else requested_optimize; const test_build = b.step("test-build", "compile unit-test programs without running them"); const doc_typ_opts = b.addOptions(); - doc_typ_opts.addOption([]const u8, "dir", b.pathFromRoot("docs/typ")); + doc_typ_opts.addOptionPathUntracked("dir", b.path("docs/typ")); // The docs (docs/typ, docs/site): each output is one typst run, and each // reads docs/typ/builtins-*.json; `builtins-json` refreshes this build's from the // registry first (the tool is wired below, once the core module is). - const typst_bin: ?[]const u8 = b.findProgram(&.{"typst"}, &.{}) catch null; + const typst_bin: ?[]const u8 = b.findProgram(.{ .names = &.{"typst"} }); var doc_renders: [3]?*std.Build.Step.Run = @splat(null); const cheatsheet_step = b.step("cheatsheet", "render docs/typ/cheatsheet-a4.typ to /share/doc/pardes/cheatsheet.pdf (needs typst)"); const book_step = b.step("book", "render docs/typ/book.typ to /share/doc/pardes/pardes.pdf (needs typst)"); @@ -139,11 +140,13 @@ pub fn build(b: *std.Build) void { sheet.addFileArg(b.path("docs/typ/cheatsheet-a4.typ")); sheet.has_side_effects = true; cheatsheet_step.dependOn(&b.addInstallFile(sheet.addOutputFileArg("cheatsheet.pdf"), "share/doc/pardes/cheatsheet.pdf").step); - const book = b.addSystemCommand(&.{ typst, "compile", "--ignore-system-fonts", "--root", b.pathFromRoot(".") }); + const book = b.addSystemCommand(&.{ typst, "compile", "--ignore-system-fonts", "--root", "." }); + book.setCwd(b.path(".")); book.addFileArg(b.path("docs/typ/book.typ")); book.has_side_effects = true; book_step.dependOn(&b.addInstallFile(book.addOutputFileArg("pardes.pdf"), "share/doc/pardes/pardes.pdf").step); - const site = b.addSystemCommand(&.{ typst, "compile", "--format", "bundle", "--features", "bundle,html", "--root", b.pathFromRoot(".") }); + const site = b.addSystemCommand(&.{ typst, "compile", "--format", "bundle", "--features", "bundle,html", "--root", "." }); + site.setCwd(b.path(".")); site.addFileArg(b.path("docs/site/site.typ")); const site_dir = site.addOutputDirectoryArg("site"); site.has_side_effects = true; @@ -168,7 +171,7 @@ pub fn build(b: *std.Build) void { .root_source_file = b.path("test/unit_profile.zig"), }), }); - const c_optimize: std.builtin.OptimizeMode = if (optimize == .Debug) .ReleaseFast else optimize; + const c_optimize: std.lang.Optimize = if (optimize == .debug) .fast else optimize; const default_grammars: TreeSitterGrammars = if (is_web) .zig else if (is_esp32p4) .disabled else .full; const requested_grammars = b.option(TreeSitterGrammars, "tree-sitter", "tree-sitter grammar set: disabled, zig, minimal (c/c++/zig), full"); const tree_sitter_grammars = requested_grammars orelse default_grammars; @@ -321,7 +324,7 @@ pub fn build(b: *std.Build) void { .name = "pardes-gen-themes", .root_module = b.createModule(.{ .target = b.graph.host, - .optimize = .Debug, + .optimize = .debug, .root_source_file = b.path("tools/gen_themes.zig"), }), }); @@ -353,7 +356,7 @@ pub fn build(b: *std.Build) void { // `pardes ` alone, like a tarball build; -Dstamp-commit=true // stamps one anyway. const stamp_commit = b.option(bool, "stamp-commit", "embed the git commit in --version and crash records (default: release builds and the ~/.local install)") orelse - (optimize != .Debug or home_install); + (optimize != .debug or home_install); const shell_cfg: ShellConfig = .{ .tree_sitter_grammars = tree_sitter_grammars, .tracy = tracy != null, @@ -391,9 +394,7 @@ pub fn build(b: *std.Build) void { if (tree_sitter_grammars != .disabled) { const tree_sitter_mod = b.dependency("tree_sitter", .{ .target = target, .optimize = c_optimize }).module("tree_sitter"); if (is_web) { - const web_libc_include: std.Build.LazyPath = .{ - .cwd_relative = b.path("src/web/libc/include").getPath(b), - }; + const web_libc_include = b.path("src/web/libc/include"); for (tree_sitter_mod.link_objects.items) |link_object| switch (link_object) { .other_step => |lib| { lib.root_module.link_libc = false; @@ -417,12 +418,11 @@ pub fn build(b: *std.Build) void { (tree_sitter_grammars == .zig and g.tier == .zig)) { const dep = b.dependency(g.dep, .{}); - const query_path = dep.path(g.query); - const query = std.Io.Dir.cwd().readFileAlloc(io, query_path.getPath(b), b.allocator, .limited(0x100000)) catch @panic("read " ++ g.name ++ " highlights"); + const query = configureRead(b, io, dep.builder.root, g.query, 0x100000) catch @panic("read " ++ g.name ++ " highlights"); ts_queries.addOption([]const u8, g.name ++ "_highlights", query); // helix's textobject queries, vendored (vendor/queries); a // grammar without one gets none - const objects = std.Io.Dir.cwd().readFileAlloc(io, b.pathFromRoot("vendor/queries/" ++ g.name ++ "/textobjects.scm"), b.allocator, .limited(0x100000)) catch ""; + const objects = configureRead(b, io, b.root, "vendor/queries/" ++ g.name ++ "/textobjects.scm", 0x100000) catch ""; ts_queries.addOption([]const u8, g.name ++ "_textobjects", objects); const lib = b.addLibrary(.{ @@ -438,8 +438,9 @@ pub fn build(b: *std.Build) void { const ts_cflags = [_][]const u8{ "-fno-sanitize=function", "-DTREE_SITTER_REUSE_ALLOCATOR", + // Relative to the build root, the compiler's working directory. "-include", - b.path("src/tree_sitter_heap.h").getPath(b), + "src/tree_sitter_heap.h", }; lib.root_module.addCSourceFile(.{ .file = dep.path(g.src ++ "/parser.c"), .flags = &ts_cflags }); if (g.scanner) lib.root_module.addCSourceFile(.{ .file = dep.path(g.src ++ "/scanner.c"), .flags = &ts_cflags }); @@ -467,7 +468,7 @@ pub fn build(b: *std.Build) void { // (src/regexp.zig). A bump that moves the anchor stops the build. const mvzr_mod = mvzr: { const dep = b.dependency("mvzr", .{ .target = target, .optimize = optimize }); - const src = std.Io.Dir.cwd().readFileAlloc(io, dep.path("src/mvzr.zig").getPath(b), b.allocator, .limited(1 << 20)) catch @panic("read mvzr"); + const src = configureRead(b, io, dep.builder.root, "src/mvzr.zig", 1 << 20) catch @panic("read mvzr"); const anchor = "fn matchPattern(patt: []const RegOp, sets: []const CharSet, haystack: []const u8, i_in: usize) ?OpMatch {\n"; const at = (std.mem.indexOf(u8, src, anchor) orelse @panic("mvzr's matchPattern changed: redo its step budget in build.zig")) + anchor.len; const spend = @@ -536,7 +537,17 @@ pub fn build(b: *std.Build) void { \\ ; if (std.mem.count(u8, backed, end_anchor) != 1) @panic("mvzr's parser changed: redo its `$` before `|` in build.zig"); - const patched = std.mem.replaceOwned(u8, b.allocator, backed, end_anchor, end_before_alt) catch @panic("OOM"); + var patched = std.mem.replaceOwned(u8, b.allocator, backed, end_anchor, end_before_alt) catch @panic("OOM"); + // Zig 0.17 removed `**`; mvzr still has it (its PR #16 replaces it upstream). + for ([_][3][]const u8{ + .{ "[1]RegOp{.{ .unused = {} }} ** ops", "@splat(.{ .unused = {} })", "1" }, + .{ "[1]CharSet{.{ .low = 0, .hi = 0 }} ** char_sets", "@splat(.{ .low = 0, .hi = 0 })", "1" }, + .{ "\"a\" ** 2048", "&@as([2048]u8, @splat('a'))", "2" }, + .{ "\"12345,\" ** 255", "std.mem.asBytes(&@as([255][6]u8, @splat(\"12345,\".*)))", "1" }, + }) |edit| { + if (std.mem.count(u8, patched, edit[0]) != std.fmt.parseInt(usize, edit[2], 10) catch unreachable) std.debug.panic("mvzr changed at `{s}`: redo its `**` patch in build.zig", .{edit[0]}); + patched = std.mem.replaceOwned(u8, b.allocator, patched, edit[0], edit[1]) catch @panic("OOM"); + } break :mvzr b.createModule(.{ .root_source_file = b.addWriteFiles().add("mvzr.zig", patched), .target = target, .optimize = optimize }); }; @@ -582,6 +593,7 @@ pub fn build(b: *std.Build) void { }); mupdf.linkTo(mupdf_mod); mupdf_mod.addImport("c_heap", c_heap_mod); + mupdf_mod.addImport("pdf_c", b.addTranslateC(.{ .root_source_file = b.path("src/pdf_bridge.h"), .target = target, .optimize = optimize }).createModule()); mupdf_mod.addIncludePath(b.path("src")); mupdf_mod.addCSourceFile(.{ .file = b.path("src/pdf_bridge.c"), @@ -599,12 +611,13 @@ pub fn build(b: *std.Build) void { const pdf_bench_mod = b.createModule(.{ .target = target, - .optimize = .ReleaseFast, + .optimize = .fast, .root_source_file = b.path("src/pdf.zig"), .link_libc = true, }); mupdf.linkTo(pdf_bench_mod); pdf_bench_mod.addImport("c_heap", c_heap_mod); + pdf_bench_mod.addImport("pdf_c", b.addTranslateC(.{ .root_source_file = b.path("src/pdf_bridge.h"), .target = target, .optimize = .fast }).createModule()); pdf_bench_mod.addIncludePath(b.path("src")); pdf_bench_mod.addCSourceFile(.{ .file = b.path("src/pdf_bridge.c"), @@ -614,14 +627,14 @@ pub fn build(b: *std.Build) void { .name = "pardes-pdf-bench", .root_module = b.createModule(.{ .target = target, - .optimize = .ReleaseFast, + .optimize = .fast, .root_source_file = b.path("test/pdf_bench.zig"), .link_libc = true, }), }); pdf_bench.root_module.addImport("mupdf", pdf_bench_mod); const run_pdf_bench = b.addRunArtifact(pdf_bench); - if (b.args) |args| run_pdf_bench.addArgs(args); + run_pdf_bench.addPassthruArgs(); run_pdf_bench.setCwd(b.path(".")); pdf_bench_step.dependOn(&run_pdf_bench.step); @@ -629,7 +642,7 @@ pub fn build(b: *std.Build) void { .name = "pardes-pdf-sections-bench", .root_module = b.createModule(.{ .target = target, - .optimize = .ReleaseFast, + .optimize = .fast, .root_source_file = b.path("test/pdf_sections_bench.zig"), .link_libc = true, }), @@ -637,10 +650,10 @@ pub fn build(b: *std.Build) void { pdf_sections_bench.root_module.addImport("pardes", core_module); pdf_sections_bench.root_module.addImport("mupdf", mupdf_mod); const sections_bench_opts = b.addOptions(); - sections_bench_opts.addOption(bool, "release_fast_core", optimize == .ReleaseFast); + sections_bench_opts.addOption(bool, "release_fast_core", optimize == .fast); pdf_sections_bench.root_module.addOptions("pdf_sections_bench_config", sections_bench_opts); const run_pdf_sections_bench = b.addRunArtifact(pdf_sections_bench); - if (b.args) |args| run_pdf_sections_bench.addArgs(args); + run_pdf_sections_bench.addPassthruArgs(); run_pdf_sections_bench.setCwd(b.path(".")); pdf_sections_bench_step.dependOn(&run_pdf_sections_bench.step); @@ -648,7 +661,7 @@ pub fn build(b: *std.Build) void { .name = "pardes-pdf-pointer-bench", .root_module = b.createModule(.{ .target = target, - .optimize = .ReleaseFast, + .optimize = .fast, .root_source_file = b.path("test/pdf_pointer_bench.zig"), .link_libc = true, }), @@ -656,7 +669,7 @@ pub fn build(b: *std.Build) void { pdf_pointer_bench.root_module.addImport("pardes", core_module); pdf_pointer_bench.root_module.addImport("mupdf", mupdf_mod); const run_pdf_pointer_bench = b.addRunArtifact(pdf_pointer_bench); - if (b.args) |args| run_pdf_pointer_bench.addArgs(args); + run_pdf_pointer_bench.addPassthruArgs(); run_pdf_pointer_bench.setCwd(b.path(".")); pdf_pointer_bench_step.dependOn(&run_pdf_pointer_bench.step); @@ -672,11 +685,11 @@ pub fn build(b: *std.Build) void { pdf_scroll_bench.root_module.addImport("pardes", core_module); pdf_scroll_bench.root_module.addImport("mupdf", mupdf_mod); const scroll_bench_opts = b.addOptions(); - scroll_bench_opts.addOption(bool, "release_fast_core", optimize == .ReleaseFast); + scroll_bench_opts.addOption(bool, "release_fast_core", optimize == .fast); scroll_bench_opts.addOption([]const u8, "core_optimize", @tagName(optimize)); pdf_scroll_bench.root_module.addOptions("pdf_scroll_bench_config", scroll_bench_opts); const run_pdf_scroll_bench = b.addRunArtifact(pdf_scroll_bench); - if (b.args) |args| run_pdf_scroll_bench.addArgs(args); + run_pdf_scroll_bench.addPassthruArgs(); run_pdf_scroll_bench.setCwd(b.path(".")); pdf_scroll_bench_step.dependOn(&run_pdf_scroll_bench.step); } @@ -712,15 +725,13 @@ pub fn build(b: *std.Build) void { // - An X10 mouse report and a kitty graphics reply cut short by a read // wait for their rest: the first became three bytes of text, the // second sliced past its input. - // - A malformed color or clipboard reply is dropped instead of failing - // the parse, which stopped input; so is a byte no UTF-8 starts with. - // - An OSC reply ends at its first terminator: one ended by BEL ran on to - // the next sequence's ESC and left what lay between as text. + // - A byte no UTF-8 starts with is dropped instead of failing the parse, + // which stopped input. (vaxis itself now drops a malformed color or + // clipboard reply and ends an OSC at its first terminator.) // - A device report's fields are sought in the sequence, not past it. // A bump that moves an anchor stops the build. { - const parser_path = vaxis_dep.path("src/Parser.zig").getPath(b); - var src = std.Io.Dir.cwd().readFileAlloc(io, parser_path, b.allocator, .limited(1 << 20)) catch @panic("read vaxis Parser.zig"); + var src = configureRead(b, io, vaxis_dep.builder.root, "src/Parser.zig", 1 << 20) catch @panic("read vaxis Parser.zig"); const edits = [_]struct { anchor: []const u8, with: []const u8, count: usize = 1 }{ .{ .anchor = @@ -731,7 +742,7 @@ pub fn build(b: *std.Build) void { \\ 0x5F => return parseApc(input), \\ // pardes's patch (its build.zig): ESC before a key's sequence is Alt on the key. \\ 0x1B => if (input.len > 2 and (input[2] == '[' or input[2] == 'O')) { - \\ var inner = if (input[2] == '[') parseCsi(input[1..], &self.buf) else parseSs3(input[1..]); + \\ var inner = if (input[2] == '[') parseCsi(input[1..], &self.buf, self.cursor_position_requests) else parseSs3(input[1..]); \\ if (inner.n == 0) return inner; \\ if (inner.event) |*event| switch (event.*) { \\ .key_press, .key_release => |*key| key.mods.alt = true, @@ -765,71 +776,17 @@ pub fn build(b: *std.Build) void { \\ switch (input[2]) { , }, - .{ - .anchor = - \\ const esc_result = skipUntilST(input); - \\ if (esc_result.n > 0) break :blk esc_result.n; - \\ - \\ // No escape, could be BEL terminated - \\ const bel = std.mem.indexOfScalarPos(u8, input, 2, 0x07) orelse return .{ - \\ .event = null, - \\ .n = 0, - \\ }; - \\ bel_terminated = true; - \\ break :blk bel + 1; - , - .with = - \\ // pardes's patch (its build.zig): whichever terminator comes first ends it. - \\ const esc = std.mem.indexOfScalarPos(u8, input, 2, 0x1b); - \\ const bel = std.mem.indexOfScalarPos(u8, input, 2, 0x07); - \\ if (bel != null and (esc == null or bel.? < esc.?)) { - \\ bel_terminated = true; - \\ break :blk bel.? + 1; - \\ } - \\ const esc_result = skipUntilST(input); - \\ if (esc_result.n > 0) break :blk esc_result.n; - \\ return .{ .event = null, .n = 0 }; - , - }, - .{ - .anchor = " const color = try Color.rgbFromSpec(color_spec);\n", - .with = " const color = Color.rgbFromSpec(color_spec) catch return null_event; // pardes's patch (its build.zig)\n", - .count = 2, - }, - .{ - .anchor = - \\ if (input[semicolon_idx + 1] != 'c') return null_event; - \\ const payload = if (bel_terminated) - \\ input[semicolon_idx + 3 .. sequence.len - 1] - \\ else - \\ input[semicolon_idx + 3 .. sequence.len - 2]; - \\ const decoder = std.base64.standard.Decoder; - \\ const text = try paste_allocator.?.alloc(u8, try decoder.calcSizeForSlice(payload)); - \\ try decoder.decode(text, payload); - , - .with = - \\ // pardes's patch (its build.zig): a malformed reply is dropped. - \\ const body_end = if (bel_terminated) sequence.len - 1 else sequence.len - 2; - \\ if (semicolon_idx + 3 > body_end or input[semicolon_idx + 1] != 'c') return null_event; - \\ const payload = input[semicolon_idx + 3 .. body_end]; - \\ const decoder = std.base64.standard.Decoder; - \\ const gpa = paste_allocator orelse return null_event; - \\ const text = gpa.alloc(u8, decoder.calcSizeForSlice(payload) catch return null_event) catch return null_event; - \\ decoder.decode(text, payload) catch { - \\ gpa.free(text); - \\ return null_event; - \\ }; - , - }, .{ .anchor = \\ 'A', 'B', 'C', 'D', 'E', 'F', 'H', 'P', 'Q', 'R', 'S' => { + \\ // Legacy keys \\ , .with = \\ 'A', 'B', 'C', 'D', 'E', 'F', 'H', 'P', 'Q', 'R', 'S' => { \\ // pardes's patch (its build.zig): a cursor position report is no key. \\ if (final == 'R' and cursorReport(sequence)) return null_event; + \\ // Legacy keys \\ , }, @@ -882,8 +839,7 @@ pub fn build(b: *std.Build) void { // (InactiveDim on a focus change) sent every blank of every pane it // touched again: 7 KB a click for three shell panes. The terminal // keeps the old ink there, and so does vaxis's last frame. - const render_path = vaxis_dep.path("src/Vaxis.zig").getPath(b); - var render_src = std.Io.Dir.cwd().readFileAlloc(io, render_path, b.allocator, .limited(1 << 20)) catch @panic("read vaxis Vaxis.zig"); + var render_src = configureRead(b, io, vaxis_dep.builder.root, "src/Vaxis.zig", 1 << 20) catch @panic("read vaxis Vaxis.zig"); const render_anchor = \\ if ((!self.refresh and \\ last.eql(cell) and @@ -941,7 +897,7 @@ pub fn build(b: *std.Build) void { var ghostty_vt_for_snap: ?*std.Build.Module = null; const ghostty_simd = !freestanding_core and (!target.result.os.tag.isDarwin() or b.graph.host.result.os.tag.isDarwin()); - const ghostty_optimize: std.builtin.OptimizeMode = if (optimize == .Debug) .ReleaseSafe else optimize; + const ghostty_optimize: std.lang.Optimize = if (optimize == .debug) .safe else optimize; const ghostty_dep = if (is_esp32p4) null else b.lazyDependency("ghostty", .{ .target = target, .optimize = ghostty_optimize, .simd = ghostty_simd, .@"app-runtime" = .none, .@"emit-xcframework" = false }); if (ghostty_dep) |dep| { const ghostty_vt = dep.module("ghostty-vt"); @@ -1017,6 +973,17 @@ pub fn build(b: *std.Build) void { const sdl_lib = dep.artifact("SDL3"); gm.linkLibrary(sdl_lib); gm.addIncludePath(dep.path("include")); + // gui.zig's `c`: SDL and the font shim, which @cImport gave it before Zig 0.17. + const header = b.addWriteFiles().add("gui_c.h", + \\#define SDL_DISABLE_OLD_NAMES 1 + \\#include + \\#include "font.h" + \\ + ); + const gui_c = b.addTranslateC(.{ .root_source_file = header, .target = target, .optimize = optimize }); + gui_c.addIncludePath(dep.path("include")); + gui_c.addIncludePath(b.path("src/gui")); + gm.addImport("gui_c", gui_c.createModule()); } gm.linkLibrary(freetype.?); // HarfBuzz from source, like FreeType: its FreeType integration @@ -1105,7 +1072,7 @@ pub fn build(b: *std.Build) void { }) |file| web_step.dependOn(&b.addInstallFileWithDir(b.path(file[0]), .{ .custom = "web" }, file[1]).step); const run_web_harness = b.addSystemCommand(&.{ "node", "test/web_harness.mjs" }); - run_web_harness.addArg(b.getInstallPath(.{ .custom = "web" }, "")); + run_web_harness.addDirectoryArg(installed("web")); run_web_harness.step.dependOn(web_step); b.step("web-harness", "run the dependency-free JS/WASM DOM harness").dependOn(&run_web_harness.step); b.getInstallStep().dependOn(web_step); @@ -1149,9 +1116,9 @@ pub fn build(b: *std.Build) void { const min_version = b.fmt("{d}.{d}", .{ macos_min_version.major, macos_min_version.minor }); const swift_mode: []const u8 = switch (optimize) { - .Debug => "-Onone", - .ReleaseSmall => "-Osize", - .ReleaseFast, .ReleaseSafe => "-O", + .debug => "-Onone", + .small => "-Osize", + .fast, .safe => "-O", }; const link = b.addSystemCommand(&.{ "swiftc", swift_mode, "-target", triple, "-import-objc-header" }); @@ -1218,7 +1185,8 @@ pub fn build(b: *std.Build) void { const sign = b.addSystemCommand(&.{ "codesign", "--force", "--sign", macos_identity }); if (!std.mem.eql(u8, macos_identity, "-")) sign.addArgs(&.{ "--options", "runtime", "--timestamp" }); - sign.addArg(b.getInstallPath(.prefix, "pardes.app")); + sign.setCwd(installed("")); + sign.addArg("pardes.app"); sign.has_side_effects = true; sign.step.dependOn(&install_app_bin.step); sign.step.dependOn(&install_plist.step); @@ -1227,8 +1195,8 @@ pub fn build(b: *std.Build) void { app_step.dependOn(&sign.step); const dmg = b.addSystemCommand(&.{ "hdiutil", "create", "-volname", "pardes", "-ov", "-format", "UDZO", "-srcfolder" }); - dmg.addArg(b.getInstallPath(.prefix, "pardes.app")); - dmg.addArg(b.getInstallPath(.prefix, "pardes.dmg")); + dmg.setCwd(installed("")); + dmg.addArgs(&.{ "pardes.app", "pardes.dmg" }); dmg.has_side_effects = true; dmg.step.dependOn(&sign.step); dmg_step.dependOn(&dmg.step); @@ -1267,7 +1235,7 @@ pub fn build(b: *std.Build) void { const run_e2e = std.Build.Step.Run.create(b, "run macos-e2e"); run_e2e.addFileArg(runnable); run_e2e.setCwd(b.path(".")); - if (b.args) |args| run_e2e.addArgs(args); + run_e2e.addPassthruArgs(); run_e2e.has_side_effects = true; e2e_step.dependOn(&run_e2e.step); } else e2e_step.dependOn(&b.addFail("macos-e2e needs a Darwin host and target").step); @@ -1290,7 +1258,7 @@ pub fn build(b: *std.Build) void { .linkage = if (static) .static else null, .root_module = root_mod, }); - b.installArtifact(exe); + installHome(b, exe, home_bin); if (gui_mod) |gm| { var gui_name: []const u8 = "pardes-gui"; if (target.result.os.tag != .linux or target.result.cpu.arch != .x86_64) @@ -1300,7 +1268,7 @@ pub fn build(b: *std.Build) void { .linkage = if (static) .static else null, .root_module = gm, }); - b.installArtifact(gui_exe); + installHome(b, gui_exe, home_bin); } const run = b.addRunArtifact(exe); b.step("run", "descend to the pardes").dependOn(&run.step); @@ -1312,7 +1280,7 @@ pub fn build(b: *std.Build) void { }); const run_iso = b.addRunArtifact(iso_exe); // Something to look at on arrival, read out of the binary itself. - if (b.args) |args| run_iso.addArgs(args) else run_iso.addArg("src/pardes.zig"); + run_iso.addPassthruArgs(); const iso_step = b.step("run-isolated", "descend to a pardes with no host but the terminal"); iso_step.dependOn(&run_iso.step); } @@ -1370,15 +1338,9 @@ pub fn build(b: *std.Build) void { hxdiff.root_module.addImport("pardes", core_module); const run_hxdiff = b.addRunArtifact(hxdiff); run_hxdiff.has_side_effects = true; - if (b.args) |args| run_hxdiff.addArgs(args) else { - run_hxdiff.addArgs(&.{ - "--strict", - "test/hxcases/cases.jsonl", - "test/hxcases/goldens.jsonl", - "test/hxcases/waivers.jsonl", - }); - run_hxdiff.setCwd(b.path(".")); - } + // Bare, it runs the checked-in suite (test/hxdiff.zig). + run_hxdiff.addPassthruArgs(); + run_hxdiff.setCwd(b.path(".")); const hxdiff_step = b.step("hxdiff", "compare Helix results (-- --strict cases reference [waivers]; cases alone emits)"); hxdiff_step.dependOn(&run_hxdiff.step); @@ -1403,16 +1365,8 @@ pub fn build(b: *std.Build) void { const run_hxparity = b.addRunArtifact(hxdiff); run_hxparity.has_side_effects = true; run_hxparity.addArg("--parity"); - if (b.args) |args| run_hxparity.addArgs(args) else { - run_hxparity.addArgs(&.{ - "--strict", - "--waivers", - "test/hxcases/parity-waivers.jsonl", - "test/hxcases/cases.jsonl", - "test/hxcases/parity.jsonl", - }); - run_hxparity.setCwd(b.path(".")); - } + run_hxparity.addPassthruArgs(); + run_hxparity.setCwd(b.path(".")); const hxparity_step = b.step("hxparity", "run the file-vs-pty editing parity suite (-- [--waivers w.jsonl] ...)"); hxparity_step.dependOn(&run_hxparity.step); @@ -1427,21 +1381,21 @@ pub fn build(b: *std.Build) void { .name = "pardes-lspbench", .root_module = b.createModule(.{ .target = target, - .optimize = .ReleaseFast, + .optimize = .fast, .root_source_file = b.path("test/lspbench.zig"), .link_libc = true, }), }); lspbench.root_module.addImport("pardes", core_module); const run_lspbench = b.addRunArtifact(lspbench); - if (b.args) |args| run_lspbench.addArgs(args); + run_lspbench.addPassthruArgs(); run_lspbench.setCwd(b.path(".")); run_lspbench.has_side_effects = true; const lspbench_step = b.step("lspbench", "language-backend latency + feature matrix (-- [--json] [--check] [repo-root]), or one query (-- probe : [arg] [--reps N])"); lspbench_step.dependOn(&run_lspbench.step); const run_lspbench_check = b.addRunArtifact(lspbench); run_lspbench_check.addArg("--check"); - if (b.args) |args| run_lspbench_check.addArgs(args); + run_lspbench_check.addPassthruArgs(); run_lspbench_check.setCwd(b.path(".")); run_lspbench_check.has_side_effects = true; const lspbench_check_step = b.step("lspbench-check", "require every configured language probe to complete correctly"); @@ -1449,12 +1403,12 @@ pub fn build(b: *std.Build) void { const locations_bench_step = b.step("locations-bench", "measure cold/warm result formatting (-Doptimize=ReleaseFast; CSV on stderr)"); - if (optimize != .ReleaseFast) { + if (optimize != .fast) { locations_bench_step.dependOn(&b.addFail("locations-bench requires -Doptimize=ReleaseFast").step); } else { const locations_bench_module = b.createModule(.{ .target = target, - .optimize = .ReleaseFast, + .optimize = .fast, .root_source_file = b.path("test/locations_bench.zig"), .link_libc = true, }); @@ -1465,7 +1419,7 @@ pub fn build(b: *std.Build) void { locations_bench_step.dependOn(&run_locations_bench.step); } - const perf_optimize: std.builtin.OptimizeMode = .ReleaseFast; + const perf_optimize: std.lang.Optimize = .fast; const perf_options = b.addOptions(); const perf_target = std.Target.Query.fromTarget(&target.result); perf_options.addOption(PerfBuild, "identity", .{ @@ -1499,7 +1453,7 @@ pub fn build(b: *std.Build) void { perf.root_module.addOptions("perf_options", perf_options); const run_perf = b.addRunArtifact(perf); run_perf.has_side_effects = true; - if (b.args) |args| run_perf.addArgs(args); + run_perf.addPassthruArgs(); run_perf.setCwd(b.path(".")); const perf_step = b.step("perf", "gesture latency or bounded terminal stress (-- [--json] [--reps N] [--base old.json] [--terminal-mib N])"); perf_step.dependOn(&run_perf.step); @@ -1536,7 +1490,7 @@ pub fn build(b: *std.Build) void { .name = "pardes-fs-bench", .root_module = b.createModule(.{ .target = target, - .optimize = .ReleaseFast, + .optimize = .fast, .root_source_file = b.path("test/fs_bench.zig"), .link_libc = true, }), @@ -1544,7 +1498,7 @@ pub fn build(b: *std.Build) void { fs_bench.root_module.addImport("pardes", core_module); const run_fs_bench = b.addRunArtifact(fs_bench); run_fs_bench.has_side_effects = true; - if (b.args) |args| run_fs_bench.addArgs(args); + run_fs_bench.addPassthruArgs(); run_fs_bench.setCwd(b.path(".")); const fs_bench_step = b.step("fs-bench", "9P filesystem request cost and allocation count (-- [--json] [--reps N])"); fs_bench_step.dependOn(&run_fs_bench.step); @@ -1581,11 +1535,11 @@ pub fn build(b: *std.Build) void { }); syntax_runner.root_module.addImport("syntax", syntax_module); const run_syntax = b.addRunArtifact(syntax_runner); - if (b.args) |args| run_syntax.addArgs(args); + run_syntax.addPassthruArgs(); b.step("syntax", "emit deterministic syntax snapshots").dependOn(&run_syntax.step); const run_syntax_bench = b.addRunArtifact(syntax_runner); run_syntax_bench.addArg("--bench"); - if (b.args) |args| run_syntax_bench.addArgs(args); + run_syntax_bench.addPassthruArgs(); run_syntax_bench.has_side_effects = true; b.step("syntax-bench", "measure highlighting latency and allocations").dependOn(&run_syntax_bench.step); const syntax_test = b.addTest(.{ @@ -1611,7 +1565,7 @@ pub fn build(b: *std.Build) void { // part of fs-test; the long run is manual. const run_monkey9p = b.addSystemCommand(&.{ "python3", "-B", "test/monkey9p.py" }); run_monkey9p.addArtifactArg(exe); - if (b.args) |args| run_monkey9p.addArgs(args); + run_monkey9p.addPassthruArgs(); run_monkey9p.setCwd(b.path(".")); run_monkey9p.has_side_effects = true; b.step("monkey-9p", "random 9P operations checking the documented rules (-- [--seed N]... [--steps M] [--replay F] [--shrink F] [--no-shrink])").dependOn(&run_monkey9p.step); @@ -1622,7 +1576,7 @@ pub fn build(b: *std.Build) void { if (platform == .gui) { const run_monkey_gui = b.addSystemCommand(&.{ "python3", "-B", "test/gui_monkey.py" }); run_monkey_gui.addArtifactArg(exe); - if (b.args) |args| run_monkey_gui.addArgs(args); + run_monkey_gui.addPassthruArgs(); run_monkey_gui.setCwd(b.path(".")); run_monkey_gui.has_side_effects = true; monkey_gui_step.dependOn(&run_monkey_gui.step); @@ -1653,7 +1607,7 @@ pub fn build(b: *std.Build) void { }), }); // Ordinary executable; each launch asks sudo inside its own PTY. - b.installArtifact(v9fs_helper); + installHome(b, v9fs_helper, home_bin); const run_v9fs = b.addSystemCommand(&.{ "python3", "-B", "test/v9fs.py" }); run_v9fs.addArtifactArg(exe); run_v9fs.addArtifactArg(v9fs_helper); @@ -1688,7 +1642,7 @@ pub fn build(b: *std.Build) void { }), }); const run_history = b.addRunArtifact(history); - if (b.args) |args| run_history.addArgs(args); + run_history.addPassthruArgs(); run_history.has_side_effects = true; b.step("history", "compare command output and test/build runtime across jj revisions").dependOn(&run_history.step); @@ -1843,7 +1797,7 @@ pub fn build(b: *std.Build) void { if (unit_match) |check| check.addArtifactArg(shell_test); const run_profile = b.addRunArtifact(unit_profile); run_profile.addArtifactArg(shell_test); - if (b.args) |args| run_profile.addArgs(args); + run_profile.addPassthruArgs(); run_profile.has_side_effects = true; b.step("unit-profile", "report test request time and process memory as JSONL (-- optional filter, --timeout-ms=N)").dependOn(&run_profile.step); const profile_test = b.addExecutable(.{ @@ -1876,19 +1830,38 @@ fn testMatch(b: *std.Build, profiler: *std.Build.Step.Compile, filters: []const return check; } -fn prefixIsUntouched(b: *std.Build) bool { - if (b.dest_dir != null) return false; - const zig_out = b.build_root.join(b.allocator, &.{"zig-out"}) catch @panic("OOM"); - if (!std.mem.eql(u8, b.install_prefix, zig_out)) return false; - return std.mem.eql(u8, b.exe_dir, b.pathJoin(&.{ b.install_path, "bin" })) and - std.mem.eql(u8, b.lib_dir, b.pathJoin(&.{ b.install_path, "lib" })) and - std.mem.eql(u8, b.h_dir, b.pathJoin(&.{ b.install_path, "include" })); +/// Installs `artifact` in the prefix and, given `home_bin`, copies it there +/// too (`install` unlinks first, so a running binary is replaced). +fn installHome(b: *std.Build, artifact: *std.Build.Step.Compile, home_bin: ?[]const u8) void { + b.installArtifact(artifact); + const dir = home_bin orelse return; + const copy = b.addSystemCommand(&.{ "install", "-Dm755" }); + copy.addArtifactArg(artifact); + copy.addArg(b.pathJoin(&.{ dir, artifact.name })); + copy.has_side_effects = true; + b.getInstallStep().dependOn(©.step); +} + +/// A file read while configuring, under a package's root. A dependency's is +/// hash-addressed and never changes under the same pin; this repo's are not +/// tracked one by one, since the configure runs again on every build anyway +/// (findProgram and gitCommit poison its cache). +// ponytail: untracked repo reads; b.dependOnFileContents each one if the configure cache ever stays pure. +fn configureRead(b: *std.Build, io: std.Io, root: std.Build.Cache.Path, sub: []const u8, limit: usize) ![]u8 { + return root.root_dir.handle.readFileAlloc(io, b.pathJoin(&.{ root.subPathOrDot(), sub }), b.allocator, .limited(limit)); +} + +/// `sub` under the install prefix, known only when the build runs. +fn installed(sub: []const u8) std.Build.LazyPath { + return .{ .relative = .{ .base = .install_prefix, .sub_path = sub } }; } fn gitCommit(b: *std.Build) ?[]const u8 { + // HEAD is not a file the configure cache can track. + b.graph.poisonCache(); var code: u8 = 0; const out = b.runAllowFail( - &.{ "git", "-C", b.build_root.path orelse ".", "rev-parse", "--short=12", "HEAD" }, + &.{ "git", "rev-parse", "--short=12", "HEAD" }, &code, .ignore, ) catch return null; @@ -1985,7 +1958,7 @@ fn compileGlsl(b: *std.Build, name: []const u8) std.Build.LazyPath { fn vendoredThemes(b: *std.Build, io: std.Io) []const []const u8 { var count: usize = 0; { - var dir = b.build_root.handle.openDir(io, "vendor/themes", .{ .iterate = true }) catch @panic("open vendor/themes"); + var dir = b.root.root_dir.handle.openDir(io, "vendor/themes", .{ .iterate = true }) catch @panic("open vendor/themes"); defer dir.close(io); var it = dir.iterate(); while (it.next(io) catch @panic("read vendor/themes")) |e| { @@ -1995,7 +1968,7 @@ fn vendoredThemes(b: *std.Build, io: std.Io) []const []const u8 { } const names = b.allocator.alloc([]const u8, count) catch @panic("OOM"); - var dir = b.build_root.handle.openDir(io, "vendor/themes", .{ .iterate = true }) catch @panic("open vendor/themes"); + var dir = b.root.root_dir.handle.openDir(io, "vendor/themes", .{ .iterate = true }) catch @panic("open vendor/themes"); defer dir.close(io); var it = dir.iterate(); var index: usize = 0; diff --git a/build.zig.zon b/build.zig.zon index b1f501fe..a2fc90dd 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -9,52 +9,59 @@ // read-only HTTPS URL is what a manifest can carry. Re-pin with // `zig fetch --save=cloud9 git+https://git.sr.ht/~gbrls/cloud9#`. .cloud9 = .{ - .url = "git+https://git.sr.ht/~gbrls/cloud9#fe9772b178575fcab93de09fc61c2f13db7db1a8", - .hash = "cloud9-0.1.0-yt86qh4qHgC6OpG4gZE9yoQaO8huc5mnQCaqGwuJ0OU1", + .url = "git+https://git.sr.ht/~gbrls/cloud9#d5c37d9122240fe95d308fbe15874e14dd786c5a", + .hash = "cloud9-0.1.0-yt86qnAvHgB1dEWGakukcJ54GZ7J3mv_lm_kApzAuEOY", }, // Pinned to the exact libvaxis commit ghostty is built against, so it // is compatible with ghostty's uucode configuration (the one we share // with it via `external_uucode` in build.zig). .vaxis = .{ - .url = "git+https://github.com/rockorager/libvaxis.git#1dbbe575dff4586fe51e3217aa5c3fecdcbb6089", - .hash = "vaxis-0.6.0-BWNV_CrbCQCscGpzsAlR402rYQ_tV3aAl081c2iRRkka", + .url = "git+https://github.com/rockorager/libvaxis.git#6fd944a27fb3d6f596e981076381a3131f2448b4", + .hash = "vaxis-0.6.0-BWNV_MafDAAEzkVUvrW9NFUqnnMUoeHqrs2mecnD6D7w", }, .ghostty = .{ - .url = "git+https://github.com/ghostty-org/ghostty.git#82e53e3f6e219e0cf0499fe29c82d925ea26cd5e", - .hash = "ghostty-1.3.2-dev-5UdBCzeJJQXw_vG5Hsfx0DYUmF7Exs_9yctijqOIfp7W", + .url = "git+https://github.com/ghostty-org/ghostty.git#521cf2c5d30bd48028ca61546c64e7913764073d", + .hash = "ghostty-1.3.2-dev-5UdBC6WZfwXgQ6HmA5DH6dGNAUqtDMLrhhrHiBX-99J0", }, // Same uucode commit ghostty and vaxis both depend on. We build it // ourselves (with uucode_config.zig) so ghostty-vt and vaxis can share // a single uucode module. See build.zig for the why. .uucode = .{ - .url = "git+https://github.com/jacobsandlund/uucode#2826a37a4562284fdacd8fa029d49509cc9bffcd", - .hash = "uucode-0.2.0-ZZjBPlK5VADj7fdoq7G8LIHzD5o6FSkcBXXrRWr4jnrA", + .url = "git+https://github.com/jacobsandlund/uucode#ea62149739404a73c202b48a33bf6dd2af4bd9b0", + .hash = "uucode-0.2.0-ZZjBPoGFVgCiflJNFc6Io8xzC67B6PA5bUkk4LT0kCxg", }, + // Pivok7's fork: zig-gamedev/zstbi PR #16, "Upgrade to zig 0.17.0" + // (two lines of build.zig). Back to upstream once it is merged. .zstbi = .{ - .url = "git+https://github.com/zig-gamedev/zstbi#3813f5f113b26f644cfa01a30155cc76b3526e91", - .hash = "zstbi-0.11.0-dev-L0Ea_3GWBwAh7m54XX055vwLKPTPij5hyqyeq92MXPE2", + .url = "git+https://github.com/Pivok7/zstbi#bc96f28d341f9c7fb9cbc5dc65aa4c5cf0c8f007", + .hash = "zstbi-0.11.0-dev-L0Ea_3GWBwCpNHVwGU4MPR_oDd0FoQOYNrGodwvJ6Z45", }, - // SDL3 (castholm/SDL zig bindings) — only fetched/compiled when `-Dsdl` - // is set. Lazy so the default vaxis build never touches it. The sdl + // SDL3 (castholm/SDL zig bindings, its release-3.4.x branch for Zig + // 0.17; david-vanderson's fork, pinned before, has no 0.17 build) — only + // fetched/compiled when `-Dsdl` is set. Lazy so the default vaxis build never touches it. The sdl // package resolves its own linux deps from its own build.zig.zon. .sdl = .{ - .url = "git+https://github.com/david-vanderson/SDL#5bbcf665494fe14acadf50601edf6d5f74ebf96a", - .hash = "sdl-0.4.2+3.4.4-SDL--tB1pQFLgwvCakiiOSoZIuVaz6a6-_gOZC66AGRD", + .url = "git+https://github.com/castholm/SDL#dbcb19aa3583c318556ecae3ecbeb29b102d37c5", + .hash = "sdl-0.6.0+3.4.18-SDL--p-gqAGWpnfTLlhs0dgjDtc4P4_CHeNLGY_SX_Fv", .lazy = true, }, // tree-sitter: Zig bindings + the C runtime, plus grammars (parser.c // we link, highlights.scm we read at build time into the ts_queries module). + // pierrelgol's forks of zig-tree-sitter (here) and tree-sitter-c + // (ts_c), which pin a fork of the tree-sitter core: upstream's + // build.zig files still use APIs Zig 0.17 removed. Their diffs touch + // only the build files and tests. Back to upstream once it moves. .tree_sitter = .{ - .url = "git+https://github.com/tree-sitter/zig-tree-sitter#b55d4977d61330390fc733944da06106ff972660", - .hash = "tree_sitter-0.26.0-8heIf3CaAQB4SSumoGzq3gLSz2rkvXxcKFyskRWqDGBz", + .url = "git+https://github.com/pierrelgol/zig-tree-sitter#2ffef82a12d0305e646ade0e67c693cabc661e05", + .hash = "tree_sitter-0.26.0-8heIf1HEAQCVBaR2wlDhGTw16Ttn1bzERVIwlzNcyO6b", }, .ts_rust = .{ .url = "git+https://github.com/tree-sitter/tree-sitter-rust#77a3747266f4d621d0757825e6b11edcbf991ca5", .hash = "N-V-__8AAHJYbgAipcanYj2A6rnj9wtGzjGzANkrOsqiFAxm", }, .ts_c = .{ - .url = "git+https://github.com/tree-sitter/tree-sitter-c#b780e47fc780ddc8da13afa35a3f4ed5c157823d", - .hash = "tree_sitter_c-0.24.2-y5boS-ptQADHoCoVfjGT_nFtFQ5LbomIkW0fxG3_cmdB", + .url = "git+https://github.com/pierrelgol/tree-sitter-c#67949e4c8dc630c18a522919f2bde2e025a0d025", + .hash = "tree_sitter_c-0.24.2-y5boS-htQACe3pz6jHq4tpS8dB6WIo4-zk_ct7lAjvQT", }, .ts_typst = .{ .url = "git+https://github.com/uben0/tree-sitter-typst#13863ddcbaa7b68ee6221cea2e3143415e64aea4", @@ -185,7 +192,7 @@ .lazy = true, }, }, - .minimum_zig_version = "0.16.0", + .minimum_zig_version = "0.17.0", .paths = .{""}, .fingerprint = 0x41dc46101fc764d8, } diff --git a/build/snap.zig b/build/snap.zig index 7aa06884..35a246ad 100644 --- a/build/snap.zig +++ b/build/snap.zig @@ -44,7 +44,7 @@ pub fn addTty(b: *std.Build, opts: struct { const run_snap = b.addRunArtifact(snap); run_snap.addArtifactArg(opts.exe); run_snap.addPrefixedFileArg("--lspmock=", lspmock.getEmittedBin()); - if (b.args) |args| run_snap.addArgs(args); + run_snap.addPassthruArgs(); // scripts fork children and drive real ptys: never cached, never "up to date" run_snap.has_side_effects = true; const snap_step = b.step("snap", "run the snapshot parity suite (-- --update regenerates goldens)"); @@ -63,7 +63,7 @@ pub fn addTty(b: *std.Build, opts: struct { const run_monkey = b.addRunArtifact(monkey); run_monkey.addArtifactArg(snap); run_monkey.addArtifactArg(opts.exe); - if (b.args) |args| run_monkey.addArgs(args); + run_monkey.addPassthruArgs(); run_monkey.has_side_effects = true; b.step("monkey", "random snapshot scripts hunting panics (-- [steps] [--from=N] [--out=DIR])").dependOn(&run_monkey.step); const monkey_tests = b.addTest(.{ .root_module = monkey.root_module }); @@ -101,7 +101,7 @@ pub fn addWeb(b: *std.Build) void { run_web_snap.step.dependOn(&build_web_snap.step); run_web_snap.step.dependOn(&driver_test.step); run_web_snap.has_side_effects = true; - if (b.args) |args| run_web_snap.addArgs(args); + run_web_snap.addPassthruArgs(); b.step("web-snap", "run browser highlighting, touch, Look, resize and scroll checks").dependOn(&run_web_snap.step); b.step("web-e2e", "run the Chrome-driven DOM end-to-end suite").dependOn(&run_web_snap.step); } diff --git a/docs/typ/building.typ b/docs/typ/building.typ index ae2f3a60..8d7524f9 100644 --- a/docs/typ/building.typ +++ b/docs/typ/building.typ @@ -9,7 +9,7 @@ pieces fit. To install it, see #doc("setup", section: "install"). = Platforms -Zig *0.16.0* (`build.zig.zon` pins `minimum_zig_version`). Dependencies are +Zig *0.17.0* (`build.zig.zon` pins `minimum_zig_version`). Dependencies are fetched and pinned by the manifest; the terminal build needs no system package. The SDL shell builds SDL3 and FreeType from source. PDF support builds MuPDF and is on by default (`-Dmupdf=false` drops it). 9P over QUIC @@ -24,10 +24,11 @@ builds MuPDF and is on by default (`-Dmupdf=false` drops it). 9P over QUIC [`zig build -Dplatform=esp32p4`], [a freestanding riscv32 editor object for the ESP32-P4, with a 384 KiB heap], ) -A bare `zig build` installs into `~/.local`; `--prefix ` installs -elsewhere, except `--prefix zig-out`, which counts as no prefix. With -`-Dplatform` the default prefix is `zig-out`, so always pass `-Dplatform` -while developing. Test, benchmark and run steps build what they need +A bare `zig build` installs into the prefix (`zig-out`, or `--prefix +`) and copies the binaries into `~/.local/bin`; `-Dhome-install=false` +leaves that copy out. Zig 0.17 keeps the prefix from the build script, so +`--prefix` alone no longer stops it. With `-Dplatform` nothing is copied, +so always pass `-Dplatform` while developing. Test, benchmark and run steps build what they need without installing. `pardes --version` prints `pardes ` (from `build.zig.zon`), plus the commit for release builds and the `~/.local` install; `pardes --help` lists every flag. @@ -50,6 +51,7 @@ there; its namespace is in `src/esp32p4_gpio.zig`. [`-Djpx`], [bool, `true`: JPEG 2000, and with it scanned PDFs], [`-Dtree-sitter`], [`disabled`, `zig`, `minimal`, `full`; `full` natively, `zig` for web, `disabled` for esp32p4], [`-Dembed-sources`], [bool, `false`: serve the sources under #file("/src")], + [`-Dhome-install`], [bool: a bare `zig build` also copies the binaries into `~/.local/bin`; default true], [`-Dstamp-commit`], [bool: the git commit in `--version` and crash records; on for release builds and the `~/.local` install], [`-Dtheme-animation`], [bool; on except for esp32p4], [`-Dworkspace-tag`], [bool: draw the workspace tag row; on except for macOS, whose menu bar carries it], diff --git a/docs/typ/install.typ b/docs/typ/install.typ index 9758777d..d97d30f7 100644 --- a/docs/typ/install.typ +++ b/docs/typ/install.typ @@ -18,7 +18,7 @@ #let first = project.mirrors.first() #cmd("git clone " + first.clone + " && cd pardes") -With Zig 0.16 (the build fetches everything else; once that is +With Zig 0.17 (the build fetches everything else; once that is downloaded, a first build from a clean cache took 62 seconds on 16 cores): #cmd("# pardes, in a terminal\nzig build -Dplatform=tty --prefix ~/.local") #cmd("# pardes-gui, its own window\nzig build -Dplatform=gui --prefix ~/.local") diff --git a/mupdf.zig b/mupdf.zig index eeadaa5d..761fef92 100644 --- a/mupdf.zig +++ b/mupdf.zig @@ -293,7 +293,7 @@ fn configureModule(module: *std.Build.Module, dependency: *std.Build.Dependency, } fn flatCSources(b: *std.Build, io: std.Io, dependency: *std.Build.Dependency, relative_dir: []const u8) []const []const u8 { - var dir = std.Io.Dir.cwd().openDir(io, dependency.path(relative_dir).getPath(b), .{ .iterate = true }) catch + var dir = dependency.builder.root.root_dir.handle.openDir(io, relative_dir, .{ .iterate = true }) catch std.debug.panic("MuPDF source directory is missing: {s}", .{relative_dir}); defer dir.close(io); @@ -317,9 +317,9 @@ fn flatCSources(b: *std.Build, io: std.Io, dependency: *std.Build.Dependency, re } fn readMakelists(b: *std.Build, io: std.Io, dependency: *std.Build.Dependency) []const u8 { - return std.Io.Dir.cwd().readFileAlloc( + return dependency.builder.root.root_dir.handle.readFileAlloc( io, - dependency.path("Makelists").getPath(b), + "Makelists", b.allocator, .limited(1024 * 1024), ) catch @panic("read MuPDF Makelists"); diff --git a/src/9p_io.zig b/src/9p_io.zig index 18c51ece..27d79b93 100644 --- a/src/9p_io.zig +++ b/src/9p_io.zig @@ -1553,7 +1553,7 @@ test "a socket path too long for sun_path is no listener, and leaves the editor' } else { _ = unsetenv("XDG_RUNTIME_DIR"); }; - const long = "n" ** 120; + const long = &@as([120]u8, @splat('n')); try testing.expect(listen(testing.io, testing.allocator, p, long, "", null, null) == null); try testing.expect(pardes.turn.answer_held == null); try testing.expect(pardes.turn.wake_parked == null); @@ -1567,7 +1567,7 @@ test "a listening editor posts itself into the 9P registry and unposts on stop" _ = try std.fmt.bufPrintSentinel(&directory, "/tmp/pardes-post-XXXXXX", .{}, 0); if (mkdtemp(&directory) == null) return error.TempDirectoryFailed; const dir = std.mem.span(@as([*:0]const u8, &directory)); - const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeZ(u8, std.mem.span(v)) else null; + const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeSentinel(u8, std.mem.span(v), 0) else null; defer { if (old_runtime) |v| { _ = setenv("XDG_RUNTIME_DIR", v, 1); @@ -1628,7 +1628,7 @@ test "Unix TCP and QUIC share one listener through reads writes reconnects and r if (mkdtemp(&directory) == null) return error.TempDirectoryFailed; // What the listener posted and left inside goes with it. defer std.Io.Dir.cwd().deleteTree(testing.io, std.mem.sliceTo(&directory, 0)) catch |err| std.debug.print("deleteTree: {s}\n", .{@errorName(err)}); - const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeZ(u8, std.mem.span(v)) else null; + const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeSentinel(u8, std.mem.span(v), 0) else null; defer { if (old_runtime) |v| { _ = setenv("XDG_RUNTIME_DIR", v, 1); @@ -1749,7 +1749,7 @@ test "a change waits while the editor is out mid-step, a read does not, and the if (mkdtemp(&directory) == null) return error.TempDirectoryFailed; // What the listener posted and left inside goes with it. defer std.Io.Dir.cwd().deleteTree(testing.io, std.mem.sliceTo(&directory, 0)) catch |err| std.debug.print("deleteTree: {s}\n", .{@errorName(err)}); - const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeZ(u8, std.mem.span(v)) else null; + const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeSentinel(u8, std.mem.span(v), 0) else null; defer { if (old_runtime) |v| { _ = setenv("XDG_RUNTIME_DIR", v, 1); @@ -1824,7 +1824,7 @@ test "a held read is answered when the log has news, and a flushed one spends no if (mkdtemp(&directory) == null) return error.TempDirectoryFailed; // What the listener posted and left inside goes with it. defer std.Io.Dir.cwd().deleteTree(testing.io, std.mem.sliceTo(&directory, 0)) catch |err| std.debug.print("deleteTree: {s}\n", .{@errorName(err)}); - const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeZ(u8, std.mem.span(v)) else null; + const old_runtime = if (libc.getenv("XDG_RUNTIME_DIR")) |v| try gpa.dupeSentinel(u8, std.mem.span(v), 0) else null; defer { if (old_runtime) |v| { _ = setenv("XDG_RUNTIME_DIR", v, 1); @@ -2051,7 +2051,7 @@ test "a pane's PARDES_MOUNT is the session's directory under 9ns --mntgen, and u const names = [_][*:0]const u8{ "NINE_MNTGEN", "NINE_MOUNT", "PARDES_MOUNT" }; var saved: [names.len]?[:0]u8 = @splat(null); for (names, &saved) |name, *value| { - if (libc.getenv(name)) |old| value.* = try testing.allocator.dupeZ(u8, std.mem.span(old)); + if (libc.getenv(name)) |old| value.* = try testing.allocator.dupeSentinel(u8, std.mem.span(old), 0); } defer for (names, saved) |name, value| { if (value) |old| { @@ -2073,7 +2073,7 @@ test "9P shell environment states being inside pardes apart from how to reach it const names = [_][*:0]const u8{ "XDG_RUNTIME_DIR", "HOME", "PARDES_PID", "PARDES_9P", "PARDES_PANE" }; var saved: [names.len]?[:0]u8 = @splat(null); for (names, &saved) |name, *value| { - if (libc.getenv(name)) |old| value.* = try testing.allocator.dupeZ(u8, std.mem.span(old)); + if (libc.getenv(name)) |old| value.* = try testing.allocator.dupeSentinel(u8, std.mem.span(old), 0); } defer for (names, saved) |name, value| { if (value) |old| { diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index 4fe0760c..c6c2eadd 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -17,6 +17,14 @@ - A diff paged into a session (`git show | pardes -`) opens its `+Diff` alone; the `+Pager` no longer stays folded under it. +- Built with Zig 0.17. A bare `zig build` still puts the binaries in + `~/.local/bin`, now as a copy beside the prefix, which `--prefix` no + longer prevents; `-Dhome-install=false` does. ghostty, libvaxis, uucode + and SDL (3.4.18) move to their Zig 0.17 versions, and tree-sitter to a + 0.28 development snapshot. +- A terminal's edited copy goes when the program clears the screen, + instead of staying where its rows were. + - n/N follow Helix search registers, counts, wrapping and select mode. `*` sets a search from the selection; `Alt-*` omits word boundaries. The location ring remains as LookNext/LookPrev (Space j n/p). diff --git a/src/Layer.zig b/src/Layer.zig index 7a5fcf7e..ba45bc88 100644 --- a/src/Layer.zig +++ b/src/Layer.zig @@ -51,7 +51,7 @@ cols: u16 = 0, rows: u16 = 0, /// A body's compact rows, from its top. context_rows: u16 = 0, -context_separators: std.bit_set.StaticBitSet(limits.wrap_rows) = .initEmpty(), +context_separators: std.bit_set.StaticBitSet(limits.wrap_rows) = .empty, /// `rows * cols`, row after row. cells: []pardes.Cell = &.{}, cursor: ?struct { x: u16, y: u16, bar: bool = false } = null, @@ -72,7 +72,7 @@ pub fn capacity(layer: *const Layer, metrics: Metrics) u16 { } pub fn setContextLines(layer: *Layer, lines: []const i32) void { - layer.context_separators = .initEmpty(); + layer.context_separators = .empty; const count = @min(lines.len, layer.context_rows); var index: usize = 0; while (index + 1 < count and index < limits.wrap_rows) : (index += 1) { diff --git a/src/Messages.zig b/src/Messages.zig index 2314939f..b67a8402 100644 --- a/src/Messages.zig +++ b/src/Messages.zig @@ -519,20 +519,20 @@ pub fn errorWords(err: anyerror, buf: []u8) []const u8 { /// A ZON parse failure in a person's words: the first error the parser /// found and its line, `line 3: expected ','`. pub fn zonWhy(diag: *const std.zon.parse.Diagnostics, buf: []u8) []const u8 { - var errors = diag.iterateErrors(); - const first = errors.next() orelse return "not valid ZON"; - const loc = first.getLocation(diag); - return std.fmt.bufPrint(buf, "line {d}: {f}", .{ loc.line + 1, first.fmtMessage(diag) }) catch "not valid ZON"; + if (diag.errors.len == 0) return "not valid ZON"; + const first = diag.errors[0]; + return std.fmt.bufPrint(buf, "line {d}: {s}", .{ first.loc.line + 1, first.msg }) catch "not valid ZON"; } test "errors are said in words, and a ZON failure names its line" { var buf: [128]u8 = undefined; try std.testing.expectEqualStrings("file not found", errorWords(error.FileNotFound, &buf)); try std.testing.expectEqualStrings("too large", errorWords(error.FileTooLarge, &buf)); - var diag: std.zon.parse.Diagnostics = .{}; - defer diag.deinit(std.testing.allocator); + var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); + defer arena.deinit(); + var diag: std.zon.parse.Diagnostics = undefined; const T = struct { a: u8 }; - try std.testing.expectError(error.ParseZon, std.zon.parse.fromSliceAlloc(T, std.testing.allocator, ".{\n .a = 1,\n .b = 2 }", &diag, .{})); + try std.testing.expectError(error.ParseZon, std.zon.parse.fromSlice(T, .{ .gpa = std.testing.allocator, .arena = arena.allocator(), .source = ".{\n .a = 1,\n .b = 2 }", .diagnostics = &diag })); try std.testing.expect(std.mem.startsWith(u8, zonWhy(&diag, &buf), "line 3: ")); } diff --git a/src/TerminalImages.zig b/src/TerminalImages.zig index bc1b2ea8..4140813f 100644 --- a/src/TerminalImages.zig +++ b/src/TerminalImages.zig @@ -38,6 +38,72 @@ const GlyphKey = struct { id: u32, generation: u64, src: PixelRect, cols: u16 }; /// left corner (above or left of it is negative). const Rect = struct { x: i64, y: i64, w: i64, h: i64 }; +/// The runs of Kitty placeholder cells between two pins, one row's run at a +/// time, as ghostty's own `kitty.graphics.unicode.placementIterator` gave +/// them before it moved into its RenderState, which pardes does not keep. +const PlaceholderRuns = struct { + rows: ghostty_vt.PageList.RowIterator, + row: ?ghostty_vt.Pin, + /// Where the scan of `row` resumes: a run ended by an incompatible + /// placeholder starts the next one there. + x: usize = 0, + + fn init(top: ghostty_vt.Pin, bottom: ghostty_vt.Pin) PlaceholderRuns { + var rows = top.rowIterator(.right_down, bottom); + const row = rows.next(); + return .{ .rows = rows, .row = row }; + } + + fn next(self: *PlaceholderRuns) ?gfx.unicode.Placement { + while (self.row) |row| { + if (!row.rowAndCell().row.kitty_virtual_placeholder) { + self.advance(); + continue; + } + var run: ?gfx.unicode.IncompletePlacement = null; + var start: usize = 0; + const cells = row.cells(.all); + while (self.x < cells.len) : (self.x += 1) { + const cell = &cells[self.x]; + if (cell.codepoint() != gfx.unicode.placeholder) { + if (run) |done| return complete(row, start, done); + continue; + } + const style = row.style(cell); + const curr: gfx.unicode.IncompletePlacement = .init(&style, row.grapheme(cell) orelse &.{}); + if (run) |*prev| { + if (!prev.append(&curr)) return complete(row, start, prev.*); + } else { + run = curr.start(); + start = self.x; + } + } + self.advance(); + if (run) |done| return complete(row, start, done); + } + return null; + } + + fn advance(self: *PlaceholderRuns) void { + self.row = self.rows.next(); + self.x = 0; + } + + fn complete(row: ghostty_vt.Pin, x: usize, run: gfx.unicode.IncompletePlacement) gfx.unicode.Placement { + var pin = row; + pin.x = @intCast(x); + return .{ + .pin = pin, + .image_id = run.imageId(), + .placement_id = run.placement_id orelse 0, + .col = run.col.?, + .row = run.row.?, + .width = run.width, + .height = 1, + }; + } +}; + pub fn deinit(ti: *TerminalImages, gpa: std.mem.Allocator) void { var conv = ti.converted.valueIterator(); while (conv.next()) |c| gpa.free(c.rgba); @@ -91,7 +157,7 @@ pub fn draw( // Virtual placements: shown through the placeholder cells, one run of // them on a row at a time. The placeholders themselves are not text. - var runs = gfx.unicode.placementIterator(top, bottom); + var runs: PlaceholderRuns = .init(top, bottom); while (runs.next()) |run| { const at = pages.pointFromPin(.viewport, run.pin) orelse continue; const v = at.viewport.y; @@ -104,7 +170,8 @@ pub fn draw( cell.len = 1; } const img = storage.imageById(run.image_id) orelse continue; - const rp = run.renderPlacement(storage, &img, cw, ch) catch continue; + const target = storage.placeholderTarget(run.image_id, run.placement_id) orelse continue; + const rp = run.renderPlacement(&target.placement, &img, cw, ch) catch continue; if (rp.dest_width == 0 or rp.dest_height == 0 or rp.source_width == 0 or rp.source_height == 0) continue; ctx.place(img, .{ .x = rp.source_x, .y = rp.source_y, .w = rp.source_width, .h = rp.source_height }, .{ .x = @as(i64, at.viewport.x) * cw + rp.offset_x, @@ -122,7 +189,8 @@ pub fn draw( const placed = entry.value_ptr.*; const pin = switch (placed.location) { .pin => |pin| pin, - .virtual => continue, + // ponytail: a placement relative to another (P=/Q=, new in ghostty) is not drawn; resolve its chain if a program needs it. + .virtual, .relative => continue, }; const img = storage.images.get(entry.key_ptr.image_id) orelse continue; const at = pages.pointFromPin(.screen, pin.*) orelse continue; @@ -221,7 +289,8 @@ const Ctx = struct { fn pixelsOf(ti: *TerminalImages, gpa: std.mem.Allocator, img: gfx.Image) ?[]const u8 { const n = @as(usize, img.width) * img.height; if (n == 0) return null; - if (img.format == .rgba) return if (img.data.len == n * 4) img.data else null; + const data = img.data.bytes() orelse return null; + if (img.format == .rgba) return if (data.len == n * 4) data else null; const gop = ti.converted.getOrPut(gpa, img.id) catch return null; if (gop.found_existing) { if (gop.value_ptr.generation == img.generation) { @@ -247,10 +316,11 @@ fn convert(gpa: std.mem.Allocator, img: gfx.Image, n: usize) ?[]u8 { .gray => 1, else => return null, }; - if (img.data.len != n * depth) return null; + const data = img.data.bytes() orelse return null; + if (data.len != n * depth) return null; const out = gpa.alloc(u8, n * 4) catch return null; for (0..n) |i| { - const px = img.data[i * depth ..][0..depth]; + const px = data[i * depth ..][0..depth]; out[i * 4 ..][0..4].* = switch (depth) { 3 => .{ px[0], px[1], px[2], 255 }, 2 => .{ px[0], px[0], px[0], px[1] }, diff --git a/src/builtins.zig b/src/builtins.zig index f73c5982..d9cef8c9 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -98,11 +98,11 @@ fn isEnabled(comptime T: type) bool { /// word that is one here, or in no build. pub fn absentWhy(name: []const u8) ?[]const u8 { @setEvalBranchQuota(20000); - inline for (@typeInfo(@This()).@"struct".decls) |d| { - if (comptime @TypeOf(@field(@This(), d.name)) == type) { - const T = @field(@This(), d.name); + inline for (@typeInfo(@This()).@"struct".decl_names) |d| { + if (comptime @TypeOf(@field(@This(), d)) == type) { + const T = @field(@This(), d); if (comptime @typeInfo(T) == .@"struct" and @hasDecl(T, "run") and !isEnabled(T)) { - if (std.mem.eql(u8, d.name, name)) return if (@hasDecl(T, "gui_only")) "GUI-only" else "not in this build"; + if (std.mem.eql(u8, d, name)) return if (@hasDecl(T, "gui_only")) "GUI-only" else "not in this build"; } } } @@ -112,12 +112,12 @@ pub fn absentWhy(name: []const u8) ?[]const u8 { fn manualBuiltinCount() comptime_int { comptime { var count = 0; - for (@typeInfo(@This()).@"struct".decls) |d| { - if (@TypeOf(@field(@This(), d.name)) != type) continue; - const T = @field(@This(), d.name); + for (@typeInfo(@This()).@"struct".decl_names) |d| { + if (@TypeOf(@field(@This(), d)) != type) continue; + const T = @field(@This(), d); if (@typeInfo(T) != .@"struct" or !@hasDecl(T, "run") or !isEnabled(T)) continue; if (@TypeOf(T.run) != fn (Ctx) void) - @compileError(d.name ++ ".run must have signature fn (Ctx) void"); + @compileError(d ++ ".run must have signature fn (Ctx) void"); count += 1; } return count; @@ -129,9 +129,9 @@ fn manualBuiltinList() [manualBuiltinCount()]type { @setEvalBranchQuota(4000); var list: [manualBuiltinCount()]type = undefined; var count = 0; - for (@typeInfo(@This()).@"struct".decls) |d| { - if (@TypeOf(@field(@This(), d.name)) != type) continue; - const T = @field(@This(), d.name); + for (@typeInfo(@This()).@"struct".decl_names) |d| { + if (@TypeOf(@field(@This(), d)) != type) continue; + const T = @field(@This(), d); if (@typeInfo(T) != .@"struct" or !@hasDecl(T, "run") or !isEnabled(T)) continue; list[count] = T; count += 1; @@ -317,7 +317,7 @@ test "Exit over a ctl write or a click names every pane it asks about, a second first.file.?.saved_hash = 0; // edited: what it had is not what it has p.newScratchBelow(p.active); const second = p.panes[p.active].?; - panes.File.setContent(p, &second.file.?, try std.testing.allocator.dupe(u8, "x" ** 120)); + panes.File.setContent(p, &second.file.?, try std.testing.allocator.dupe(u8, &@as([120]u8, @splat('x')))); try std.testing.expect(second.file.?.revision != second.file.?.saved_revision); // A ctl write, or a click through exec (ctl.captured). if (clicked) p.fs.capturing = true else p.fs.no_prompt = true; @@ -341,7 +341,7 @@ test "Exit over a ctl write or a click names every pane it asks about, a second try std.testing.expect(noticed); // Edited since: only that one is named again (acme's rule). p.fs.failure_len = 0; - panes.File.setContent(p, &second.file.?, try std.testing.allocator.dupe(u8, "y" ** 120)); + panes.File.setContent(p, &second.file.?, try std.testing.allocator.dupe(u8, &@as([120]u8, @splat('y')))); try std.testing.expect(p.executeBuiltinLine(p.active, "Exit")); try std.testing.expect(!p.quit); const again = p.fs.failure[0..p.fs.failure_len]; diff --git a/src/colors.zig b/src/colors.zig index 379d1301..dd0d8938 100644 --- a/src/colors.zig +++ b/src/colors.zig @@ -205,7 +205,7 @@ const name_tint_chroma: f32 = 0.06; /// ink where that hue holds, the name reads on its ground (nameTintFloor) /// and it stands off the ink. Null when no colour of the theme will do. fn derivedNameTint(th: *const Theme, ink: [3]u8, ground: [3]u8) ?[3]u8 { - const pal = th.palette orelse [_][3]u8{th.kw} ** 16; + const pal = th.palette orelse @as([16][3]u8, @splat(th.kw)); const sources = [_][3]u8{ th.kw, pal[4], pal[5], pal[6], pal[3], pal[2], pal[1], th.num, th.str, th.box } ++ [_][3]u8{ th.column_box orelse th.num, th.box_dirty orelse th.num, th.sel_bg, th.search_bg orelse th.num } ++ [_][3]u8{ th.diagnostic_info orelse th.num, th.diagnostic_hint orelse th.num, th.diagnostic_warning orelse th.num } ++ @@ -468,28 +468,29 @@ const curated = struct { pub const dark = @import("themes/dark.zig"); }; -fn fold(comptime C: type) [@typeInfo(C).@"struct".decls.len]Theme { +fn fold(comptime C: type) [@typeInfo(C).@"struct".decl_names.len]Theme { comptime { @setEvalBranchQuota(400000); - var out: [@typeInfo(C).@"struct".decls.len]Theme = undefined; - for (@typeInfo(C).@"struct".decls, 0..) |d, i| { + var out: [@typeInfo(C).@"struct".decl_names.len]Theme = undefined; + const theme_info = @typeInfo(Theme).@"struct"; + for (@typeInfo(C).@"struct".decl_names, 0..) |d, i| { var t: Theme = undefined; - const source = @field(C, d.name).theme; - for (@typeInfo(Theme).@"struct".fields) |f| { - @field(t, f.name) = if (f.type == ?Decor and @hasField(@TypeOf(source), f.name)) decor: { + const source = @field(C, d).theme; + for (theme_info.field_names, theme_info.field_types, theme_info.field_attrs) |name, T, attrs| { + @field(t, name) = if (T == ?Decor and @hasField(@TypeOf(source), name)) decor: { // A nested literal is folded field by field too. var decor: Decor = .{}; - const given = @field(source, f.name); - for (@typeInfo(Decor).@"struct".fields) |g| if (@hasField(@TypeOf(given), g.name)) { - @field(decor, g.name) = @field(given, g.name); + const given = @field(source, name); + for (@typeInfo(Decor).@"struct".field_names) |g| if (@hasField(@TypeOf(given), g)) { + @field(decor, g) = @field(given, g); }; break :decor decor; - } else if (@hasField(@TypeOf(source), f.name)) - @field(source, f.name) - else if (f.default_value_ptr) |ptr| - @as(*const f.type, @ptrCast(@alignCast(ptr))).* + } else if (@hasField(@TypeOf(source), name)) + @field(source, name) + else if (attrs.defaultValue(T)) |value| + value else - @compileError("theme " ++ d.name ++ " is missing " ++ f.name); + @compileError("theme " ++ d ++ " is missing " ++ name); } out[i] = t; } @@ -501,7 +502,7 @@ fn fold(comptime C: type) [@typeInfo(C).@"struct".decls.len]Theme { /// takes: a faithful port (`dracula`) keeps the plain name, and helix's /// looser copy of it is still there as `dracula_helix` (the zed ones already /// carry `_zed`). -fn foldImports(comptime ours: anytype, comptime C: type) [@typeInfo(C).@"struct".decls.len]Theme { +fn foldImports(comptime ours: anytype, comptime C: type) [@typeInfo(C).@"struct".decl_names.len]Theme { comptime { @setEvalBranchQuota(400000); var out = fold(C); @@ -514,7 +515,7 @@ fn foldImports(comptime ours: anytype, comptime C: type) [@typeInfo(C).@"struct" pub const themes = fold(curated) ++ foldImports(fold(curated), @import("generated_themes")); /// The first `native_count` of `themes` are pardes's own; the rest imported. -pub const native_count = @typeInfo(curated).@"struct".decls.len; +pub const native_count = @typeInfo(curated).@"struct".decl_names.len; /// The picker's sections (`Themes`), in ring order, each running from /// the theme it names to the next section's; `NextColor` and `Theme` still @@ -677,8 +678,8 @@ pub const ChromeTheme = struct { pub fn interpolate(from: ChromeTheme, to: ChromeTheme, step: u16, steps: u16) ChromeTheme { var out: ChromeTheme = undefined; const t = @as(f32, @floatFromInt(@min(step, steps))) / @as(f32, @floatFromInt(@max(1, steps))); - inline for (@typeInfo(ChromeTheme).@"struct".fields) |field| - @field(out, field.name) = if (step == 0) @field(from, field.name) else if (step >= steps) @field(to, field.name) else mixOklab(@field(from, field.name), @field(to, field.name), t); + inline for (@typeInfo(ChromeTheme).@"struct".field_names) |name| + @field(out, name) = if (step == 0) @field(from, name) else if (step >= steps) @field(to, name) else mixOklab(@field(from, name), @field(to, name), t); return out; } }; @@ -801,14 +802,16 @@ pub fn loadThemeFile(p: *Pardes, generation: u32, bytes: []const u8, animate: bo themeFileError(p, request, error.ThemeFileTooLarge); return false; } - const source = p.gpa.dupeZ(u8, bytes) catch |err| { + const source = p.gpa.dupeSentinel(u8, bytes, 0) catch |err| { themeFileError(p, request, err); return false; }; defer p.gpa.free(source); - var diagnostics: std.zon.parse.Diagnostics = .{}; - defer diagnostics.deinit(p.gpa); - const parsed = std.zon.parse.fromSliceAlloc(Theme, p.gpa, source, &diagnostics, .{}) catch |err| { + // The parse's results live in `arena`; the theme kept owns only its name. + var arena: std.heap.ArenaAllocator = .init(p.gpa); + defer arena.deinit(); + var diagnostics: std.zon.parse.Diagnostics = undefined; + var parsed = std.zon.parse.fromSlice(Theme, .{ .gpa = p.gpa, .arena = arena.allocator(), .source = source, .diagnostics = &diagnostics }) catch |err| { if (err != error.ParseZon) themeFileError(p, request, err) else { // Which line, and what the parser wanted there. var why: [200]u8 = undefined; @@ -817,10 +820,13 @@ pub fn loadThemeFile(p: *Pardes, generation: u32, bytes: []const u8, animate: bo return false; }; if (parsed.name.len == 0 or parsed.name.len > 255) { - std.zon.parse.free(p.gpa, parsed); themeFileError(p, request, error.InvalidThemeName); return false; } + parsed.name = p.gpa.dupe(u8, parsed.name) catch |err| { + themeFileError(p, request, err); + return false; + }; const target_chrome = ChromeTheme.fromTheme(&parsed); if (animate and p.animate_theme_changes) @@ -829,7 +835,7 @@ pub fn loadThemeFile(p: *Pardes, generation: u32, bytes: []const u8, animate: bo p.chrome_animation.snap(target_chrome); const old = p.custom_theme; p.custom_theme = parsed; - if (old) |theme_value| std.zon.parse.free(p.gpa, theme_value); + if (old) |theme_value| p.gpa.free(theme_value.name); var settled: [limits.host_path_cap]u8 = undefined; @memcpy(settled[0..request.path.len], request.path); _ = p.theme_file_loaded.set(settled[0..request.path.len]); @@ -847,7 +853,7 @@ pub fn carryTheme(p: *Pardes, old: *const Pardes, index: bool) !void { const t = old.custom_theme orelse return; var copy = t; copy.name = try p.gpa.dupe(u8, t.name); - if (p.custom_theme) |mine| std.zon.parse.free(p.gpa, mine); + if (p.custom_theme) |mine| p.gpa.free(mine.name); p.custom_theme = copy; _ = p.theme_file_loaded.set(old.theme_file_loaded.get()); } @@ -931,7 +937,7 @@ fn likeness(theme_name: []const u8, name: []const u8) usize { in_order += 1; pos = at + 1; } - const inside: usize = if (name.len > 0 and std.ascii.indexOfIgnoreCase(theme_name, name) != null) name.len * 4 else 0; + const inside: usize = if (name.len > 0 and std.ascii.findIgnoreCase(theme_name, name) != null) name.len * 4 else 0; return prefix * 3 + in_order + inside; } @@ -952,7 +958,7 @@ pub fn setThemeIndex(p: *Pardes, index: usize) void { p.chrome_animation.snap(target_chrome); if (p.custom_theme) |theme_value| { p.custom_theme = null; - std.zon.parse.free(p.gpa, theme_value); + p.gpa.free(theme_value.name); } p.theme_file_loaded.clear(); if (p.theme_file_path.get().len > 0) { @@ -1264,10 +1270,12 @@ test "legacy ThemeFile documents inherit Pardes UI roles without new fields" { rest = rest[at + std.mem.indexOfScalar(u8, rest[at..], '}').? + 1 ..]; rest = std.mem.trimStart(u8, rest, " ,"); } - const source = try std.testing.allocator.dupeZ(u8, legacy.items); + const source = try std.testing.allocator.dupeSentinel(u8, legacy.items, 0); defer std.testing.allocator.free(source); - const parsed = try std.zon.parse.fromSliceAlloc(Theme, std.testing.allocator, source, null, .{}); - defer std.zon.parse.free(std.testing.allocator, parsed); + var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); + defer arena.deinit(); + var diagnostics: std.zon.parse.Diagnostics = undefined; + const parsed = try std.zon.parse.fromSlice(Theme, .{ .gpa = std.testing.allocator, .arena = arena.allocator(), .source = source, .diagnostics = &diagnostics }); try std.testing.expectEqual(@as(?[3]u8, null), parsed.tag_active_bg); try std.testing.expectEqual(@as(?[3]u8, null), parsed.tag_name_fg); try std.testing.expectEqual(@as(?[3]u8, null), parsed.tag_active_name_fg); diff --git a/src/config.zig b/src/config.zig index 50009660..8166954d 100644 --- a/src/config.zig +++ b/src/config.zig @@ -2170,10 +2170,12 @@ pub const User = struct { defer gpa.free(one_path); const bytes = try std.Io.Dir.cwd().readFileAlloc(io, one_path, gpa, .limited(4096)); defer gpa.free(bytes); - const source = try gpa.dupeZ(u8, bytes); + const source = try gpa.dupeSentinel(u8, bytes, 0); defer gpa.free(source); - const parsed = try std.zon.parse.fromSliceAlloc(Sample, gpa, source, null, .{}); - defer std.zon.parse.free(gpa, parsed); + var arena: std.heap.ArenaAllocator = .init(gpa); + defer arena.deinit(); + var diagnostics: std.zon.parse.Diagnostics = undefined; + const parsed = try std.zon.parse.fromSlice(Sample, .{ .gpa = gpa, .arena = arena.allocator(), .source = source, .diagnostics = &diagnostics }); try std.testing.expectEqualStrings("one", parsed.name); try std.testing.expectEqual([3]u8{ 1, 2, 3 }, parsed.rgb); } @@ -2239,25 +2241,26 @@ const doc_typ = struct { fn hasChordField(T: type) bool { if (@typeInfo(T) != .array or @typeInfo(@typeInfo(T).array.child) != .@"struct") return false; - for (@typeInfo(@typeInfo(T).array.child).@"struct".fields) |f| if (f.type == Chord) return true; + for (@typeInfo(@typeInfo(T).array.child).@"struct".field_types) |F| if (F == Chord) return true; return false; } /// Bound somewhere in this file: a binding, a prefix or a key list. fn bound(c: Chord) bool { const config = @import("config.zig"); - inline for (@typeInfo(config).@"struct".decls) |d| { - const v = @field(config, d.name); + inline for (@typeInfo(config).@"struct".decl_names) |d| { + const v = @field(config, d); const T = @TypeOf(v); if (T == []const Chord) { for (v) |b| if (same(b, c)) return true; } else if (T == comptime_int or T == u21 or T == u8) { // a prefix or a bare key; only the tty toggle carries Ctrl - const plain = !c.alt and !c.shift and (!c.ctrl or comptime std.mem.indexOf(u8, d.name, "toggle") != null); + const plain = !c.alt and !c.shift and (!c.ctrl or comptime std.mem.indexOf(u8, d, "toggle") != null); if (plain and v >= 0x20 and v < 0x7f and v == c.cp) return true; } else if (comptime hasChordField(T)) { - for (v) |e| inline for (@typeInfo(@TypeOf(e)).@"struct".fields) |f| - if (f.type == Chord and same(@field(e, f.name), c)) return true; + const info = @typeInfo(@TypeOf(v[0])).@"struct"; + for (v) |e| inline for (info.field_names, info.field_types) |name, F| + if (F == Chord and same(@field(e, name), c)) return true; } } return false; diff --git a/src/detached/client.zig b/src/detached/client.zig index 69ab2fdd..cf1842d9 100644 --- a/src/detached/client.zig +++ b/src/detached/client.zig @@ -1182,12 +1182,12 @@ test "detached session: a frontend is never asked to fork, write, or watch" { // One: the union a frontend decodes into has no other variant. Named // rather than counted, so re-adding `spawn` fails with the name in it. - const fields = @typeInfo(wire.ServerMsg).@"union".fields; - inline for (fields) |f| { + const fields = @typeInfo(wire.ServerMsg).@"union".field_names; + inline for (fields) |name| { for (allowed) |ok| { - if (std.mem.eql(u8, f.name, ok)) break; + if (std.mem.eql(u8, name, ok)) break; } else { - std.debug.print("ServerMsg.{s} is not an effect a frontend may perform\n", .{f.name}); + std.debug.print("ServerMsg.{s} is not an effect a frontend may perform\n", .{name}); return error.MachineLocalEffectOnTheWire; } } diff --git a/src/detached/wire.zig b/src/detached/wire.zig index c9d9b578..f1b7a1b3 100644 --- a/src/detached/wire.zig +++ b/src/detached/wire.zig @@ -20,9 +20,10 @@ const chrome_layout: u64 = 0x5e758b47fb0cf8da; comptime { @setEvalBranchQuota(10_000); var hash = std.hash.Fnv1a_64.init(); - for (@typeInfo(pardes.Chrome).@"struct".fields) |field| { - hash.update(field.name); - hash.update(@typeName(field.type)); + const info = @typeInfo(pardes.Chrome).@"struct"; + for (info.field_names, info.field_types) |name, T| { + hash.update(name); + hash.update(@typeName(T)); } if (hash.final() != chrome_layout) @compileError(std.fmt.comptimePrint("pardes.Chrome changed (layout 0x{x}): bump wire.version, then chrome_layout", .{hash.final()})); } @@ -285,21 +286,22 @@ pub const Frame = struct { region.clip > region.rect.w or region.thumb_y > region.rect.h or region.thumb_h > region.rect.h - region.thumb_y) return error.BadValue; regions.appendAssumeCapacity(region); } - inline for (@typeInfo(pardes.Chrome).@"struct".fields) |field| { - const rgb = &@field(chrome, field.name); - if (field.type == ?[3]u8) { + const info = @typeInfo(pardes.Chrome).@"struct"; + inline for (info.field_names, info.field_types) |name, T| { + const rgb = &@field(chrome, name); + if (T == ?[3]u8) { if (try r.getBool()) { rgb.* = .{ 0, 0, 0 }; for (&rgb.*.?) |*channel| channel.* = try r.getByte(); } - } else if (field.type == u8) { + } else if (T == u8) { rgb.* = try r.getByte(); - } else if (field.type == u32) { + } else if (T == u32) { rgb.* = try r.getU32(); - } else if (field.type == f32) { + } else if (T == f32) { rgb.* = @bitCast(try r.getU32()); if (!std.math.isFinite(rgb.*)) return error.BadValue; - } else if (field.type == [8]f32) { + } else if (T == [8]f32) { for (rgb) |*value| { value.* = @bitCast(try r.getU32()); if (!std.math.isFinite(value.*)) return error.BadValue; @@ -781,7 +783,7 @@ pub fn layersBound(layers: []const pardes.Layer, tags: []const pardes.Layer, reg const region_len = 1 + 1 + 4 + 8 + 1 + 2 + 2 + 1 + 2 + 4 + 4; /// The palette: each colour three bytes, a theme's optional ones a flag /// before them. -const chrome_len = @typeInfo(pardes.Chrome).@"struct".fields.len * 4 + 8 * 4; +const chrome_len = @typeInfo(pardes.Chrome).@"struct".field_names.len * 4 + 8 * 4; pub fn encodeFrameLayers(out: []u8, cols: u16, rows: u16, cursor: ?Cursor, pointer_shape: pardes.Surface.PointerShape, cells: []const pardes.Cell, prev: []const pardes.Cell, layers: []const pardes.Layer, tags: []const pardes.Layer, regions: []const pardes.Region, chrome: pardes.Chrome) Error![]const u8 { // The protocol's ceiling, enforced by the ENCODER too, and BEFORE the @@ -865,18 +867,19 @@ pub fn encodeFrameLayers(out: []u8, cols: u16, rows: u16, cursor: ?Cursor, point try w.putU32(@bitCast(region.lift)); try w.putU32(@bitCast(region.line)); } - inline for (@typeInfo(pardes.Chrome).@"struct".fields) |field| { - const rgb = @field(chrome, field.name); - if (field.type == ?[3]u8) { + const info = @typeInfo(pardes.Chrome).@"struct"; + inline for (info.field_names, info.field_types) |name, T| { + const rgb = @field(chrome, name); + if (T == ?[3]u8) { try w.putBool(rgb != null); if (rgb) |value| for (value) |channel| try w.putByte(channel); - } else if (field.type == u8) { + } else if (T == u8) { try w.putByte(rgb); - } else if (field.type == u32) { + } else if (T == u32) { try w.putU32(rgb); - } else if (field.type == f32) { + } else if (T == f32) { try w.putU32(@bitCast(rgb)); - } else if (field.type == [8]f32) { + } else if (T == [8]f32) { for (rgb) |value| try w.putU32(@bitCast(value)); } else for (rgb) |channel| try w.putByte(channel); } diff --git a/src/draw.zig b/src/draw.zig index b35d55e8..e6420ed4 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -1598,7 +1598,7 @@ test "a tag of three rows has its grip on the first, and band under it that stil test "place puts every part where the painters and layers put it, in every layout" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 30 }); defer p.deinit(); - _ = try p.setTestFile("placed\n" ** 80); + _ = try p.setTestFile(std.mem.asBytes(&@as([80][7]u8, @splat("placed\n".*)))); p.newColumn(0); p.newScratchIn(0, p.activeColumn().?); p.newScratchBelow(0); @@ -1713,7 +1713,7 @@ test "a notice wider than its band, as a shader's compile error is, draws its en _ = try p.setTestFile("text\n"); var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); - const long = "Shader /home/someone/shaders/test_shadertoy_invalid.glsl: error: Linking fragment stage: No function definition (body) found: " ** 3; + const long = std.mem.asBytes(&@as([3][126]u8, @splat("Shader /home/someone/shaders/test_shadertoy_invalid.glsl: error: Linking fragment stage: No function definition (body) found: ".*))); for ([_][]const u8{ "Msg " ++ long, "" }) |line| { // The Msg builtin, and the path a failed compile takes (Post.zig). if (line.len > 0) try std.testing.expect(p.executeBuiltinLine(p.active, line)) else p.setMessage(p.active, long); @@ -1952,7 +1952,7 @@ test "the focused cursor glides a jump, lands a step at once, and is exact at re if (!builtins.capabilities.lift) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 30 }); defer p.deinit(); - _ = try p.setTestFile("some text on a line\n" ** 20); + _ = try p.setTestFile(std.mem.asBytes(&@as([20][20]u8, @splat("some text on a line\n".*)))); p.settings.cursor_blink = false; var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); @@ -2078,7 +2078,7 @@ test "a terminal's cursor lands with scrolling output, never gliding against it" defer arena.deinit(); const ms = std.time.ns_per_ms; var now: u64 = std.time.ns_per_s; - p.update(.{ .output = .{ .pane = @intCast(term), .bytes = "line\r\n" ** 20 ++ "$ some command typed" } }); + p.update(.{ .output = .{ .pane = @intCast(term), .bytes = std.mem.asBytes(&@as([20][6]u8, @splat("line\r\n".*))) ++ "$ some command typed" } }); p.advance(now); _ = try p.render(arena.allocator()); // Enter: three lines of output scroll up, the cursor to a new prompt. @@ -2101,10 +2101,10 @@ test "a monkey over notices, prompts, tags and tiny panes at a gui's metrics nev const random = prng.random(); const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 24 }); defer p.deinit(); - _ = try p.setTestFile("fuzz\n\u{754c}\u{754c} wide\n" ** 20); + _ = try p.setTestFile(std.mem.asBytes(&@as([20][17]u8, @splat("fuzz\n\u{754c}\u{754c} wide\n".*)))); var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); - const words = [_][]const u8{ "error:", "\u{754c}", "x", "Shader /tmp/a.glsl:", "e\u{301}", "\t", "long-" ** 20, " " }; + const words = [_][]const u8{ "error:", "\u{754c}", "x", "Shader /tmp/a.glsl:", "e\u{301}", "\t", std.mem.asBytes(&@as([20][5]u8, @splat("long-".*))), " " }; const commands = [_][]const u8{ "New", "Newcol", "Collapse", "Tagbottom", "TreeContext", "Wrap", "Find", "Del", "FocusTint", "Debug" }; var text: std.ArrayListUnmanaged(u8) = .empty; defer text.deinit(std.testing.allocator); @@ -2143,7 +2143,7 @@ test "a monkey over notices, prompts, tags and tiny panes at a gui's metrics nev // A tag of several rows. 5 => if (p.panes[p.active]) |pane| { text.clearRetainingCapacity(); - for (0..random.uintAtMost(usize, 5)) |_| try text.appendSlice(std.testing.allocator, if (random.boolean()) " Look\nmore \u{754c}" else "\n" ++ "x" ** 150); + for (0..random.uintAtMost(usize, 5)) |_| try text.appendSlice(std.testing.allocator, if (random.boolean()) " Look\nmore \u{754c}" else "\n" ++ &@as([150]u8, @splat('x'))); if (pane.tag.own) |own| std.testing.allocator.free(own); pane.tag.own = try std.testing.allocator.dupe(u8, text.items); }, @@ -2173,7 +2173,7 @@ test "a wide glyph cut by a tag's or a notice's edge is joined into the grid as defer arena.deinit(); const pane = p.panes[p.active].?; // Both alignments, so one of them puts a wide glyph across each edge. - for ([_][]const u8{ "\u{754c}" ** 30, "x" ++ "\u{754c}" ** 30 }) |wide| { + for ([_][]const u8{ std.mem.asBytes(&@as([30][3]u8, @splat("\u{754c}".*))), "x" ++ std.mem.asBytes(&@as([30][3]u8, @splat("\u{754c}".*))) }) |wide| { if (pane.tag.own) |own| std.testing.allocator.free(own); pane.tag.own = try std.testing.allocator.dupe(u8, wide); var message: [200]u8 = undefined; @@ -2201,7 +2201,7 @@ test "a body with context rows is painted once, and the grid's rows are what a p if (comptime !@import("syntax.zig").enabled) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 60, .rows = 16 }); defer p.deinit(); - const pane = try p.setTestFile("pub const Box = struct {\n pub fn run() void {\n" ++ (" // body line\n" ** 30) ++ " }\n};\n"); + const pane = try p.setTestFile("pub const Box = struct {\n pub fn run() void {\n" ++ (std.mem.asBytes(&@as([30][21]u8, @splat(" // body line\n".*)))) ++ " }\n};\n"); p.gpa.free(pane.file.?.path); pane.file.?.path = try p.gpa.dupe(u8, "/test.zig"); if (!panes.File.supportsContext(pane)) return error.SkipZigTest; @@ -2250,7 +2250,7 @@ test "a body with context rows is painted once, and the grid's rows are what a p /// Two columns, the file in the left one and a shell in the right, the /// right one focused with its cursor settled. fn twoColumns(p: *Pardes, arena: *std.heap.ArenaAllocator) !void { - _ = try p.setTestFile("some text on a line\n" ** 6); + _ = try p.setTestFile(std.mem.asBytes(&@as([6][20]u8, @splat("some text on a line\n".*)))); _ = try p.newShell(1, ""); try std.testing.expect(layout.splitColumn(p, 0, 1, false)); p.sync(); @@ -2386,7 +2386,7 @@ test "a pane focus reaches brightens on the same spring the one it leaves dims o if (!builtins.capabilities.lift) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 24 }); defer p.deinit(); - _ = try p.setTestFile("some text on a line\n" ** 4); + _ = try p.setTestFile(std.mem.asBytes(&@as([4][20]u8, @splat("some text on a line\n".*)))); p.newScratchBelow(0); p.settings.inactive_dim = 40; p.settings.motion = .smooth; diff --git a/src/dump.zig b/src/dump.zig index 402918c4..545d09ec 100644 --- a/src/dump.zig +++ b/src/dump.zig @@ -421,9 +421,9 @@ pub const Parsed = struct { pub fn check(gpa: std.mem.Allocator, bytes: []const u8, why: []u8) !void { var arena: std.heap.ArenaAllocator = .init(gpa); defer arena.deinit(); - const source = try arena.allocator().dupeZ(u8, bytes); - var diag: std.zon.parse.Diagnostics = .{}; - const state = std.zon.parse.fromSliceAlloc(State, arena.allocator(), source, &diag, .{ .free_on_error = false }) catch |err| { + const source = try arena.allocator().dupeSentinel(u8, bytes, 0); + var diag: std.zon.parse.Diagnostics = undefined; + const state = std.zon.parse.fromSlice(State, .{ .gpa = gpa, .arena = arena.allocator(), .source = source, .diagnostics = &diag }) catch |err| { const said = pardes.Messages.zonWhy(&diag, why[0 .. why.len - 1]); if (said.ptr != why.ptr) @memcpy(why[0..said.len], said); why[said.len] = 0; @@ -436,21 +436,13 @@ pub fn readZon(gpa: std.mem.Allocator, bytes: []const u8, label: []const u8) !Pa var parsed: Parsed = .{ .value = undefined, .arena = .init(gpa) }; errdefer parsed.deinit(); const arena = parsed.arena.allocator(); - const source = try gpa.dupeZ(u8, bytes); + const source = try gpa.dupeSentinel(u8, bytes, 0); defer gpa.free(source); - parsed.value = if (builtin.os.tag == .emscripten or builtin.os.tag == .freestanding) - std.zon.parse.fromSliceAlloc(State, arena, source, null, .{ .free_on_error = false }) catch |err| { - if (err == error.ParseZon) log.err("parse dump {s}: {s}", .{ label, @errorName(err) }); - return err; - } - else blk: { - var diag: std.zon.parse.Diagnostics = .{}; - defer diag.deinit(arena); - break :blk std.zon.parse.fromSliceAlloc(State, arena, source, &diag, .{ .free_on_error = false }) catch |err| { - if (err == error.ParseZon) log.err("parse dump {s}: {f}", .{ label, diag }); - return err; - }; + var diag: std.zon.parse.Diagnostics = undefined; + parsed.value = std.zon.parse.fromSlice(State, .{ .gpa = gpa, .arena = arena, .source = source, .diagnostics = &diag }) catch |err| { + if (err == error.ParseZon) log.err("{f}", .{diag.fmt(label)}); + return err; }; try validate(parsed.value); return parsed; diff --git a/src/esp32p4.zig b/src/esp32p4.zig index 6772e75d..ed18efd9 100644 --- a/src/esp32p4.zig +++ b/src/esp32p4.zig @@ -506,7 +506,7 @@ fn apply(c: *pardes.Pardes, ev: vaxis.Event) void { c.update(.pointer_leave); dirty = true; }, - .focus_in, .mouse_leave => {}, + .focus_in, .mouse_leave, .cursor_position => {}, // Capability replies. vaxis's own Loop sets these fields directly (`Loop.zig:377-403`); // with no Loop, this is where they land. DA1 is the terminator: every terminal answers it // last, so it is the signal that the whole handshake is in and the detected features can be diff --git a/src/esp32p4/input_rescue.zig b/src/esp32p4/input_rescue.zig index ba6974d2..d7556d46 100644 --- a/src/esp32p4/input_rescue.zig +++ b/src/esp32p4/input_rescue.zig @@ -245,7 +245,7 @@ test "a long transmit does not lose the input that arrives during it" { defer port.sent.deinit(std.testing.allocator); var ring: Ring = .{}; - const frame = "\x1b[1;1H" ++ "x" ** 400; + const frame = "\x1b[1;1H" ++ &@as([400]u8, @splat('x')); try std.testing.expectEqual(@as(u32, 0), pump(&port, &ring, frame, 1_000_000)); // Every output byte went out, in order. diff --git a/src/esp32p4/selftest.zig b/src/esp32p4/selftest.zig index 97b43059..19b71e90 100644 --- a/src/esp32p4/selftest.zig +++ b/src/esp32p4/selftest.zig @@ -270,7 +270,7 @@ export fn zig_main() noreturn { const typed = "the quick brown fox jumps over the lazy dog, and then some more besides"; var port: FakePort = .{ .tx_cap = 2, .incoming = typed }; var ring: input_rescue.Ring = .{}; - const frame = "\x1b[1;1H" ++ "x" ** 300; + const frame = "\x1b[1;1H" ++ &@as([300]u8, @splat('x')); const abandoned = input_rescue.pump(&port, &ring, frame, 1_000_000); check("the frame went out whole", abandoned == 0 and port.sent == frame.len); diff --git a/src/fs.zig b/src/fs.zig index fb76cee3..061d4225 100644 --- a/src/fs.zig +++ b/src/fs.zig @@ -677,7 +677,7 @@ pub fn statPath(io: std.Io, path: []const u8, options: std.Io.Dir.StatFileOption } test "a path with a part over 255 bytes is NameTooLong, never a panic" { - const long = "/tmp/" ++ "x" ** 300 ++ "/f"; + const long = "/tmp/" ++ &@as([300]u8, @splat('x')) ++ "/f"; try std.testing.expectError(error.NameTooLong, statPath(std.testing.io, long, .{})); } @@ -1152,7 +1152,7 @@ pub fn find(arena: std.mem.Allocator, dir: []const u8, pat: []const u8, out: []u notes.skipped += 1; continue; }) orelse break; - if (std.ascii.indexOfIgnoreCase(e.basename, pat) != null) { + if (std.ascii.findIgnoreCase(e.basename, pat) != null) { hits[hits_len] = try arena.dupe(u8, e.path); hits_len += 1; } @@ -1167,7 +1167,7 @@ pub fn find(arena: std.mem.Allocator, dir: []const u8, pat: []const u8, out: []u } else { for (sources) |s| { if (hits_len >= hits.len) break; - if (std.ascii.indexOfIgnoreCase(std.fs.path.basename(s.path), pat) != null) { + if (std.ascii.findIgnoreCase(std.fs.path.basename(s.path), pat) != null) { hits[hits_len] = s.path; hits_len += 1; } @@ -1201,7 +1201,7 @@ fn grepText(path: []const u8, text: []const u8, pat: []const u8, out: []u8, budg while (it.next()) |raw| { line += 1; if (result.hits >= budget) break; - const at = std.ascii.indexOfIgnoreCase(raw, pat) orelse continue; + const at = std.ascii.findIgnoreCase(raw, pat) orelse continue; const ln = std.mem.trimEnd(u8, raw, " \t\r"); var cut = @min(ln.len, 200); while (cut > 0 and cut < ln.len and ln[cut] & 0xc0 == 0x80) cut -= 1; diff --git a/src/gui/Post.zig b/src/gui/Post.zig index fc256135..8d0e14d9 100644 --- a/src/gui/Post.zig +++ b/src/gui/Post.zig @@ -610,13 +610,13 @@ const GhosttyUniforms = extern struct { }; test "the uniform block is ghostty's, offset for offset, and the prefix names it in that order" { - const ours = @typeInfo(Uniforms).@"struct".fields; - const theirs = @typeInfo(GhosttyUniforms).@"struct".fields; - try std.testing.expectEqual(theirs.len, ours.len); + const ours = @typeInfo(Uniforms).@"struct"; + const theirs = @typeInfo(GhosttyUniforms).@"struct"; + try std.testing.expectEqual(theirs.field_names.len, ours.field_names.len); try std.testing.expectEqual(@sizeOf(GhosttyUniforms), @sizeOf(Uniforms)); - inline for (ours, theirs) |a, b| { - try std.testing.expectEqual(@offsetOf(GhosttyUniforms, b.name), @offsetOf(Uniforms, a.name)); - try std.testing.expectEqual(b.type, a.type); + inline for (ours.field_names, ours.field_types, theirs.field_names, theirs.field_types) |a, a_type, b, b_type| { + try std.testing.expectEqual(@offsetOf(GhosttyUniforms, b), @offsetOf(Uniforms, a)); + try std.testing.expectEqual(b_type, a_type); } // By NAME: iSelectionForegroundColor sits where ghostty's Zig says // selection_background, which is where its GLSL puts the foreground. @@ -633,7 +633,7 @@ test "the uniform block is ghostty's, offset for offset, and the prefix names it .{ "vec3", "iBackgroundColor" }, .{ "vec3", "iForegroundColor" }, .{ "vec3", "iCursorColor" }, .{ "vec3", "iCursorText" }, .{ "vec3", "iSelectionForegroundColor" }, .{ "vec3", "iSelectionBackgroundColor" }, }; - try std.testing.expectEqual(ours.len, glsl.len); + try std.testing.expectEqual(ours.field_names.len, glsl.len); // Its three blocks (Globals, Palette, Colors) read as one, in order. const start = std.mem.indexOf(u8, prefix, "uniform Globals {").?; const end = std.mem.indexOf(u8, prefix, "uniform PardesPost {").?; diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 5a026664..b8687fd3 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -25,11 +25,7 @@ const ninep_io = @import("../9p_io.zig"); const detached_client = @import("../detached/client.zig"); const tracy = @import("../tracy.zig"); -pub const c = @cImport({ - @cDefine("SDL_DISABLE_OLD_NAMES", "1"); - @cInclude("SDL3/SDL.h"); - @cInclude("font.h"); -}); +pub const c = @import("gui_c"); // SDL3 and font.h, translated by build.zig const host_io = @import("../host_io.zig"); extern "c" fn setenv(name: [*:0]const u8, value: [*:0]const u8, overwrite: c_int) c_int; @@ -4806,7 +4802,7 @@ fn dumpThemes(ctx: ?*anyopaque, pane: u8) void { } fn putClipboard(gpa: std.mem.Allocator, text: []const u8) void { - const z = gpa.dupeZ(u8, text) catch return; + const z = gpa.dupeSentinel(u8, text, 0) catch return; defer gpa.free(z); _ = c.SDL_SetClipboardText(z.ptr); } @@ -5131,7 +5127,7 @@ test "a wheel over codex in a terminal reaches its pty as the mouse reports it a wheelAt(&g, &in, .{ .y = 1, .integer_y = 1 }, mc); try std.testing.expectEqualStrings("\x1b[<64;6;4M", try Sent.take(core, &sent)); wheelAt(&g, &in, .{ .y = -3, .integer_y = -3 }, mc); - try std.testing.expectEqualStrings("\x1b[<65;6;4M" ** 3, try Sent.take(core, &sent)); + try std.testing.expectEqualStrings(std.mem.asBytes(&@as([3][10]u8, @splat("\x1b[<65;6;4M".*))), try Sent.take(core, &sent)); try std.testing.expectEqual(@as(i32, 0), g.scroll_notch); try std.testing.expect(g.scroll_pane == null); // A touchpad's fractions add up to a turn. @@ -7157,7 +7153,7 @@ test "every pixel of a grip column is band, button or ring, and the button sits const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .cols = 60, .rows = 20 }); defer core.deinit(); - const pane = try core.setTestFile("text\n" ** 60); + const pane = try core.setTestFile(std.mem.asBytes(&@as([60][5]u8, @splat("text\n".*)))); pane.tag.own = try gpa.dupe(u8, "second\nthird"); core.newScratchBelow(0); for ([_]struct { w: u32, h: u32, tag: u32 }{ .{ .w = 10, .h = 20, .tag = 12 }, .{ .w = 17, .h = 35, .tag = 30 }, .{ .w = 9, .h = 19, .tag = 15 }, .{ .w = 12, .h = 24, .tag = 24 } }) |m| for ([_]bool{ false, true }) |bottom| for ([_]usize{ 0, 1 }) |focus| for ([_]bool{ false, true }) |dirty| { @@ -10156,7 +10152,7 @@ test "the selection glows round its block, on the body only, fading in over 100 const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .cols = 80, .rows = 24 }); defer core.deinit(); - _ = try core.setTestFile("some text on a line\n" ** 30); + _ = try core.setTestFile(std.mem.asBytes(&@as([30][20]u8, @splat("some text on a line\n".*)))); core.settings.selection_glow = true; pardes.test_api.sync(core); const s = try core.render(core.scratch.allocator()); @@ -10206,7 +10202,7 @@ test "a hovered word glows along its foot, never over the cursor, fading in over const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .cols = 80, .rows = 24 }); defer core.deinit(); - _ = try core.setTestFile("some text on a line\n" ** 30); + _ = try core.setTestFile(std.mem.asBytes(&@as([30][20]u8, @splat("some text on a line\n".*)))); core.settings.hover_glow = true; pardes.test_api.sync(core); const s = try core.render(core.scratch.allocator()); @@ -10256,7 +10252,7 @@ test "occlusion shades each body's edges, inside it, never a tag, a grip or the const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .cols = 80, .rows = 24 }); defer core.deinit(); - _ = try core.setTestFile("some text on a line\n" ** 30); + _ = try core.setTestFile(std.mem.asBytes(&@as([30][20]u8, @splat("some text on a line\n".*)))); core.settings.occlusion = true; pardes.test_api.sync(core); const s = try core.render(core.scratch.allocator()); @@ -10295,7 +10291,7 @@ test "a body tells its first line, and lapis's dots under it move a quarter as f const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .cols = 80, .rows = 24 }); defer core.deinit(); - const pane = try core.setTestFile("line\n" ** 80); + const pane = try core.setTestFile(std.mem.asBytes(&@as([80][5]u8, @splat("line\n".*)))); pane.scrollBy(8); try std.testing.expect(core.executeBuiltinLine(0, "Theme lapis")); core.settings.parallax = true; diff --git a/src/host_io.zig b/src/host_io.zig index a90c903d..d789a77d 100644 --- a/src/host_io.zig +++ b/src/host_io.zig @@ -172,7 +172,7 @@ pub const Lsp = struct { const declared_path = if (file) |f| f.path else ""; const path = try gpa.dupe(u8, filesystem.localPath(declared_path) orelse declared_path); errdefer gpa.free(path); - const source = try gpa.dupeZ(u8, if (file) |f| f.content else ""); + const source = try gpa.dupeSentinel(u8, if (file) |f| f.content else "", 0); errdefer gpa.free(source); const arg = try gpa.dupe(u8, req.arg); errdefer gpa.free(arg); @@ -210,7 +210,7 @@ pub const Lsp = struct { if (f.output != null) continue; const local = filesystem.localPath(f.path) orelse continue; const other_path = try gpa.dupe(u8, local); - const other_source = gpa.dupeZ(u8, f.content) catch |err| { + const other_source = gpa.dupeSentinel(u8, f.content, 0) catch |err| { gpa.free(other_path); return err; }; @@ -785,7 +785,7 @@ pub const Shell = struct { var dir_buf: [4096]u8 = undefined; const dir = dir_buf[0..try tmp.dir.realPath(std.testing.io, &dir_buf)]; var path: [4200:0]u8 = undefined; - const p = try std.fmt.bufPrintZ(&path, "{s}/mysh", .{dir}); + const p = try std.fmt.bufPrintSentinel(&path, "{s}/mysh", .{dir}, 0); try std.testing.expectEqual(Family.bash, familyOf(p.ptr)); try std.testing.expectEqual(Family.none, familyOf("/bin/sh")); } @@ -1662,7 +1662,7 @@ pub fn forkShell( test "shell spawn rejects invalid directories before creating a child" { const rcs: Shell.PromptFiles = .{}; try std.testing.expectError(error.InvalidPath, forkShell(null, 0, &rcs, "/bin/sh", "/tmp\x00/ignored", 24, 80, null)); - const too_long = [_]u8{'x'} ** 4096; + const too_long = @as([4096]u8, @splat('x')); try std.testing.expectError(error.NameTooLong, forkShell(null, 0, &rcs, "/bin/sh", &too_long, 24, 80, null)); var tmp = std.testing.tmpDir(.{}); @@ -1675,7 +1675,7 @@ test "shell spawn rejects invalid directories before creating a child" { try std.testing.expectError(error.NotDir, forkShell(null, 0, &rcs, "/bin/sh", file, 24, 80, null)); const explicit_file = try std.fmt.bufPrint(&path_buf, "/n/os{s}/file", .{directory}); try std.testing.expectError(error.NotDir, forkShell(null, 0, &rcs, "/bin/sh", explicit_file, 24, 80, null)); - const missing = try std.fmt.bufPrint(&path_buf, "{s}/missing/" ++ ("child/" ** 50), .{directory}); + const missing = try std.fmt.bufPrint(&path_buf, "{s}/missing/" ++ (std.mem.asBytes(&@as([50][6]u8, @splat("child/".*)))), .{directory}); try std.testing.expect(missing.len > 256); try std.testing.expectError(error.FileNotFound, forkShell(null, 0, &rcs, "/bin/sh", missing, 24, 80, null)); } @@ -1720,7 +1720,7 @@ test "shell spawn uses an explicit OS directory longer than 256 bytes" { if (!haveFile("/bin/sh")) return error.SkipZigTest; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - const sub_path = "nested-directory-with-more-than-forty-characters/" ** 7; + const sub_path = std.mem.asBytes(&@as([7][49]u8, @splat("nested-directory-with-more-than-forty-characters/".*))); try tmp.dir.createDirPath(std.testing.io, sub_path); var directory_buf: [4096]u8 = undefined; const directory = directory_buf[0..try tmp.dir.realPathFile(std.testing.io, sub_path, &directory_buf)]; @@ -1801,7 +1801,7 @@ test "shell cwd rejects truncation and preserves an owned child path longer than const io = std.testing.io; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); - const nested = "nested-directory-with-more-than-forty-characters/" ** 24; + const nested = std.mem.asBytes(&@as([24][49]u8, @splat("nested-directory-with-more-than-forty-characters/".*))); try tmp.dir.createDirPath(io, nested); var path_buf: [pardes.memory.limits.host_path_cap + 1]u8 = undefined; const directory = path_buf[0..try tmp.dir.realPathFile(io, nested, &path_buf)]; diff --git a/src/image.zig b/src/image.zig index 72520ad6..8bf9de08 100644 --- a/src/image.zig +++ b/src/image.zig @@ -242,11 +242,11 @@ pub const GlyphArt = struct { const glyphs_ascii = glyphs ++ ascii_glyphs; fn matchCell(cell: *const [64][3]u8, pal: Palette, gset: []const Glyph) Cell { - var counts = [_]u16{0} ** 16; + var counts = @as([16]u16, @splat(0)); for (cell) |px| counts[nearest(px, pal)] += 1; var cand: [4]u4 = undefined; var ncand: usize = 0; - var used = [_]bool{false} ** 16; + var used = @as([16]bool, @splat(false)); while (ncand < 4) : (ncand += 1) { var best: ?usize = null; for (counts, 0..) |c, i| { @@ -432,7 +432,7 @@ pub const GlyphArt = struct { test "render: tiny image produces a grid within bounds" { const a = std.testing.allocator; // 2x2 checker, RGBA - var img = [_]u8{0} ** (2 * 2 * 4); + var img = @as([2 * 2 * 4]u8, @splat(0)); img[0] = 255; img[1] = 255; img[2] = 255; diff --git a/src/linux/v9fs.zig b/src/linux/v9fs.zig index 5e031bfe..15945e7b 100644 --- a/src/linux/v9fs.zig +++ b/src/linux/v9fs.zig @@ -64,11 +64,11 @@ pub fn helperPath(buf: []u8) ![:0]u8 { const path = if (std.c.getenv("PARDES_V9FS_HELPER")) |env| blk: { const override = std.mem.span(env); if (!std.fs.path.isAbsolute(override)) return error.AbsoluteHelperPathRequired; - break :blk try std.fmt.bufPrintZ(buf, "{s}", .{override}); + break :blk try std.fmt.bufPrintSentinel(buf, "{s}", .{override}, 0); } else blk: { var own: [4096]u8 = undefined; const parent = std.fs.path.dirname(try selfPath(&own)) orelse return error.ExecutablePathUnavailable; - break :blk try std.fmt.bufPrintZ(buf, "{s}/{s}", .{ parent, executable }); + break :blk try std.fmt.bufPrintSentinel(buf, "{s}/{s}", .{ parent, executable }, 0); }; if (std.c.access(path.ptr, 1) != 0) return error.V9fsHelperNotFound; return path; diff --git a/src/locations.zig b/src/locations.zig index 745393e5..2828566d 100644 --- a/src/locations.zig +++ b/src/locations.zig @@ -587,12 +587,13 @@ pub const Config = struct { const key = token[0..colon]; const value = token[colon + 1 ..]; var found = false; - inline for (@typeInfo(Config).@"struct".fields) |field| { - if (std.mem.eql(u8, key, field.name)) { - @field(result, field.name) = switch (@typeInfo(field.type)) { + const info = @typeInfo(Config).@"struct"; + inline for (info.field_names, info.field_types) |name, T| { + if (std.mem.eql(u8, key, name)) { + @field(result, name) = switch (@typeInfo(T)) { .bool => if (std.mem.eql(u8, value, "on")) true else if (std.mem.eql(u8, value, "off")) false else return error.ExpectedOnOrOff, - .int => std.fmt.parseInt(field.type, value, 10) catch return error.InvalidContext, - .@"enum" => std.meta.stringToEnum(field.type, value) orelse return error.InvalidLayout, + .int => std.fmt.parseInt(T, value, 10) catch return error.InvalidContext, + .@"enum" => std.meta.stringToEnum(T, value) orelse return error.InvalidLayout, else => @compileError("unsupported location setting type"), }; found = true; @@ -604,11 +605,12 @@ pub const Config = struct { } pub fn write(config: Config, writer: *std.Io.Writer) !void { - inline for (@typeInfo(Config).@"struct".fields, 0..) |field, index| { + const info = @typeInfo(Config).@"struct"; + inline for (info.field_names, info.field_types, 0..) |name, T, index| { if (index > 0) try writer.writeByte(' '); - try writer.writeAll(field.name ++ ":"); - const value = @field(config, field.name); - switch (@typeInfo(field.type)) { + try writer.writeAll(name ++ ":"); + const value = @field(config, name); + switch (@typeInfo(T)) { .bool => try writer.writeAll(if (value) "on" else "off"), .int => try writer.print("{d}", .{value}), .@"enum" => try writer.writeAll(@tagName(value)), @@ -809,11 +811,11 @@ test "locations cache bounds memory and entries and evicts least recently used" try std.testing.expectEqual(@as(usize, 2), cache.len); try std.testing.expect(cache.bytes <= 40); try std.testing.expectEqualStrings("b.unknown", cache.entries[0].path); - try std.testing.expectError(error.SourceTooLarge, cache.getBounded(gpa, "large.unknown", "x" ** 41, false, false, 40)); + try std.testing.expectError(error.SourceTooLarge, cache.getBounded(gpa, "large.unknown", &@as([41]u8, @splat('x')), false, false, 40)); try std.testing.expectEqual(@as(usize, 2), cache.len); if (syntax.supportsPath("large.zig")) { const before = cache.analyses; - try std.testing.expectError(error.SourceTooLarge, cache.getBounded(gpa, "large.zig", "x" ** 25, true, true, 40)); + try std.testing.expectError(error.SourceTooLarge, cache.getBounded(gpa, "large.zig", &@as([25]u8, @splat('x')), true, true, 40)); try std.testing.expectEqual(before, cache.analyses); } cache.deinit(gpa); diff --git a/src/look.zig b/src/look.zig index 1065cb02..f9c470cf 100644 --- a/src/look.zig +++ b/src/look.zig @@ -671,7 +671,7 @@ pub fn runSearch(p: *Pardes, id: usize, pat_raw: []const u8, kind: Search, start const cl: usize = @intCast(@max(0, pane.body.cur_row)); const cc: usize = @intCast(@max(0, pane.body.cur_col)); for (lines, 0..) |ln, i| { - const at = std.ascii.indexOfIgnoreCase(ln, pat) orelse continue; + const at = std.ascii.findIgnoreCase(ln, pat) orelse continue; const row = try std.fmt.allocPrint(arena, "{s}:{d}:{d}{c}{d} {s}\n", .{ loc, i + 1, at + 1, config.range_sep, at + pat.len, std.mem.trimEnd(u8, ln, " \t"), }); @@ -1273,7 +1273,7 @@ fn missText(text: []const u8, buf: *[miss_path_cap + "…".len]u8) []const u8 { test "a miss names a long path by its start and its end, its middle given up to …" { var cut: [miss_path_cap + "…".len]u8 = undefined; - const long = "/home/someone/" ++ "deep/" ** 80 ++ "the-file.zig"; + const long = "/home/someone/" ++ std.mem.asBytes(&@as([80][5]u8, @splat("deep/".*))) ++ "the-file.zig"; const said = missText(long, &cut); try std.testing.expect(said.len <= miss_path_cap); try std.testing.expect(std.mem.startsWith(u8, said, "/home/someone/")); @@ -2185,7 +2185,7 @@ test "Look ignores missing and out of bounds pane addresses" { test "a pointer resting where a look-hover found nothing does not wake the core every frame" { const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 24 }); defer p.deinit(); - _ = try p.setTestFile(" \n" ** 30); + _ = try p.setTestFile(std.mem.asBytes(&@as([30][6]u8, @splat(" \n".*)))); p.sync(); const r = p.rects[p.active]; // Resting on blanks in the body: a wait, then nothing to open. diff --git a/src/lsp/lsp.zig b/src/lsp/lsp.zig index 96d42bbd..4a70efe5 100644 --- a/src/lsp/lsp.zig +++ b/src/lsp/lsp.zig @@ -92,7 +92,7 @@ else pub const backend_name = "lsp-client"; pub const supports: std.EnumSet(Kind) = blk: { - var s: std.EnumSet(Kind) = .initEmpty(); + var s: std.EnumSet(Kind) = .empty; for (0..backends.len) |i| s.setUnion(backends[i].supports); break :blk s; }; diff --git a/src/lsp/lsp_client.zig b/src/lsp/lsp_client.zig index 54bbaa79..b396879b 100644 --- a/src/lsp/lsp_client.zig +++ b/src/lsp/lsp_client.zig @@ -159,7 +159,7 @@ pub const specs = [_]Spec{ /// answered per connection; a kind its server never advertised simply returns /// no rows, which the harness reports as CLAIMED-EMPTY per language — honest, /// since the claim here is about the protocol, not about every server. -pub const supports: std.EnumSet(lsp.Kind) = .initFull(); +pub const supports: std.EnumSet(lsp.Kind) = .full; /// Routing: an extension in the table whose spec is not disabled by its env /// var. Deliberately does NOT probe for the binary — this runs on the Tab diff --git a/src/macos.zig b/src/macos.zig index 20463481..37db0abd 100644 --- a/src/macos.zig +++ b/src/macos.zig @@ -724,7 +724,7 @@ fn initCore(runtime: ?*const Runtime, cols_arg: u16, rows_arg: u16) !void { // in Debug, libc's malloc otherwise. libc's measured at least as fast as // std.heap.smp_allocator everywhere and faster on MuPDF's page-sized // rasters, so this shell no longer differs. - const gpa = if (builtin.mode == .Debug) debug_gpa.allocator() else std.heap.c_allocator; + const gpa = if (builtin.mode == .debug) debug_gpa.allocator() else std.heap.c_allocator; const allocs = pardes.memory.init(gpa); errdefer pardes.memory.deinit(); @@ -858,7 +858,7 @@ export fn pardes_deinit() void { st.gpa.destroy(st.threaded); pardes.memory.deinit(); // Leaks are logged and do not fail, as std.start treats the others'. - if (builtin.mode == .Debug) { + if (builtin.mode == .debug) { _ = debug_gpa.deinit(); debug_gpa = .init; } @@ -2871,22 +2871,22 @@ test "pardes.h matches the Zig boundary" { try expectEqual(@offsetOf(c.pardes_cell_s, "len"), @offsetOf(Cell, "len")); try expectEqual(@offsetOf(c.pardes_cell_s, "flags"), @offsetOf(Cell, "flags")); try expectEqual(@sizeOf(c.pardes_scene_s), @sizeOf(Scene)); - inline for (@typeInfo(Scene).@"struct".fields) |field| - try expectEqual(@offsetOf(c.pardes_scene_s, field.name), @offsetOf(Scene, field.name)); + inline for (@typeInfo(Scene).@"struct".field_names) |name| + try expectEqual(@offsetOf(c.pardes_scene_s, name), @offsetOf(Scene, name)); try expectEqual(@sizeOf(c.pardes_panel_box_s), @sizeOf(PanelBox)); - inline for (@typeInfo(PanelBox).@"struct".fields) |field| - try expectEqual(@offsetOf(c.pardes_panel_box_s, field.name), @offsetOf(PanelBox, field.name)); + inline for (@typeInfo(PanelBox).@"struct".field_names) |name| + try expectEqual(@offsetOf(c.pardes_panel_box_s, name), @offsetOf(PanelBox, name)); try expectEqual(@sizeOf(c.pardes_panel_track_s), @sizeOf(PanelTrack)); - inline for (@typeInfo(PanelTrack).@"struct".fields) |field| { - const c_name = comptime if (std.mem.eql(u8, field.name, "motion")) + inline for (@typeInfo(PanelTrack).@"struct".field_names) |name| { + const c_name = comptime if (std.mem.eql(u8, name, "motion")) "reserved0" else - field.name; - try expectEqual(@offsetOf(c.pardes_panel_track_s, c_name), @offsetOf(PanelTrack, field.name)); + name; + try expectEqual(@offsetOf(c.pardes_panel_track_s, c_name), @offsetOf(PanelTrack, name)); } try expectEqual(@sizeOf(c.pardes_image_s), @sizeOf(Image)); - inline for (@typeInfo(Image).@"struct".fields) |field| - try expectEqual(@offsetOf(c.pardes_image_s, field.name), @offsetOf(Image, field.name)); + inline for (@typeInfo(Image).@"struct".field_names) |name| + try expectEqual(@offsetOf(c.pardes_image_s, name), @offsetOf(Image, name)); try expectEqual(@sizeOf(c.pardes_runtime_s), @sizeOf(Runtime)); try expectEqual(@as(u32, c.PARDES_COLOR_DEFAULT), color_default); @@ -3177,7 +3177,7 @@ test "mac tag layer ABI preserves logical capacity and physical grip" { }); try std.testing.expectEqual(@as(u32, 11), pardes_tag_layer_value(0, 8)); try std.testing.expectEqual(@as(u8, 'Z'), pardes_tag_layer_cells(0).?[11].text[0]); - var canonical: [24]Cell = @splat(encodeCell(.{ .text = .{'G'} ++ .{0} ** 6, .len = 1, .default = false })); + var canonical: [24]Cell = @splat(encodeCell(.{ .text = .{ 'G', 0, 0, 0, 0, 0, 0 }, .len = 1, .default = false })); var source: [24]pardes.Cell = @splat(.{}); blankTagCells(&canonical, 8, 3, &source, &core.surface.tag_layers); try std.testing.expectEqual(@as(u8, 'G'), canonical[9].text[0]); diff --git a/src/main.zig b/src/main.zig index 26259b43..e3bae75f 100644 --- a/src/main.zig +++ b/src/main.zig @@ -464,6 +464,12 @@ fn nativeMain(init: std.process.Init) !void { } opts.tty_only = explicit_tty or session_only; opts.mounts = mounts[0..mounts_len]; + // `zig build run-isolated` with nothing named: something to look at on + // arrival, read out of the binary itself. + if (pardes.isolated and positional == null) { + session_only = false; + positional = "src/pardes.zig"; + } if (detach != null and attach != null) badArgs(init.io, "--detach and --attach are opposites: one runs the session, the other joins one", .{}); // --wait waits on the pane a FILE opens: with none there is nothing to diff --git a/src/memory.zig b/src/memory.zig index abfd40f6..48403c55 100644 --- a/src/memory.zig +++ b/src/memory.zig @@ -38,7 +38,7 @@ pub const limits = struct { }; const Allocator = std.mem.Allocator; -const debug_enabled = builtin.mode == .Debug; +const debug_enabled = builtin.mode == .debug; pub const Allocators = struct { pardes: Allocator, diff --git a/src/modal.zig b/src/modal.zig index 50e0ddf4..82f1a3a0 100644 --- a/src/modal.zig +++ b/src/modal.zig @@ -163,7 +163,7 @@ pub const Normal = struct { }; pub const Input = struct { - roles: std.EnumSet(Role) = .initEmpty(), + roles: std.EnumSet(Role) = .empty, cp: u21, ctrl: bool = false, alt: bool = false, diff --git a/src/ninep/addr.zig b/src/ninep/addr.zig index b78c46e7..3feda5a2 100644 --- a/src/ninep/addr.zig +++ b/src/ninep/addr.zig @@ -646,7 +646,7 @@ test "the address language, form by form" { try testing.expectEqualStrings(c[1], th.wr(p, addr, c[0]).reply.ename); } - const nested = "," ** 4096; + const nested = &@as([4096]u8, @splat(',')); _ = th.wr(p, addr, "#0"); try testing.expectEqual(E.INVAL, th.wr(p, addr, nested).errno()); } diff --git a/src/ninep/cols.zig b/src/ninep/cols.zig index e3b456ba..59f6ae42 100644 --- a/src/ninep/cols.zig +++ b/src/ninep/cols.zig @@ -288,18 +288,18 @@ test "exactly 4096 bytes written with echo's newline after a truncation fit ever const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); const serial = th.serialOf(p); - const text = "w" ** 4096 ++ "\n"; + const text = &@as([4096]u8, @splat('w')) ++ "\n"; for ([_]u64{ tree.Node.of(serial, .tag), tree.Node.ofCol(layout.columnSerial(p, 0), .tag), @intFromEnum(tree.TopFile.tag) }) |node| { _ = th.call(p, .{ .tag = 1, .op = .setattr, .node = node, .truncate = true }); const h = th.call(p, .{ .tag = 2, .op = .open, .node = node, .omode = 1 }).reply.handle; const r = th.call(p, .{ .tag = 3, .op = .write, .node = node, .handle = h, .data = text }); try testing.expectEqual(tree.Status.ok, r.reply.status); _ = th.call(p, .{ .tag = 4, .op = .release, .node = node, .handle = h, .opened = true }); - try testing.expect(std.mem.endsWith(u8, th.rd(p, node, 0, 1 << 16).bytes, "w" ** 4096)); + try testing.expect(std.mem.endsWith(u8, th.rd(p, node, 0, 1 << 16).bytes, &@as([4096]u8, @splat('w')))); // One more byte is over. _ = th.call(p, .{ .tag = 5, .op = .setattr, .node = node, .truncate = true }); const h2 = th.call(p, .{ .tag = 6, .op = .open, .node = node, .omode = 1 }).reply.handle; - try testing.expectEqual(E.NOSPC, th.call(p, .{ .tag = 7, .op = .write, .node = node, .handle = h2, .data = "w" ** 4097 ++ "\n" }).errno()); + try testing.expectEqual(E.NOSPC, th.call(p, .{ .tag = 7, .op = .write, .node = node, .handle = h2, .data = &@as([4097]u8, @splat('w')) ++ "\n" }).errno()); _ = th.call(p, .{ .tag = 8, .op = .release, .node = node, .handle = h2, .opened = true }); } } @@ -316,7 +316,7 @@ test "a Newcol refused because the tags would not fit logs its err alone and spe for (p.col_panes[col][0..p.col_n[col]]) |k| { const each = p.panes[k].?; if (each.tag.own) |old| p.gpa.free(old); - each.tag.own = try p.gpa.dupe(u8, "word " ** 60); + each.tag.own = try p.gpa.dupe(u8, std.mem.asBytes(&@as([60][5]u8, @splat("word ".*)))); } try testing.expect(p.col_n[col] >= 2); p.sync(); @@ -588,7 +588,7 @@ test "a refused write after a truncation leaves every kind of tag as it was, and defer p.deinit(); const serial = th.serialOf(p); const col = layout.columnSerial(p, 0); - const big = "w" ** (limits.max_tag_tail + 1); + const big = &@as([limits.max_tag_tail + 1]u8, @splat('w')); // Each tag: a truncating open, then a write too long: nothing changes. for ([_]u64{ Node.of(serial, .tag), Node.ofCol(col, .tag), @intFromEnum(tree.TopFile.tag) }) |node| { _ = th.wr(p, node, " Mine"); diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index f6457b83..6b4bbafb 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -1682,9 +1682,9 @@ test "a look's miss repeats the path whole up to 256 bytes, then gives up its mi var line: [512]u8 = undefined; _ = wr(p, root, try std.fmt.bufPrint(&line, "{s}\n", .{long})); try testing.expect(th.logHas(p, try std.fmt.bufPrint(&line, "look: no match for \"{s}\"\n", .{long}))); - const huge = "é" ** 150; // 300 bytes: its middle cut to fit 256, between characters + const huge = std.mem.asBytes(&@as([150][2]u8, @splat("é".*))); // 300 bytes: its middle cut to fit 256, between characters _ = wr(p, root, huge ++ "\n"); - try testing.expect(th.logHas(p, "look: no match for \"" ++ "é" ** 63 ++ "…" ++ "é" ** 63 ++ "\"\n")); + try testing.expect(th.logHas(p, "look: no match for \"" ++ std.mem.asBytes(&@as([63][2]u8, @splat("é".*))) ++ "…" ++ std.mem.asBytes(&@as([63][2]u8, @splat("é".*))) ++ "\"\n")); } test "exec runs a builtin at the pane and records the pane it acted on" { @@ -2041,7 +2041,7 @@ test "Zerox twins dump their text once and come back on one buffer from a Restor defer p.deinit(); const first = serialOf(p); _ = wr(p, Node.of(first, .name), "/tmp/pardes-zerox-dump.txt\n"); - _ = wr(p, Node.of(first, .body), "unsaved " ** 64 ++ "\n"); + _ = wr(p, Node.of(first, .body), std.mem.asBytes(&@as([64][8]u8, @splat("unsaved ".*))) ++ "\n"); try testing.expect(p.executeBuiltinLine(0, "Zerox")); try testing.expect(p.executeBuiltinLine(0, "Zerox")); try pardes.dump.dumpState(p); @@ -2888,7 +2888,7 @@ test "a builtin that fails a ctl write logs only its err, so the same failure ag test "an exec line over the command limit fails the write and says the limit; a builtin's may be longer" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); - const long = "echo " ++ "y" ** pardes.exec.command_max ++ "\n"; + const long = "echo " ++ &@as([pardes.exec.command_max]u8, @splat('y')) ++ "\n"; const refused = wr(p, root_exec, long); try testing.expectEqual(E.INVAL, refused.errno()); try testing.expectEqualStrings(e_too_long, refused.reply.ename); @@ -2896,7 +2896,7 @@ test "an exec line over the command limit fails the write and says the limit; a try testing.expect(th.logHas(p, try std.fmt.bufPrint(&rec, "err {d} exec: invalid command line: a command line is at most 1024 bytes", .{serialOf(p)}))); try testing.expectEqualStrings(e_control, wr(p, root_exec, "echo a\x01b\n").reply.ename); try testing.expect(th.logHas(p, try std.fmt.bufPrint(&rec, "err {d} exec: invalid command line: it holds", .{serialOf(p)}))); - try testing.expectEqual(Status.ok, wr(p, root_exec, "Msg " ++ "z" ** 1100 ++ "\n").reply.status); + try testing.expectEqual(Status.ok, wr(p, root_exec, "Msg " ++ &@as([1100]u8, @splat('z')) ++ "\n").reply.status); } test "Edit's p and = never fail for want of room for +Errors: the text is logged instead" { @@ -4012,8 +4012,8 @@ test "Back and Forward written to exec keep to the focused file, and JumpScope a defer p.deinit(); var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); - try tmp.dir.writeFile(testing.io, .{ .sub_path = "a.txt", .data = "row\n" ** 100 }); - try tmp.dir.writeFile(testing.io, .{ .sub_path = "b.txt", .data = "row\n" ** 100 }); + try tmp.dir.writeFile(testing.io, .{ .sub_path = "a.txt", .data = std.mem.asBytes(&@as([100][4]u8, @splat("row\n".*))) }); + try tmp.dir.writeFile(testing.io, .{ .sub_path = "b.txt", .data = std.mem.asBytes(&@as([100][4]u8, @splat("row\n".*))) }); var dir_buf: [4096]u8 = undefined; const dir = dir_buf[0..try tmp.dir.realPath(testing.io, &dir_buf)]; var line: [4200]u8 = undefined; diff --git a/src/ninep/events.zig b/src/ninep/events.zig index 3910ac05..7b73dc0e 100644 --- a/src/ninep/events.zig +++ b/src/ninep/events.zig @@ -938,7 +938,7 @@ test "event records are acme's bytes, one per read, and .again when empty" { try testing.expectEqualStrings("ML0 ", rd(p, event, 0, 4).bytes); try testing.expectEqualStrings("3 4 3 one\n", rd(p, event, 0, 4096).bytes); - const big = "z" ** max_record_text; + const big = &@as([max_record_text]u8, @splat('z')); _ = noteAction(p, 0, .body_exec, 0, max_record_text, 0, big); try testing.expectEqualStrings("MX0 256 0 0 \n", rd(p, event, 0, 4096).bytes); @@ -1388,7 +1388,7 @@ test "opens of the log share the open records, and a closed one frees its record test "a click in the body reports the offsets of the word it takes, so the record can be written back" { const config = @import("../config.zig"); const gpa = testing.allocator; - const text = "alpha qty beta\n qty\n\tqty\ndef f(qty): return qty.x\n" ++ "w" ** 100 ++ " qty\n"; + const text = "alpha qty beta\n qty\n\tqty\ndef f(qty): return qty.x\n" ++ &@as([100]u8, @splat('w')) ++ " qty\n"; const p = try withFile(gpa, text); defer p.deinit(); // A scratch made over 9P, clicked while another pane has the keyboard. @@ -1459,7 +1459,7 @@ test "follow new skips what the log held and waits for what comes after" { test "a long msg record is cut between words at its cap, with an ellipsis" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); - const long = "word " ** 60; // 300 bytes + const long = std.mem.asBytes(&@as([60][5]u8, @splat("word ".*))); // 300 bytes _ = wr(p, Node.of(serialOf(p), .ctl), "Msg " ++ long ++ "\n"); const log = @intFromEnum(tree.TopFile.log); const h = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle; @@ -1485,7 +1485,7 @@ test "a record is one line of UTF-8: DEL and C1 are spaces, bytes not UTF-8 are test "a long err record keeps its end, its middle given up to an ellipsis" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); - _ = wr(p, @intFromEnum(tree.TopFile.ctl), "Bogus" ++ "abcdefgh" ** 40 ++ "\n"); + _ = wr(p, @intFromEnum(tree.TopFile.ctl), "Bogus" ++ std.mem.asBytes(&@as([40][8]u8, @splat("abcdefgh".*))) ++ "\n"); const log = @intFromEnum(tree.TopFile.log); const h = call(p, .{ .tag = 1, .op = .open, .node = log }).reply.handle; const text = call(p, .{ .tag = 2, .op = .read, .node = log, .handle = h, .size = 1 << 16 }).bytes; @@ -1500,7 +1500,7 @@ test "a long err record keeps its end, its middle given up to an ellipsis" { test "two failures that agree only in what their records cut are two records, not one counted" { const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); - const long = "why " ** 80; + const long = std.mem.asBytes(&@as([80][4]u8, @splat("why ".*))); p.setMessage(0, long ++ "first"); p.setMessage(0, long ++ "second"); try testing.expect(!th.logHas(p, "(x2)")); diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig index 3b70d62f..8605cab8 100644 --- a/src/ninep/pane.zig +++ b/src/ninep/pane.zig @@ -1427,7 +1427,7 @@ test "a tag write past the limit is refused whole, naming the limit" { const tag = Node.of(serialOf(p), .tag); const before = try testing.allocator.dupe(u8, rd(p, tag, 0, 1 << 16).bytes); defer testing.allocator.free(before); - const big = "w" ** (limits.max_tag_tail + 10); + const big = &@as([limits.max_tag_tail + 10]u8, @splat('w')); const r = wr(p, tag, big); try testing.expectEqual(E.NOSPC, r.errno()); // `no space` is what 9ns maps to ENOSPC, so a shell through a mount @@ -1549,20 +1549,21 @@ test "a name with a component over 255 bytes is refused, and a long path's faile const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); const serial = serialOf(p); - const refused = wr(p, Node.of(serial, .name), "/tmp/" ++ "c" ** 256 ++ "/f.txt\n"); + const refused = wr(p, Node.of(serial, .name), "/tmp/" ++ &@as([256]u8, @splat('c')) ++ "/f.txt\n"); try testing.expectEqual(E.INVAL, refused.errno()); try testing.expectEqualStrings("invalid file name: a component over 255 bytes", refused.reply.ename); - try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .name), "/tmp/" ++ "c" ** 255 ++ "\n").reply.status); + try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .name), "/tmp/" ++ &@as([255]u8, @splat('c')) ++ "\n").reply.status); // Held with no newline, it is refused by that write, not at the close. const held = call(p, .{ .tag = 1, .op = .open, .node = Node.of(serial, .name), .omode = 1 }).reply.handle; - try testing.expectEqual(E.INVAL, call(p, .{ .tag = 2, .op = .write, .node = Node.of(serial, .name), .handle = held, .data = "/tmp/" ++ "e" ** 256 }).errno()); + try testing.expectEqual(E.INVAL, call(p, .{ .tag = 2, .op = .write, .node = Node.of(serial, .name), .handle = held, .data = "/tmp/" ++ &@as([256]u8, @splat('e')) }).errno()); _ = call(p, .{ .tag = 3, .op = .release, .node = Node.of(serial, .name), .handle = held, .opened = true }); try testing.expectEqual(@as(usize, 0), p.fs.closed_lines.items.len); // A Save of a 3000-byte path the host refuses: the waiting write's // reason is at the end, the path giving up its middle. // (Under /tmp: under / a user's Save is refused permission, not // missing.) - const long = "/tmp/nonexistent-pardes-root/" ++ ("d" ** 200 ++ "/") ** 15 ++ "f.txt"; + const segment = &@as([200]u8, @splat('d')) ++ "/"; + const long = "/tmp/nonexistent-pardes-root/" ++ std.mem.asBytes(&@as([15][201]u8, @splat(segment.*))) ++ "f.txt"; const id = p.paneBySerial(serial).?; try nameBuffer(p, id, long, false); p.fs.late_failure_len = 0; diff --git a/src/ninep/pty.zig b/src/ninep/pty.zig index c58cf676..aeb57a00 100644 --- a/src/ninep/pty.zig +++ b/src/ninep/pty.zig @@ -1044,12 +1044,12 @@ test "a run's answer says cut when its output's start is gone, and reads a bound const q = try withTerm(gpa); defer q.deinit(); const kept = q.panes[0].?; - kept.terminal.?.vt.screens.get(.primary).?.pages.explicit_max_size = 1; + kept.terminal.?.vt.screens.get(.primary).?.pages.limits.set(.bytes, 1); const run = Node.of(serialOf(q), .pty_run); sh.put(q, prompt); h = sh.send(q, run); sh.put(q, c); - const lines = "pruned\r\n" ** 64; + const lines = std.mem.asBytes(&@as([64][8]u8, @splat("pruned\r\n".*))); var fed: usize = 0; while (!kept.terminal.?.stream.handler.out_start.?.garbage) : (fed += 1) { if (fed == 1000) return error.TestUnexpectedResult; @@ -1146,7 +1146,7 @@ test "a run's answer longer than its room is cut, its newline kept" { var slot: Run = .{}; const p = try th.withTerm(testing.allocator); defer p.deinit(); - answer(p, &slot, "busy: {s} is running", .{"x" ** 200}); + answer(p, &slot, "busy: {s} is running", .{&@as([200]u8, @splat('x'))}); try testing.expectEqual(slot.answer.len, slot.len); try testing.expectEqual(@as(u8, '\n'), slot.answer[slot.len - 1]); } diff --git a/src/ninep/screen.zig b/src/ninep/screen.zig index b991c3e4..8d4707e0 100644 --- a/src/ninep/screen.zig +++ b/src/ninep/screen.zig @@ -333,7 +333,7 @@ test "a terminal's body is its logical lines: a row the terminal wrapped is join const p = try th.withTerm(testing.allocator); defer p.deinit(); const pane = p.panes[0].?; - const long = "w" ** 50 ++ "x" ** 150; // wider than the pane: it wraps + const long = &@as([50]u8, @splat('w')) ++ &@as([150]u8, @splat('x')); // wider than the pane: it wraps try testing.expect(long.len > pane.cols); p.update(.{ .output = .{ .pane = 0, .bytes = long ++ "\r\nnext" } }); while (p.nextEffect()) |_| {} diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig index eedab43b..5678832b 100644 --- a/src/ninep/tree.zig +++ b/src/ninep/tree.zig @@ -509,7 +509,7 @@ pub fn fitErr(text: []const u8, out: []u8) []const u8 { test "a reason past 128 bytes keeps its end: the path in it gives up its middle" { var out: [128]u8 = undefined; - const long = "Save /home/someone/projects/" ++ "deep/" ** 30 ++ "file.txt: no such directory"; + const long = "Save /home/someone/projects/" ++ std.mem.asBytes(&@as([30][5]u8, @splat("deep/".*))) ++ "file.txt: no such directory"; const fit = fitErr(long, &out); try testing.expect(fit.len <= 128); try testing.expect(std.mem.startsWith(u8, fit, "Save /home/someone/")); @@ -517,7 +517,7 @@ test "a reason past 128 bytes keeps its end: the path in it gives up its middle" try testing.expect(std.mem.indexOf(u8, fit, "…") != null); try testing.expect(std.unicode.utf8ValidateSlice(fit)); // No path: the whole text's middle goes, the end stays. - const words = "why " ** 40 ++ "the reason"; + const words = std.mem.asBytes(&@as([40][4]u8, @splat("why ".*))) ++ "the reason"; try testing.expect(std.mem.endsWith(u8, fitErr(words, &out), "the reason")); try testing.expectEqualStrings("short", fitErr("short", &out)); // Through the tree: a look at a long ./ name not there, a miss, says @@ -525,7 +525,7 @@ test "a reason past 128 bytes keeps its end: the path in it gives up its middle" const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); var line: [512]u8 = undefined; - const r = th.wr(p, Node.of(serialOf(p), .look), try std.fmt.bufPrint(&line, "./{s}x.txt\n", .{"no-such-dir/" ** 20})); + const r = th.wr(p, Node.of(serialOf(p), .look), try std.fmt.bufPrint(&line, "./{s}x.txt\n", .{std.mem.asBytes(&@as([20][12]u8, @splat("no-such-dir/".*)))})); try testing.expectEqual(Status.ok, r.reply.status); try testing.expect(th.logHas(p, "x.txt: no such file")); } @@ -1492,17 +1492,17 @@ test "README names every file the tree serves" { return false; } }; - inline for (@typeInfo(TopFile).@"enum".fields) |f| { - const t: TopFile = @enumFromInt(f.value); + inline for (@typeInfo(TopFile).@"enum".field_values) |value| { + const t: TopFile = @enumFromInt(value); if (t != .root and !words.has(t.fileName())) { std.debug.print("README does not mention /{s}\n", .{t.fileName()}); return error.Undocumented; } } - inline for (@typeInfo(PaneFile).@"enum".fields) |f| { - const t: PaneFile = @enumFromInt(f.value); + inline for (@typeInfo(PaneFile).@"enum".field_values) |value| { + const t: PaneFile = @enumFromInt(value); const ok = if (t == .dir) true else if (t.inPty() and t != .pty) - std.mem.indexOf(u8, fs.help, "pty/" ++ comptime @as(PaneFile, @enumFromInt(f.value)).fileName()) != null + std.mem.indexOf(u8, fs.help, "pty/" ++ comptime @as(PaneFile, @enumFromInt(value)).fileName()) != null else words.has(t.fileName()); if (!ok) { diff --git a/src/normal.zig b/src/normal.zig index 77feb7cf..8de23d1c 100644 --- a/src/normal.zig +++ b/src/normal.zig @@ -1015,7 +1015,7 @@ test "gj/gk step the wrapped rows a body draws while j/k keep the file's lines" const p = try Pardes.init(gpa, .{ .tty_only = true }); defer p.deinit(); while (p.nextEffect()) |_| {} - const long = "a" ** 400; + const long = &@as([400]u8, @splat('a')); const pane = try p.setTestFile(long ++ "\nsecond\n"); p.settings.wrap = true; const width = panes.File.wrapWidth(pane, true); diff --git a/src/pager.zig b/src/pager.zig index 30418623..feabd194 100644 --- a/src/pager.zig +++ b/src/pager.zig @@ -38,7 +38,7 @@ pub fn parse(gpa: std.mem.Allocator, raw: []const u8, colour: bool) !Page { errdefer h.text.deinit(gpa); errdefer h.spans.deinit(gpa); try h.text.ensureTotalCapacity(gpa, raw.len); - var stream: ghostty_vt.Stream(*Handler) = .init(&h); + var stream: ghostty_vt.Stream(*Handler) = .init(.{ .handler = &h }); defer stream.deinit(); stream.nextSlice(raw); if (h.failed) return error.OutOfMemory; diff --git a/src/panes.zig b/src/panes.zig index ba1dedb5..07d5ccb1 100644 --- a/src/panes.zig +++ b/src/panes.zig @@ -318,7 +318,7 @@ pub const Pane = struct { /// `older` is an earlier message line still on screen; `index` says /// which (`Pane.msg_older`). pub const Kind = enum { older, message, leader, prompt }; - pub const max = @typeInfo(Kind).@"enum".fields.len - 1 + message_stack; + pub const max = @typeInfo(Kind).@"enum".field_names.len - 1 + message_stack; kinds: [max]Kind = undefined, index: [max]u8 = @splat(0), diff --git a/src/pardes.zig b/src/pardes.zig index 5f330712..8da0922d 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -807,7 +807,7 @@ test "TreeContext tag style preserves message rows and its opt-out survives rest if (comptime !syntax.enabled) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 60, .rows = 16 }); defer p.deinit(); - const pane = try p.setTestFile("pub const Box = struct {\n pub fn run() void {\n" ++ (" // body\n" ** 30) ++ " }\n};\n"); + const pane = try p.setTestFile("pub const Box = struct {\n pub fn run() void {\n" ++ (std.mem.asBytes(&@as([30][16]u8, @splat(" // body\n".*)))) ++ " }\n};\n"); p.gpa.free(pane.file.?.path); pane.file.?.path = try p.gpa.dupe(u8, "/test.zig"); if (!panes.File.supportsContext(pane)) return error.SkipZigTest; @@ -1247,7 +1247,9 @@ test "Def and Refs are a speaking file's tag words; gd, gr and a 2-1 chord all r const r = p.rects[0]; const x0 = r.x + config.GUTTER + panes.File.gutterWidth(pane); const use_y = p.bodyTop(pane, r) + 1; - const tag = try tagline.tagText(p, p.scratch.allocator(), pane); + // Copied out of the scratch arena, which each p.update resets. + const tag = try std.testing.allocator.dupe(u8, try tagline.tagText(p, p.scratch.allocator(), pane)); + defer std.testing.allocator.free(tag); for ([_]struct { word: []const u8, kind: lsp.Kind }{ .{ .word = " Def ", .kind = .definition }, .{ .word = " Refs", .kind = .references } }) |w| { // B1 sweeps the use of `alpha` on the second line (bytes 30..35), // leaving the cursor at its far end. @@ -1348,7 +1350,7 @@ test "acme placement: under a pane's text when it has many blank rows, else halv try std.testing.expectEqual(text_end, p.rects[second].y); // Fill both with text: no blank space is big, so the biggest pane is // halved. - const full = "x\n" ** 80; + const full = std.mem.asBytes(&@as([80][2]u8, @splat("x\n".*))); for ([_]usize{ top, second }) |id| panes.File.setContent(p, &p.panes[id].?.file.?, try p.gpa.dupe(u8, full)); p.sync(); const big = if (p.rects[second].h >= p.rects[top].h) second else top; @@ -2006,7 +2008,7 @@ test "a command pane shows how its command ended, and the next command there run try std.testing.expectEqual(@as(usize, 0), Count.signals); p.host = host_before; // A command line longer than a command pane takes is refused. - const long = "x" ** (exec.command_max + 1); + const long = &@as([exec.command_max + 1]u8, @splat('x')); try std.testing.expectEqual(@as(?usize, null), exec.execute(p, 1, long)); } @@ -2970,9 +2972,9 @@ test "restored terminals keep monotonic nonzero pane identities" { fn chordName(comptime c: config.Chord) []const u8 { comptime { const mods = (if (c.ctrl) "C-" else "") ++ (if (c.alt) "A-" else "") ++ (if (c.shift) "S-" else ""); - for (@typeInfo(Key).@"struct".decls) |d| { - if (@TypeOf(@field(Key, d.name)) != u21) continue; - if (@field(Key, d.name) == c.cp) return mods ++ d.name; + for (@typeInfo(Key).@"struct".decl_names) |d| { + if (@TypeOf(@field(Key, d)) != u21) continue; + if (@field(Key, d) == c.cp) return mods ++ d; } if (c.cp < 0x20 or c.cp > 0x7e) @compileError("chord has no name for the index"); return mods ++ &[_]u8{@as(u8, @intCast(c.cp))}; @@ -3088,11 +3090,11 @@ pub const builtin_rows: [std.enums.values(Builtin).len]Row = blk: { for (std.enums.values(Builtin), 0..) |b, i| { const keys = if (config.leader_path.get(b)) |path| leaderKeys(path) else ""; const rest = shortcuts(b); - const named = @tagName(b) ++ (if (rest.len == 0) "" else (" " ** (namew - @tagName(b).len)) ++ " " ++ rest); + const named = @tagName(b) ++ (if (rest.len == 0) "" else (&@as([namew - @tagName(b).len]u8, @splat(' '))) ++ " " ++ rest); rows[i] = .{ .path = config.leader_path.get(b), .cmd = b, - .line = keys ++ (" " ** (4 + keyw - keys.len)) ++ " " ++ named, + .line = keys ++ (&@as([4 + keyw - keys.len]u8, @splat(' '))) ++ " " ++ named, }; } const last = "\x7f"; @@ -3111,8 +3113,8 @@ comptime { @setEvalBranchQuota(20000); // one branch per string byte, behind the decl walk that folds Builtin var it = std.mem.tokenizeScalar(u8, config.topbar_str, ' '); words: while (it.next()) |w| { - for (@typeInfo(Builtin).@"enum".fields) |f| - if (std.mem.eql(u8, f.name, w)) continue :words; + for (@typeInfo(Builtin).@"enum".field_names) |name| + if (std.mem.eql(u8, name, w)) continue :words; @compileError("topbar word is not a builtin: " ++ w); } } @@ -4499,7 +4501,7 @@ pub const Pardes = struct { /// Panes made this step that found no room in their column /// (exec.placeNew): closed at the step's end, once whatever made them /// is done with them. - unplaced: std.StaticBitSet(MAX_PANES) = .initEmpty(), + unplaced: std.StaticBitSet(MAX_PANES) = .empty, /// A look's word search is running (look.lookUnresolved): from a /// terminal its rows refill the directory's one +Search (Output). word_look: bool = false, @@ -5018,7 +5020,7 @@ pub const Pardes = struct { if (p.dump_out) |d| gpa.free(d); p.fallback.deinit(); if (p.last_dump) |d| gpa.free(d); - if (p.custom_theme) |theme_value| std.zon.parse.free(gpa, theme_value); + if (p.custom_theme) |theme_value| gpa.free(theme_value.name); if (p.chord_arg) |a| gpa.free(a); for (p.spawn_dirs) |d| if (d) |dir| gpa.free(dir); p.pipe.deinit(gpa); @@ -8508,7 +8510,7 @@ test "raw tty Ctrl-B switches to editor mode without sending child input" { test "the jump list never holds two entries in a row the same, when the one between them goes" { const p = try Pardes.init(std.testing.allocator, .{ .cols = 60, .rows = 40 }); defer p.deinit(); - const pane = try p.setTestFile("a\n" ** 200); + const pane = try p.setTestFile(std.mem.asBytes(&@as([200][2]u8, @splat("a\n".*)))); const at: Loc = .{ .pane = 0, .serial = pane.serial, .line = 1, .col = 1 }; // A, a pane long closed with no file to keep it, A again, then far on. p.jumps[0] = at; @@ -9054,7 +9056,7 @@ const JumpsTest = struct { fn init(order: []const u8) !JumpsTest { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 100, .rows = 80 }); errdefer p.deinit(); - const text = "row\n" ** 100; + const text = std.mem.asBytes(&@as([100][4]u8, @splat("row\n".*))); _ = try p.setTestFile(text); var t: JumpsTest = .{ .p = p }; for ([_][]const u8{ "/b.txt", "/test.txt", "" }, 1..) |path, n| { diff --git a/src/pdf.zig b/src/pdf.zig index d98d5ff2..5adc62d1 100644 --- a/src/pdf.zig +++ b/src/pdf.zig @@ -4,9 +4,7 @@ const std = @import("std"); const c_heap = @import("c_heap"); -const c = @cImport({ - @cInclude("pdf_bridge.h"); -}); +const c = @import("pdf_c"); // src/pdf_bridge.h, translated by build.zig /// What MuPDF allocates from, itself and the libraries it bundles (they all /// allocate through its context): `start`'s allocator, through the shared C @@ -1130,7 +1128,7 @@ pub const Document = struct { const page_number = try document.checkedPage(page); if (std.mem.indexOfScalar(u8, needle, 0) != null) return error.InvalidNeedle; - const needle_z = try gpa.dupeZ(u8, needle); + const needle_z = try gpa.dupeSentinel(u8, needle, 0); defer gpa.free(needle_z); var found: c.pardes_pdf_search_result = @@ -2067,7 +2065,7 @@ test "MuPDF search returns normalized oriented quads and word selection text" { const projected = try document.pageText(std.testing.allocator, 0); defer std.testing.allocator.free(projected); - try std.testing.expect(std.ascii.indexOfIgnoreCase(projected, "Pardes") != null); + try std.testing.expect(std.ascii.findIgnoreCase(projected, "Pardes") != null); // Exercise transactional cache replacement before searching page zero // again; a failed ownership handoff here tends to surface as a double drop. if (document.pages > 1) { @@ -2093,7 +2091,7 @@ test "MuPDF search returns normalized oriented quads and word selection text" { const text = try document.copySelection(std.testing.allocator, 0, selected.start, selected.end); defer std.testing.allocator.free(text); - try std.testing.expect(std.ascii.indexOfIgnoreCase(text, "Pardes") != null); + try std.testing.expect(std.ascii.findIgnoreCase(text, "Pardes") != null); } test "highlighted render changes pixels while plain render stays stable" { diff --git a/src/regexp.zig b/src/regexp.zig index 86132f60..4cbca57e 100644 --- a/src/regexp.zig +++ b/src/regexp.zig @@ -58,7 +58,7 @@ pub const Regex = struct { /// Timed on this machine's ReleaseSafe build: 10M steps of the worst /// patterns take 45-80 ms, and a Debug build is ten times slower. - pub const budget: u64 = if (builtin.mode == .Debug) 4_000_000 else 32_000_000; + pub const budget: u64 = if (builtin.mode == .debug) 4_000_000 else 32_000_000; pub const e_long = std.fmt.comptimePrint("bad regular expression: longer than mvzr's {d} operations (about {d} pattern characters)", .{ max_ops, max_ops }); pub const e_anchor = "bad regular expression: in a pattern with \\n, ^ can only come first and $ only just before a \\n"; @@ -503,10 +503,10 @@ test "a class with non-ASCII runes matches those runes: [éa-z], a range of them } test "a pattern past 64 characters compiles, and one past the limit says so" { - var long = try Regex.compile("a" ** 200); - const text = "x" ++ "a" ** 200 ++ "\n"; + var long = try Regex.compile(&@as([200]u8, @splat('a'))); + const text = "x" ++ &@as([200]u8, @splat('a')) ++ "\n"; try std.testing.expectEqual(@as(usize, 1), (try long.find(text, 0, text.len, text.len)).?.start); - try std.testing.expectError(error.TooLong, Regex.compile("a" ** (max_ops + 8))); + try std.testing.expectError(error.TooLong, Regex.compile(&@as([max_ops + 8]u8, @splat('a')))); try std.testing.expectError(error.Bad, Regex.compile("a[b")); } @@ -546,13 +546,13 @@ test "a search that would backtrack without end runs out of budget, promptly" { // As long a chain as mvzr compiles, over runs one `a` short of it: 2^20 // steps from every start. for (0..line.len / 20) |i| line[i * 20 + 19] = 'b'; - var chain = try Regex.compile("a?" ** 20 ++ "a" ** 20); + var chain = try Regex.compile(std.mem.asBytes(&@as([20][2]u8, @splat("a?".*))) ++ &@as([20]u8, @splat('a'))); try std.testing.expectError(error.TooSlow, chain.find(&line, 0, line.len, line.len)); } test "the match is the leftmost, however long the line" { // A window cut into the identifier would find `x... =` from its middle. - const text = "let " ++ "x" ** 100 ++ " = 1"; + const text = "let " ++ &@as([100]u8, @splat('x')) ++ " = 1"; var assign = try Regex.compile("\\s*(\\w+)\\s*="); const m = (try assign.find(text, 0, text.len, text.len)).?; try std.testing.expectEqual(@as(usize, 3), m.start); diff --git a/src/sam_edit.zig b/src/sam_edit.zig index d0c51bdb..f6253c89 100644 --- a/src/sam_edit.zig +++ b/src/sam_edit.zig @@ -1102,7 +1102,7 @@ fn expectEdit(text: []const u8, command: []const u8, want: []const u8) !void { test "an x over 100k lines is 100k searches, each with its own step budget" { const th = @import("ninep/testing.zig"); - const line = "x" ** 80 ++ "\n"; + const line = &@as([80]u8, @splat('x')) ++ "\n"; const text = try std.testing.allocator.alloc(u8, line.len * 100_000); defer std.testing.allocator.free(text); for (0..100_000) |k| @memcpy(text[line.len * k ..][0..line.len], line); diff --git a/src/syntax.zig b/src/syntax.zig index b2f5ea99..fa212ca7 100644 --- a/src/syntax.zig +++ b/src/syntax.zig @@ -1859,7 +1859,7 @@ test "syntax declaration locations clear snapshots without muting ordinary conte defer stop(); const header = "pub fn run() void {"; const content = "| \t" ++ header ++ "\n| \t const value = 42;\nfile.zig:3\t}\n"; - const snapshots = [_]u8{0xff} ** header.len; + const snapshots = @as([header.len]u8, @splat(0xff)); const Row = struct { path: []const u8 = "file.zig", code_start: usize, diff --git a/src/terminal.zig b/src/terminal.zig index 3190c6e3..a8e7931c 100644 --- a/src/terminal.zig +++ b/src/terminal.zig @@ -207,7 +207,7 @@ const LivePalette = struct { var seed = GColor.default; for (base, 0..) |rgb, i| seed[i] = rgb; - self.colors = GColor.generate256Color(seed, .initEmpty(), bg, fg, false); + self.colors = GColor.generate256Color(seed, .empty, bg, fg, false); self.key = key; return &self.colors; } @@ -609,10 +609,10 @@ pub fn create(gpa: std.mem.Allocator, cols: u16, rows: u16) !*Pane { state.vt = try ghostty_vt.Terminal.init(terminalIo(), gpa, .{ .cols = cols, .rows = rows, - .max_scrollback = 16 * 1024 * 1024, + .max_scrollback_bytes = 16 * 1024 * 1024, .kitty_image_storage_limit = if (images_enabled) TerminalImages.storage_limit else 0, }); - state.stream = .initAlloc(gpa, .{ .inner = state.vt.vtHandler() }); + state.stream = .init(.{ .handler = .{ .inner = state.vt.vtHandler() }, .allocator = gpa }); state.replay.head = 0; state.replay.len = 0; state.reply_len = 0; @@ -1055,7 +1055,11 @@ fn ingestWithPositions(pane: *Pane, bytes: []const u8) void { } }; } else failed = true; + // Whether the program cleared the screen (ED 2, a switch of screens); + // pardes reads the flag nowhere else. + pane.terminal.?.vt.flags.dirty.clear = false; ingest(pane, bytes); + const cleared = pane.terminal.?.vt.flags.dirty.clear; // RIS can destroy the alternate screen and every pin it owned. const alive = if (screens.generation(key) == generation) pages else null; var moved = false; @@ -1065,7 +1069,15 @@ fn ingestWithPositions(pane: *Pane, bytes: []const u8) void { if (pin.garbage) pointer_rows_lost = true; }; }; + // The program cleared the screen, or the rows the live copy stood on are + // gone (pruned, a reset): the copy goes with them, as what the program + // drew next. Kept, ghostty would move its rows to the top of what is + // left, over the program's new text. + var copy_lost = cleared or alive == null; for (spans[0..nspans]) |span| { + if (span.overlay == overlay) if (span.start.pin) |pin| if (alive != null and pin.garbage) { + copy_lost = true; + }; const start = pinnedRow(alive, span.start); const rows = @max(1, pinnedRow(alive, span.end) -| start +| 1); moved = moved or start != span.overlay.row or rows != span.overlay.rows; @@ -1096,6 +1108,11 @@ fn ingestWithPositions(pane: *Pane, bytes: []const u8) void { pane.clearPointerSelection(button); pane.sel[button].state = .none; }; + if (copy_lost) if (pane.ovl) |copy| { + pane.gpa.free(copy.text); + pane.ovl = null; + moved = true; + }; if (moved) pane.nsel_snap = 0; // Saved regex-preview offsets name the old flat text. if (failed) { const message = "terminal edit position reset: out of memory"; @@ -1211,7 +1228,7 @@ pub fn commandOutput(pane: *Pane, gpa: std.mem.Allocator, max_rows: usize) !Comm .whole = whole, }; } else true; - return .{ .text = try gpa.dupeZ(u8, ""), .whole = whole }; + return .{ .text = try gpa.dupeSentinel(u8, "", 0), .whole = whole }; } /// At a prompt with nothing typed on its line: no input left of the @@ -2813,7 +2830,7 @@ pub fn redo(p: *Pardes, pane: *Pane) void { pane.ensureCursorVisible(); } -pub fn ptyReport(handler: *ghostty_vt.TerminalStream.Handler, data: [:0]const u8) void { +pub fn ptyReport(handler: *ghostty_vt.TerminalStream.Handler, data: []const u8) void { const state: *State = @alignCast(@fieldParentPtr("vt", handler.terminal)); const room = state.reply.len - state.reply_len; const n = @min(room, data.len); @@ -2968,7 +2985,8 @@ test "a program that asked for focus reports hears CSI I and CSI O as its pane t /// over two cells). inline fn kittyTransmit(comptime extra: []const u8) []const u8 { return comptime blk: { - const pixels = [_]u8{ 255, 0, 0, 255, 0, 0, 0, 0, 255, 0, 0, 255 } ** 2; + const row = [_]u8{ 255, 0, 0, 255, 0, 0, 0, 0, 255, 0, 0, 255 }; + const pixels = row ++ row; var buf: [std.base64.standard.Encoder.calcSize(pixels.len)]u8 = undefined; const b64 = std.base64.standard.Encoder.encode(&buf, &pixels)[0..buf.len].*; break :blk "\x1b_Ga=T,f=24,s=4,v=2,i=7," ++ extra ++ ";" ++ b64 ++ "\x1b\\"; diff --git a/src/tty/tty.zig b/src/tty/tty.zig index ca2cb939..82cb40bd 100644 --- a/src/tty/tty.zig +++ b/src/tty/tty.zig @@ -129,7 +129,7 @@ fn readInput(loop: *Loop, tty: anytype, cache: *vaxis.GraphemeCache) !void { var parser: vaxis.Parser = .{}; var buf: [1024]u8 = undefined; var carried: usize = 0; - while (!loop.should_quit) { + while (true) { // stopInput cancels the task; the read then fails with Canceled if (carried == buf.len) return error.InputSequenceTooLong; const received = try tty.read(buf[carried..]); if (received == 0) return; @@ -295,7 +295,7 @@ test "terminal input preserves fragmented keys queries paste and text after EOF" fn getWinsize(_: *@This()) !vaxis.Winsize { return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 }; } - fn inputFollows(self: *@This(), _: u32) bool { + pub fn inputFollows(self: *@This(), _: u32) bool { return self.next < self.parts.len; } fn read(self: *@This(), buf: []u8) !usize { @@ -380,7 +380,7 @@ test "terminal replies and malformed sequences never become typed text" { fn getWinsize(_: *@This()) !vaxis.Winsize { return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 }; } - fn inputFollows(self: *@This(), _: u32) bool { + pub fn inputFollows(self: *@This(), _: u32) bool { return self.next < self.parts.len; } fn read(self: *@This(), buf: []u8) !usize { @@ -465,7 +465,7 @@ test "terminal input split at every byte with a gap reads as it does whole" { fn getWinsize(_: *@This()) !vaxis.Winsize { return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 }; } - fn inputFollows(self: *@This(), ms: u32) bool { + pub fn inputFollows(self: *@This(), ms: u32) bool { return self.next < self.parts.len and self.gap_ms <= ms; } fn read(self: *@This(), buf: []u8) !usize { @@ -561,7 +561,7 @@ test "an ESC read by itself is the Escape key at once" { fn getWinsize(_: *@This()) !vaxis.Winsize { return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 }; } - fn inputFollows(self: *@This(), _: u32) bool { + pub fn inputFollows(self: *@This(), _: u32) bool { self.asked = true; return self.next < self.parts.len; } @@ -609,7 +609,7 @@ test "a frame's answer is taken wherever the reads cut it, and never typed" { fn getWinsize(_: *@This()) !vaxis.Winsize { return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 }; } - fn inputFollows(self: *@This(), _: u32) bool { + pub fn inputFollows(self: *@This(), _: u32) bool { return self.next < self.parts.len; } fn read(self: *@This(), buf: []u8) !usize { @@ -701,7 +701,7 @@ test "terminal input cancellation joins blocked reads and queued EOF" { fn getWinsize(_: *@This()) !vaxis.Winsize { return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 }; } - fn inputFollows(_: *@This(), _: u32) bool { + pub fn inputFollows(_: *@This(), _: u32) bool { return false; } fn read(self: *@This(), buf: []u8) !usize { @@ -2332,7 +2332,7 @@ test "a terminal pane gets function keys as their sequences and lone modifiers n fn getWinsize(_: *@This()) !vaxis.Winsize { return .{ .rows = 24, .cols = 80, .x_pixel = 0, .y_pixel = 0 }; } - fn inputFollows(self: *@This(), _: u32) bool { + pub fn inputFollows(self: *@This(), _: u32) bool { return self.next < self.parts.len; } fn read(self: *@This(), buf: []u8) !usize { @@ -3033,7 +3033,7 @@ test "a jump leaves a trail of a few cells behind the cursor that fades in 120 m const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 }); defer core.deinit(); - _ = try core.setTestFile("some text on a line\n" ** 20); + _ = try core.setTestFile(std.mem.asBytes(&@as([20][20]u8, @splat("some text on a line\n".*)))); try std.testing.expect(core.executeBuiltinLine(0, "Theme forge")); core.settings.jump_trail = true; for (0..40) |_| core.update(.tick); @@ -3078,7 +3078,7 @@ test "a notice chip casts a cell's shadow right and down, inside its body, off t const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 }); defer core.deinit(); - _ = try core.setTestFile("some text on a line\n" ** 20); + _ = try core.setTestFile(std.mem.asBytes(&@as([20][20]u8, @splat("some text on a line\n".*)))); try std.testing.expect(core.executeBuiltinLine(0, "Theme forge")); core.settings.chip_shadow = true; try std.testing.expect(core.executeBuiltinLine(0, "Msg a notice")); @@ -3114,7 +3114,7 @@ test "a scrolled pane's thumb brightens and fades back in 250 ms" { const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 24 }); defer core.deinit(); - const pane = try core.setTestFile("some text on a line\n" ** 200); + const pane = try core.setTestFile(std.mem.asBytes(&@as([200][20]u8, @splat("some text on a line\n".*)))); try std.testing.expect(core.executeBuiltinLine(0, "Theme forge")); core.settings.thumb_flash = true; for (0..40) |_| core.update(.tick); diff --git a/test/deck/replay.zig b/test/deck/replay.zig index 475f7476..49614b46 100644 --- a/test/deck/replay.zig +++ b/test/deck/replay.zig @@ -20,8 +20,9 @@ const Tally = struct { fn replay(src: [:0]const u8) !Tally { const gpa = std.testing.allocator; - const rec = try schema.parse(gpa, src); - defer schema.free(gpa, rec); + var arena: std.heap.ArenaAllocator = .init(gpa); + defer arena.deinit(); + const rec = try schema.parse(gpa, arena.allocator(), src); var d: deck.Deck = .{}; var tally: Tally = .{}; for (rec.events) |ev| { diff --git a/test/deck/schema.zig b/test/deck/schema.zig index 782c829a..401e15e8 100644 --- a/test/deck/schema.zig +++ b/test/deck/schema.zig @@ -61,10 +61,8 @@ pub const Event = struct { }; }; -pub fn parse(gpa: std.mem.Allocator, src: [:0]const u8) error{ OutOfMemory, ParseZon }!Recording { - return std.zon.parse.fromSliceAlloc(Recording, gpa, src, null, .{}); -} - -pub fn free(gpa: std.mem.Allocator, rec: Recording) void { - std.zon.parse.free(gpa, rec); +/// The recording's slices live in `arena`. +pub fn parse(gpa: std.mem.Allocator, arena: std.mem.Allocator, src: [:0]const u8) error{ OutOfMemory, ParseZon }!Recording { + var diagnostics: std.zon.parse.Diagnostics = undefined; + return std.zon.parse.fromSlice(Recording, .{ .gpa = gpa, .arena = arena, .source = src, .diagnostics = &diagnostics }); } diff --git a/test/e2e_harness.zig b/test/e2e_harness.zig index 9e67c49f..a2010c19 100644 --- a/test/e2e_harness.zig +++ b/test/e2e_harness.zig @@ -104,7 +104,7 @@ pub const Harness = struct { term.* = try ghostty_vt.Terminal.init(std.Io.Threaded.global_single_threaded.io(), gpa, .{ .cols = cols, .rows = rows, - .max_scrollback = 1024 * 1024, + .max_scrollback_bytes = 1024 * 1024, }); errdefer term.deinit(gpa); // vtStream() captures a pointer to `term`; term is heap-allocated so the diff --git a/test/fs_bench.zig b/test/fs_bench.zig index 746fe737..4764049f 100644 --- a/test/fs_bench.zig +++ b/test/fs_bench.zig @@ -272,7 +272,7 @@ pub fn main(init: std.process.Init) !void { .tag = 9, .op = .write, .node = s.node(.body), - .data = "x" ** 1024, + .data = &@as([1024]u8, @splat('x')), .size = 1024, }, "append: whole-body swap + undo snapshot"); @@ -327,7 +327,7 @@ pub fn main(init: std.process.Init) !void { try w.writeAll("]}\n"); } else { try w.print("{s:<26} {s:>9} {s:>8} {s}\n", .{ "request", "ns/op", "allocs", "note" }); - try w.print("{s:<26} {s:>9} {s:>8} {s}\n", .{ "-" ** 26, "-" ** 9, "-" ** 8, "-" ** 20 }); + try w.print("{s:<26} {s:>9} {s:>8} {s}\n", .{ &@as([26]u8, @splat('-')), &@as([9]u8, @splat('-')), &@as([8]u8, @splat('-')), &@as([20]u8, @splat('-')) }); for (rows.items) |r| try w.print("{s:<26} {d:>9} {d:>8} {s}\n", .{ r.name, r.ns, r.allocs, r.note }); } diff --git a/test/history.zig b/test/history.zig index 5ce45239..d399f7aa 100644 --- a/test/history.zig +++ b/test/history.zig @@ -432,24 +432,24 @@ test "history benchmark cases are nonempty unique and matched by name" { try std.testing.expectError(error.MissingField, readBenchmarks(arena, "{\"case\":\"first\"}")); const before = try readBenchmarks(arena, benchmark_fixture); const missing = try readBenchmarks(arena, "{\"case\":\"first\",\"bytes\":10,\"median_ns\":100,\"cold_ns\":100,\"allocations\":10,\"allocated_bytes\":1000}"); - try std.testing.expectError(error.DifferentBenchmarks, compareBenchmarks(.{before} ** 4, .{missing} ** 4, null, &report.writer)); + try std.testing.expectError(error.DifferentBenchmarks, compareBenchmarks(@splat(before), @splat(missing), null, &report.writer)); const renamed = \\{"case":"first","bytes":10,"median_ns":100,"cold_ns":100,"allocations":10,"allocated_bytes":1000} \\{"case":"renamed","bytes":20,"median_ns":100,"cold_ns":100,"allocations":10,"allocated_bytes":1000} ; const different = try readBenchmarks(arena, renamed); - try std.testing.expectError(error.DifferentBenchmarks, compareBenchmarks(.{before} ** 4, .{different} ** 4, null, &report.writer)); + try std.testing.expectError(error.DifferentBenchmarks, compareBenchmarks(@splat(before), @splat(different), null, &report.writer)); const reordered = \\{"case":"last","bytes":20,"median_ns":100,"cold_ns":100,"allocations":10,"allocated_bytes":1000} \\{"case":"first","bytes":10,"median_ns":100,"cold_ns":100,"allocations":10,"allocated_bytes":1000} ; const same = try readBenchmarks(arena, reordered); - try std.testing.expect(!try compareBenchmarks(.{before} ** 4, .{same} ** 4, 1, &report.writer)); + try std.testing.expect(!try compareBenchmarks(@splat(before), @splat(same), 1, &report.writer)); var samples = [4][]Benchmark{ before, before, before, different }; - try std.testing.expectError(error.DifferentBenchmarks, compareBenchmarks(.{before} ** 4, samples, null, &report.writer)); + try std.testing.expectError(error.DifferentBenchmarks, compareBenchmarks(@splat(before), samples, null, &report.writer)); samples[3] = try arena.dupe(Benchmark, before); samples[3][0].bytes += 1; - try std.testing.expectError(error.DifferentBenchmarkInputs, compareBenchmarks(.{before} ** 4, samples, null, &report.writer)); + try std.testing.expectError(error.DifferentBenchmarkInputs, compareBenchmarks(@splat(before), samples, null, &report.writer)); } test "history benchmark gate uses repeated process captures rather than the first process alone" { diff --git a/test/hxdiff.zig b/test/hxdiff.zig index 48c7ab93..b12bcd8e 100644 --- a/test/hxdiff.zig +++ b/test/hxdiff.zig @@ -39,7 +39,7 @@ pub fn main(init: std.process.Init) !void { var pane_override: ?[]const u8 = null; var goldens_path: ?[]const u8 = null; var waivers_path: ?[]const u8 = null; - const paths = try arena.alloc([]const u8, args.len - 1); + const paths = try arena.alloc([]const u8, @max(args.len - 1, 3)); // room for the defaults below var n_paths: usize = 0; var want_waivers = false; for (args[1..]) |a| { @@ -67,6 +67,18 @@ pub fn main(init: std.process.Init) !void { n_paths += 1; } } + // Named nothing (`zig build hxdiff` or `hxparity` bare): the checked-in + // suite, run from the repository root. + if (n_paths == 0 and !want_waivers) { + strict = true; + const defaults: []const []const u8 = if (parity) + &.{ "test/hxcases/cases.jsonl", "test/hxcases/parity.jsonl" } + else + &.{ "test/hxcases/cases.jsonl", "test/hxcases/goldens.jsonl", "test/hxcases/waivers.jsonl" }; + if (parity) waivers_path = waivers_path orelse "test/hxcases/parity-waivers.jsonl"; + @memcpy(paths[0..defaults.len], defaults); + n_paths = defaults.len; + } if (n_paths == 0 or want_waivers) fatal("usage: pardes-hxdiff [--parity] ... [goldens.jsonl [waivers.jsonl]]", .{}); const case_paths = paths[0..if (parity) n_paths else 1]; diff --git a/test/image_harness.zig b/test/image_harness.zig index 474ec48b..b45851cc 100644 --- a/test/image_harness.zig +++ b/test/image_harness.zig @@ -38,7 +38,7 @@ pub fn main(init: std.process.Init) !void { const args = try init.minimal.args.toSlice(arena); if (args.len != 3 and args.len != 4) return error.BadArgs; - const exe = try arena.dupeZ(u8, args[1]); + const exe = try arena.dupeSentinel(u8, args[1], 0); const backend = args[2]; const pdf_mode = args.len == 4 and std.mem.eql(u8, args[3], "pdf"); if (args.len == 4 and !pdf_mode) return error.BadArgs; diff --git a/test/lspbench.zig b/test/lspbench.zig index 02138d24..d0e25aee 100644 --- a/test/lspbench.zig +++ b/test/lspbench.zig @@ -216,7 +216,7 @@ fn reportText(rs: []const Result, rss: u64) void { const o = std.debug.print; o("backend: {s}\n\n", .{lsp.backend_name}); o("{s:<24} {s:>9} {s:>7} {s:>10} {s:>10} {s}\n", .{ "kind", "supports", "rows", "cold(us)", "warm(us)", "verdict" }); - o("{s}\n", .{"-" ** 78}); + o("{s}\n", .{&@as([78]u8, @splat('-'))}); var claimed: usize = 0; var working: usize = 0; var lies: usize = 0; diff --git a/test/monkey.zig b/test/monkey.zig index 83869ce4..dcea0b43 100644 --- a/test/monkey.zig +++ b/test/monkey.zig @@ -44,7 +44,7 @@ fn generate(gpa: std.mem.Allocator, seed: u64, steps: usize) ![]u8 { var s: Script = .{ .gpa = gpa }; try s.line("# pardes-monkey seed {d}, {d} steps", .{ seed, steps }); try s.line("file bad.txt hello \\xff\\xfe world\\nlatin-1 caf\\xe9 tail\\ntruncated \\xe6\\x97 here\\nend\\n", .{}); - try s.line("file wide.txt {s}tail\\nsecond line\\n", .{"\\xe6\\x97\\xa5\\xe6\\x9c\\xac\\xe8\\xaa\\x9e " ** 8}); + try s.line("file wide.txt {s}tail\\nsecond line\\n", .{std.mem.asBytes(&@as([8][37]u8, @splat("\\xe6\\x97\\xa5\\xe6\\x9c\\xac\\xe8\\xaa\\x9e ".*)))}); try s.line("lines long.txt 400 some words after the number, long enough to wrap in a narrow pane", .{}); try s.line("start 24 80 bad.txt", .{}); try s.line("wait 8000 Newcol Joincol", .{}); diff --git a/test/panes.zig b/test/panes.zig index 86e52838..54100f91 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -42,7 +42,7 @@ const TagLayerTests = struct { p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 5, .tagline_h = 10 }; p.gpa.free(pane.file.?.path); pane.file.?.path = try p.gpa.dupe(u8, "/x"); - try setTag(pane, " " ++ "a" ** 38 ++ "\t界 END"); + try setTag(pane, " " ++ &@as([38]u8, @splat('a')) ++ "\t界 END"); var frame = std.heap.ArenaAllocator.init(p.gpa); defer frame.deinit(); _ = try p.render(frame.allocator()); @@ -135,7 +135,7 @@ const TagLayerTests = struct { try std.testing.expectEqual(@as(i32, 0), p.panes[second].?.input.cur_col); p.update(.{ .key = .{ .cp = Key.escape } }); const left = p.panes[0].?; - try setTag(left, " " ++ "a" ** 110); + try setTag(left, " " ++ &@as([110]u8, @splat('a'))); _ = try p.render(frame.allocator()); const left_layer = try findLayer(p, .pane, 0); const left_text = try pardes.tagline.tagText(p, frame.allocator(), left); @@ -149,7 +149,7 @@ const TagLayerTests = struct { try std.testing.expectEqual(panes.File.rawAtDisplay(left_text, end_col), @as(usize, @intCast(left.tag.cur_col))); try std.testing.expect(left.sel[0].state == .done and left.sel[0].r0 == 0); p.update(.{ .key = .{ .cp = Key.escape } }); - const long = "a" ** 60 ++ "界END"; + const long = &@as([60]u8, @splat('a')) ++ "界END"; p.global_tag.own = try p.gpa.dupe(u8, long); for (p.col_tags[0..p.ncol]) |*tag| tag.own = try p.gpa.dupe(u8, long); _ = try p.render(frame.allocator()); @@ -581,7 +581,7 @@ const BodyHitTests = struct { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 64, .rows = 18 }); defer p.deinit(); p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 8, .tagline_h = 10 }; - const pane = try TreeContextTests.setZigFile(p, "const Box = struct {\n pub fn work(\n value: usize,\n ) void {\n" ++ " // body\n" ** 60 ++ " }\n};\n"); + const pane = try TreeContextTests.setZigFile(p, "const Box = struct {\n pub fn work(\n value: usize,\n ) void {\n" ++ std.mem.asBytes(&@as([60][16]u8, @splat(" // body\n".*))) ++ " }\n};\n"); try std.testing.expect(p.executeBuiltinLine(0, "TreeContext")); pane.scrollBy(10); var frame = std.heap.ArenaAllocator.init(p.gpa); @@ -629,7 +629,7 @@ const LineNumberLookTests = struct { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 64, .rows = 18 }); defer p.deinit(); p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 8, .tagline_h = 10 }; - const pane = try TreeContextTests.setZigFile(p, "const Box = struct {\n pub fn work(\n value: usize,\n ) void {\n" ++ " // body\n" ** 60 ++ " }\n};\n"); + const pane = try TreeContextTests.setZigFile(p, "const Box = struct {\n pub fn work(\n value: usize,\n ) void {\n" ++ std.mem.asBytes(&@as([60][16]u8, @splat(" // body\n".*))) ++ " }\n};\n"); try std.testing.expect(p.executeBuiltinLine(0, "TreeContext")); pane.scrollBy(30); var frame = std.heap.ArenaAllocator.init(p.gpa); @@ -686,7 +686,7 @@ const TreeContextTests = struct { if (!syntax.enabled) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 64, .rows = 18 }); defer p.deinit(); - const pane = try setZigFile(p, "const Box = struct {\n\n // omitted member comment\n\n pub fn work(\n value: usize,\n ) void {\n" ++ " // body\n" ** 30 ++ " }\n};\n"); + const pane = try setZigFile(p, "const Box = struct {\n\n // omitted member comment\n\n pub fn work(\n value: usize,\n ) void {\n" ++ std.mem.asBytes(&@as([30][16]u8, @splat(" // body\n".*))) ++ " }\n};\n"); p.row_metrics = .{ .body_w = 10, .body_h = 20, .tagline_w = 8, .tagline_h = 10 }; try std.testing.expect(p.executeBuiltinLine(0, "TreeContext")); pane.scrollBy(10); @@ -717,7 +717,7 @@ const TreeContextTests = struct { if (context and !syntax.enabled) continue; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 64, .rows = 18 }); defer p.deinit(); - const pane = try setZigFile(p, "pub fn work() void {\n" ++ " // body\n" ** 100 ++ "}\n"); + const pane = try setZigFile(p, "pub fn work() void {\n" ++ std.mem.asBytes(&@as([100][12]u8, @splat(" // body\n".*))) ++ "}\n"); if (context) try std.testing.expect(p.executeBuiltinLine(0, "TreeContext")); var frame = std.heap.ArenaAllocator.init(p.gpa); defer frame.deinit(); @@ -792,7 +792,7 @@ const TreeContextTests = struct { if (!syntax.enabled) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 48, .rows = 14 }); defer p.deinit(); - const pane = try setZigFile(p, "pub fn @\"界name\"(\n\tvalue: usize,\n) void {\n" ++ " _ = value;\n" ** 12 ++ "}\n"); + const pane = try setZigFile(p, "pub fn @\"界name\"(\n\tvalue: usize,\n) void {\n" ++ std.mem.asBytes(&@as([12][15]u8, @splat(" _ = value;\n".*))) ++ "}\n"); pane.tag_expanded = false; // a one-row tag keeps this small screen's rows p.sync(); p.settings.wrap = false; @@ -820,7 +820,7 @@ const TreeContextTests = struct { // Read the body top again: the click cleared the announcement band the // builtin above put up, so the body moved with it. try std.testing.expectEqual(p.bodyTop(pane, p.rects[0]), cursor.y); - panes.File.setContent(p, &pane.file.?, try p.gpa.dupe(u8, "// no enclosing declaration\n" ** 18)); + panes.File.setContent(p, &pane.file.?, try p.gpa.dupe(u8, std.mem.asBytes(&@as([18][28]u8, @splat("// no enclosing declaration\n".*))))); _ = try p.render(frame.allocator()); try std.testing.expectEqual(@as(u16, 0), pane.context_rows); try std.testing.expectEqual(pane.scroll(), pane.wrapAt(0).line); @@ -942,7 +942,7 @@ const TtySelectionTests = struct { try noChildInput(p); _ = try p.render(frame.allocator()); try std.testing.expectEqualStrings(expected, pardes.test_api.heldSelection(p, 0).?); - p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b]133;C\x07" ++ "\r\nnew output" ** 30 } }); + p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b]133;C\x07" ++ std.mem.asBytes(&@as([30][12]u8, @splat("\r\nnew output".*))) } }); _ = try p.render(frame.allocator()); try std.testing.expectEqual(panes.Text.Mode.tty, pane.body.mode); try std.testing.expectEqualStrings(expected, pardes.test_api.heldSelection(p, 0).?); @@ -1266,7 +1266,7 @@ const ClickCursorTests = struct { test "click operands and hover follow the scrolled source selection" { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 40, .rows = 14 }); defer p.deinit(); - const pane = try p.setTestFile("zero\none\ntwo\nthree\nalpha beta\nfive\ngamma delta\nseven\n" ++ "tail\n" ** 20); + const pane = try p.setTestFile("zero\none\ntwo\nthree\nalpha beta\nfive\ngamma delta\nseven\n" ++ std.mem.asBytes(&@as([20][5]u8, @splat("tail\n".*)))); p.presentation.enabled = false; p.settings.wrap = false; var frame = std.heap.ArenaAllocator.init(p.gpa); @@ -1323,7 +1323,7 @@ const JumpSelectionTests = struct { const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 34, .rows = 10 }); defer p.deinit(); p.settings.wrap = wrap; - const text = try std.fmt.allocPrint(p.gpa, "{s}{s}", .{ prefix, "unrelated destination text\n" ** 80 }); + const text = try std.fmt.allocPrint(p.gpa, "{s}{s}", .{ prefix, std.mem.asBytes(&@as([80][27]u8, @splat("unrelated destination text\n".*))) }); defer p.gpa.free(text); const pane = try p.setTestFile(text); var frame = std.heap.ArenaAllocator.init(p.gpa); @@ -1813,7 +1813,7 @@ test "a word the tag's wrapping breaks across rows is still one word to a click" var pad: usize = 1; const shown = while (pad < 80) : (pad += 1) { p.gpa.free(pane.file.?.path); - const path = try std.fmt.allocPrint(arena.allocator(), "/{s}/f.zig", .{("a" ** 80)[0..pad]}); + const path = try std.fmt.allocPrint(arena.allocator(), "/{s}/f.zig", .{(&@as([80]u8, @splat('a')))[0..pad]}); pane.file.?.path = try p.gpa.dupe(u8, path); p.sync(); const s = try pardes.tagline.shownTag(p, arena.allocator(), pane); @@ -1866,7 +1866,7 @@ test "terminal output keeps following new rows after scrollback eviction" { pane.body.mode = .tty; pane.tty_filter = false; const pages = &pane.terminal.?.vt.screens.active.pages; - pages.explicit_max_size = 64 * 1024; + pages.limits.set(.bytes, 64 * 1024); var frame = std.heap.ArenaAllocator.init(gpa); defer frame.deinit(); var evictions: usize = 0; @@ -1885,7 +1885,7 @@ test "terminal output keeps following new rows after scrollback eviction" { if (pages.scrollbar().total < previous) evictions += 1; } try std.testing.expect(evictions > phase); - try std.testing.expect(pages.page_size <= pages.maxSize()); + try std.testing.expect(pages.page_size <= pages.limits.max(.bytes)); const sb = pages.scrollbar(); try std.testing.expectEqual(sb.total - pane.rows, sb.offset); const full = try panes.terminal.screenTextAlloc(pane, gpa); @@ -1926,7 +1926,7 @@ test "terminal edit stays on its surviving row when old scrollback is evicted" { const pane = p.panes[0].?; pane.body.mode = .tty; const pages = &pane.terminal.?.vt.screens.active.pages; - pages.explicit_max_size = 64 * 1024; + pages.limits.set(.bytes, 64 * 1024); var next: usize = 0; while (next < 3000) { var buf: [32]u8 = undefined; @@ -1977,9 +1977,9 @@ test "terminal edits and undo survive partial history clearing and whole-screen pane.body.mode = .tty; if (action == .reset_alternate) p.update(.{ .output = .{ .pane = 0, .bytes = "\x1b[?1049h" } }); - p.update(.{ .output = .{ .pane = 0, .bytes = "old row\r\n" ** 40 } }); + p.update(.{ .output = .{ .pane = 0, .bytes = std.mem.asBytes(&@as([40][9]u8, @splat("old row\r\n".*))) } }); const pages = &pane.terminal.?.vt.screens.active.pages; - pages.explicit_max_size = 64 * 1024; + pages.limits.set(.bytes, 64 * 1024); const row: i32 = @as(i32, @intCast(pages.total_rows - pane.rows)) + @as(i32, if (action == .partial_clear_history) -1 else 2); pane.body.mode = .normal; @@ -2005,7 +2005,7 @@ test "terminal edits and undo survive partial history clearing and whole-screen const bytes = switch (action) { .clear_history, .partial_clear_history => "\x1b[3J", .reset_primary, .reset_alternate => "\x1bc", - .evict_all, .hidden_undo => "new row\r\n" ** 4000, + .evict_all, .hidden_undo => std.mem.asBytes(&@as([4000][9]u8, @splat("new row\r\n".*))), }; p.update(.{ .output = .{ .pane = 0, .bytes = bytes } }); const expected: i32 = if (action == .clear_history) 2 else 0; @@ -2045,7 +2045,7 @@ test "terminal lower scroll regions do not move edits above them" { var setup: [64]u8 = undefined; const bytes = try std.fmt.bufPrint(&setup, "\x1b[4;{d}r\x1b[{d};1H", .{ pane.rows, pane.rows }); p.update(.{ .output = .{ .pane = 0, .bytes = bytes } }); - p.update(.{ .output = .{ .pane = 0, .bytes = "tail\r\n" ** 50 } }); + p.update(.{ .output = .{ .pane = 0, .bytes = std.mem.asBytes(&@as([50][6]u8, @splat("tail\r\n".*))) } }); try std.testing.expectEqual(total, panes.terminal.scrollbar(pane).total); try std.testing.expectEqual(@as(i32, 1), pane.ovl.?.row); try std.testing.expectEqual(@as(i32, 1), pane.body.cur_row); @@ -2064,7 +2064,7 @@ test "terminal eviction and lower-region scrolling in one read preserve a surviv const pane = p.panes[0].?; pane.body.mode = .tty; const pages = &pane.terminal.?.vt.screens.active.pages; - pages.explicit_max_size = 64 * 1024; + pages.limits.set(.bytes, 64 * 1024); var next: usize = 0; while (next < 3000) { var buf: [32]u8 = undefined; @@ -2229,7 +2229,7 @@ test "prompt cancellation restores the selection before regex previews" { } test "a prompt that cannot be opened leaves the open one as it was" { - const Request = @typeInfo(@TypeOf(Pardes.startPrompt)).@"fn".params[3].type.?; + const Request = @typeInfo(@TypeOf(Pardes.startPrompt)).@"fn".param_types[3].?; for ([_]Request{ .{ .search = config.search_marker }, .save, .{ .pipe = .replace }, .{ .pipe = .ignore }, .{ .pipe = .insert }, .{ .pipe = .append } }) |request| { var failing = std.testing.FailingAllocator.init(std.testing.allocator, .{}); const p = try Pardes.init(failing.allocator(), .{ .tty_only = true }); @@ -2268,7 +2268,7 @@ test "Save's prompt starts from the pane's directory" { } test "a prompt opens with one allocation" { - const Request = @typeInfo(@TypeOf(Pardes.startPrompt)).@"fn".params[3].type.?; + const Request = @typeInfo(@TypeOf(Pardes.startPrompt)).@"fn".param_types[3].?; for ([_]Request{ .{ .search = config.search_marker }, .save, .{ .pipe = .replace }, .{ .pipe = .ignore }, .{ .pipe = .insert }, .{ .pipe = .append } }) |request| { var failing = std.testing.FailingAllocator.init(std.testing.allocator, .{}); const p = try Pardes.init(failing.allocator(), .{ .tty_only = true }); @@ -3441,7 +3441,7 @@ const PdfTests = struct { defer probe.deinit(std.testing.allocator); try std.testing.expectEqual(@as(usize, 0), probe.page); try std.testing.expect(probe.quads.len > 0); - try std.testing.expect(std.ascii.indexOfIgnoreCase(probe.text, "Pardes") != null); + try std.testing.expect(std.ascii.findIgnoreCase(probe.text, "Pardes") != null); } test "PDF point mapping restores band origin and fractional placement" { @@ -4812,7 +4812,7 @@ test "growing a file pane colors every newly visible Zig keyword" { const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 80, .rows = 8 }); defer p.deinit(); - const pane = try p.setTestFile("pub fn f() void { if (true) {} }\n" ** 100); + const pane = try p.setTestFile(std.mem.asBytes(&@as([100][33]u8, @splat("pub fn f() void { if (true) {} }\n".*)))); const file = &pane.file.?; gpa.free(file.path); file.path = try gpa.dupe(u8, "/resize.zig"); diff --git a/test/pdf.zig b/test/pdf.zig index a0eb8154..a51fd1a9 100644 --- a/test/pdf.zig +++ b/test/pdf.zig @@ -2080,14 +2080,14 @@ test "PDF native mouse selection, Look, and highlights share page geometry" { @as(i32, r.y + r.h - 1), )); if (!panes.Pdf.beginSelection(p, pane, col, row)) continue; - if (std.ascii.indexOfIgnoreCase(pv.selection_text, "Pardes") != null) { + if (std.ascii.findIgnoreCase(pv.selection_text, "Pardes") != null) { selected_col = col; selected_row = row; break :find_word; } }; const word_col = selected_col orelse return error.PdfMouseMappingMissedWord; - try std.testing.expect(std.ascii.indexOfIgnoreCase( + try std.testing.expect(std.ascii.findIgnoreCase( pardes.test_api.heldSelection(p, 0).?, "Pardes", ) != null); @@ -2142,7 +2142,7 @@ test "PDF native mouse selection, Look, and highlights share page geometry" { const hover = p.pdf_hover_preview orelse return error.MissingPdfHoverPreview; try std.testing.expectEqual(@as(usize, 0), hover.probe.page); try std.testing.expect(hover.probe.quads.len > 0); - try std.testing.expect(std.ascii.indexOfIgnoreCase(hover.probe.text, "Pardes") != null); + try std.testing.expect(std.ascii.findIgnoreCase(hover.probe.text, "Pardes") != null); try std.testing.expect(p.look_hover_preview == null); try std.testing.expect(p.look_hover_wait == null); @@ -2188,7 +2188,7 @@ test "PDF native mouse selection, Look, and highlights share page geometry" { // search highlights without carrying an old selection into the result. p.update(.{ .mouse = .{ .button = config.look_button, .kind = .press, .col = word_col, .row = selected_row } }); p.update(.{ .mouse = .{ .button = config.look_button, .kind = .release, .col = word_col, .row = selected_row } }); - try std.testing.expect(std.ascii.indexOfIgnoreCase(pv.search_query, "Pardes") != null); + try std.testing.expect(std.ascii.findIgnoreCase(pv.search_query, "Pardes") != null); pv.resolveSearch(p.pdf_gpa); const highlights = (try panes.Pdf.buildHighlights( pv, diff --git a/test/pdf_scroll_bench.zig b/test/pdf_scroll_bench.zig index 166fa809..fdc42660 100644 --- a/test/pdf_scroll_bench.zig +++ b/test/pdf_scroll_bench.zig @@ -597,7 +597,7 @@ fn reportText(config: Config, travel: Travel, results: []const Result) void { "total_us", "rasters", "kept", "peak_kib", "visual", "transport", }); - std.debug.print("{s}\n", .{"-" ** 160}); + std.debug.print("{s}\n", .{&@as([160]u8, @splat('-'))}); for (results) |result| std.debug.print( "{s:<16} {d:>6} {d:>7} {d:>10} {d:>10} {d:>10} {d:>10} {d:>10} {d:>11} {d:>7} {d:>5} {d:>9} {x:0>16} {x:0>16}\n", .{ diff --git a/test/pdf_sections_bench.zig b/test/pdf_sections_bench.zig index 92c9ef7c..ee26e83d 100644 --- a/test/pdf_sections_bench.zig +++ b/test/pdf_sections_bench.zig @@ -454,7 +454,7 @@ fn reportText(config: Config, results: []const Result) void { std.debug.print("{s:<42} {s:>10} {s:>10} {s:>10} {s:>10} {s:>8} {s:>8} {s}\n", .{ "scenario", "min", "median", "p90", "max", "items", "bytes", "checksum", }); - std.debug.print("{s}\n", .{"-" ** 124}); + std.debug.print("{s}\n", .{&@as([124]u8, @splat('-'))}); for (results) |result| std.debug.print( "{s:<42} {d:>10} {d:>10} {d:>10} {d:>10} {d:>8} {d:>8} {x:0>16}\n", .{ diff --git a/test/perf-baseline-gui-Debug.json b/test/perf-baseline-gui-Debug.json deleted file mode 100644 index 39f5913c..00000000 --- a/test/perf-baseline-gui-Debug.json +++ /dev/null @@ -1 +0,0 @@ -{"harness":"303736f83a625e87","build":{"compiler":"0.16.0","target":"x86_64-linux.5.10...6.19-gnu.2.38","cpu":"x86_64","driver_optimize":"ReleaseFast","core_optimize":"Debug","c_optimize":"ReleaseFast","terminal_optimize":"ReleaseSafe","platform":"gui","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"quic":false,"theme_animation":true,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400},{"name":"esp32p4","lines":12,"cols":240,"bytes":2892}],"cells":[{"op":"open","fixture":"medium","min_us":1818,"med_us":2104,"p90_us":2287,"max_us":2293},{"op":"render","fixture":"medium","min_us":78,"med_us":82,"p90_us":87,"max_us":87},{"op":"key-down","fixture":"medium","min_us":79,"med_us":81,"p90_us":89,"max_us":109},{"op":"key-right","fixture":"medium","min_us":79,"med_us":84,"p90_us":85,"max_us":89},{"op":"page-down","fixture":"medium","min_us":79,"med_us":81,"p90_us":84,"max_us":87},{"op":"wheel","fixture":"medium","min_us":77,"med_us":78,"p90_us":82,"max_us":82},{"op":"edit-char","fixture":"medium","min_us":1019,"med_us":1349,"p90_us":1597,"max_us":1632},{"op":"edit-twin","fixture":"medium","min_us":2029,"med_us":2353,"p90_us":2455,"max_us":2676},{"op":"body-2m","fixture":"medium","min_us":5978,"med_us":9708,"p90_us":11361,"max_us":11666},{"op":"body-appends","fixture":"medium","min_us":117933,"med_us":211247,"p90_us":268014,"max_us":275006},{"op":"deep-sel","fixture":"medium","min_us":73,"med_us":75,"p90_us":80,"max_us":84}]} diff --git a/test/perf-baseline-gui-debug.json b/test/perf-baseline-gui-debug.json new file mode 100644 index 00000000..4b60520b --- /dev/null +++ b/test/perf-baseline-gui-debug.json @@ -0,0 +1 @@ +{"harness":"6cf9f4b8943e7e29","build":{"compiler":"0.17.0","target":"x86_64-linux.5.10...7.2-gnu.2.38","cpu":"x86_64","driver_optimize":"fast","core_optimize":"debug","c_optimize":"fast","terminal_optimize":"safe","platform":"gui","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"quic":false,"theme_animation":true,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400},{"name":"esp32p4","lines":12,"cols":240,"bytes":2892}],"cells":[{"op":"open","fixture":"medium","min_us":1732,"med_us":1881,"p90_us":2035,"max_us":2072},{"op":"render","fixture":"medium","min_us":89,"med_us":92,"p90_us":101,"max_us":102},{"op":"key-down","fixture":"medium","min_us":92,"med_us":94,"p90_us":100,"max_us":100},{"op":"key-right","fixture":"medium","min_us":91,"med_us":93,"p90_us":105,"max_us":109},{"op":"page-down","fixture":"medium","min_us":91,"med_us":95,"p90_us":99,"max_us":106},{"op":"wheel","fixture":"medium","min_us":90,"med_us":95,"p90_us":101,"max_us":101},{"op":"edit-char","fixture":"medium","min_us":1226,"med_us":1678,"p90_us":2093,"max_us":2323},{"op":"edit-twin","fixture":"medium","min_us":2275,"med_us":2697,"p90_us":2868,"max_us":2920},{"op":"body-2m","fixture":"medium","min_us":5213,"med_us":11333,"p90_us":18974,"max_us":18999},{"op":"body-appends","fixture":"medium","min_us":175012,"med_us":260087,"p90_us":317184,"max_us":317469},{"op":"deep-sel","fixture":"medium","min_us":83,"med_us":85,"p90_us":86,"max_us":98}]} diff --git a/test/perf-baseline-tty-Debug.json b/test/perf-baseline-tty-Debug.json deleted file mode 100644 index 9110398c..00000000 --- a/test/perf-baseline-tty-Debug.json +++ /dev/null @@ -1 +0,0 @@ -{"harness":"303736f83a625e87","build":{"compiler":"0.16.0","target":"x86_64-linux.5.10...6.19-gnu.2.38","cpu":"x86_64","driver_optimize":"ReleaseFast","core_optimize":"Debug","c_optimize":"ReleaseFast","terminal_optimize":"ReleaseSafe","platform":"tty","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"quic":false,"theme_animation":true,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400},{"name":"esp32p4","lines":12,"cols":240,"bytes":2892}],"cells":[{"op":"open","fixture":"medium","min_us":1881,"med_us":2148,"p90_us":2324,"max_us":2644},{"op":"render","fixture":"medium","min_us":79,"med_us":87,"p90_us":90,"max_us":93},{"op":"key-down","fixture":"medium","min_us":81,"med_us":84,"p90_us":86,"max_us":90},{"op":"key-right","fixture":"medium","min_us":80,"med_us":85,"p90_us":89,"max_us":102},{"op":"page-down","fixture":"medium","min_us":85,"med_us":86,"p90_us":88,"max_us":88},{"op":"wheel","fixture":"medium","min_us":79,"med_us":85,"p90_us":90,"max_us":91},{"op":"edit-char","fixture":"medium","min_us":1037,"med_us":1300,"p90_us":1639,"max_us":1647},{"op":"edit-twin","fixture":"medium","min_us":2046,"med_us":2378,"p90_us":2529,"max_us":2585},{"op":"body-2m","fixture":"medium","min_us":5790,"med_us":9510,"p90_us":12226,"max_us":12462},{"op":"body-appends","fixture":"medium","min_us":132421,"med_us":224849,"p90_us":257368,"max_us":274890},{"op":"deep-sel","fixture":"medium","min_us":75,"med_us":80,"p90_us":84,"max_us":86}]} diff --git a/test/perf-baseline-tty-ReleaseFast.json b/test/perf-baseline-tty-ReleaseFast.json deleted file mode 100644 index 4cbc8b95..00000000 --- a/test/perf-baseline-tty-ReleaseFast.json +++ /dev/null @@ -1 +0,0 @@ -{"harness":"303736f83a625e87","build":{"compiler":"0.16.0","target":"x86_64-linux.5.10...6.19-gnu.2.38","cpu":"x86_64","driver_optimize":"ReleaseFast","core_optimize":"ReleaseFast","c_optimize":"ReleaseFast","terminal_optimize":"ReleaseFast","platform":"tty","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"quic":false,"theme_animation":true,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400},{"name":"esp32p4","lines":12,"cols":240,"bytes":2892}],"cells":[{"op":"open","fixture":"medium","min_us":1775,"med_us":1995,"p90_us":2092,"max_us":2094},{"op":"render","fixture":"medium","min_us":80,"med_us":86,"p90_us":89,"max_us":95},{"op":"key-down","fixture":"medium","min_us":81,"med_us":83,"p90_us":95,"max_us":101},{"op":"key-right","fixture":"medium","min_us":79,"med_us":84,"p90_us":85,"max_us":98},{"op":"page-down","fixture":"medium","min_us":80,"med_us":82,"p90_us":96,"max_us":97},{"op":"wheel","fixture":"medium","min_us":78,"med_us":80,"p90_us":87,"max_us":88},{"op":"edit-char","fixture":"medium","min_us":1036,"med_us":1377,"p90_us":1602,"max_us":1621},{"op":"edit-twin","fixture":"medium","min_us":2266,"med_us":2715,"p90_us":3695,"max_us":3927},{"op":"body-2m","fixture":"medium","min_us":4739,"med_us":8675,"p90_us":11518,"max_us":13657},{"op":"body-appends","fixture":"medium","min_us":111613,"med_us":214959,"p90_us":264859,"max_us":283506},{"op":"deep-sel","fixture":"medium","min_us":74,"med_us":76,"p90_us":89,"max_us":96}]} diff --git a/test/perf-baseline-tty-debug.json b/test/perf-baseline-tty-debug.json new file mode 100644 index 00000000..a01335bd --- /dev/null +++ b/test/perf-baseline-tty-debug.json @@ -0,0 +1 @@ +{"harness":"6cf9f4b8943e7e29","build":{"compiler":"0.17.0","target":"x86_64-linux.5.10...7.2-gnu.2.38","cpu":"x86_64","driver_optimize":"fast","core_optimize":"debug","c_optimize":"fast","terminal_optimize":"safe","platform":"tty","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"quic":false,"theme_animation":true,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400},{"name":"esp32p4","lines":12,"cols":240,"bytes":2892}],"cells":[{"op":"open","fixture":"medium","min_us":2169,"med_us":2697,"p90_us":3126,"max_us":3207},{"op":"render","fixture":"medium","min_us":89,"med_us":96,"p90_us":101,"max_us":115},{"op":"key-down","fixture":"medium","min_us":93,"med_us":98,"p90_us":104,"max_us":115},{"op":"key-right","fixture":"medium","min_us":96,"med_us":97,"p90_us":102,"max_us":108},{"op":"page-down","fixture":"medium","min_us":96,"med_us":98,"p90_us":102,"max_us":103},{"op":"wheel","fixture":"medium","min_us":89,"med_us":100,"p90_us":128,"max_us":168},{"op":"edit-char","fixture":"medium","min_us":1821,"med_us":2274,"p90_us":2404,"max_us":2610},{"op":"edit-twin","fixture":"medium","min_us":2710,"med_us":3180,"p90_us":3413,"max_us":3636},{"op":"body-2m","fixture":"medium","min_us":9090,"med_us":14438,"p90_us":18158,"max_us":22063},{"op":"body-appends","fixture":"medium","min_us":241367,"med_us":375874,"p90_us":470623,"max_us":528094},{"op":"deep-sel","fixture":"medium","min_us":88,"med_us":89,"p90_us":90,"max_us":90}]} diff --git a/test/perf-baseline-tty-fast.json b/test/perf-baseline-tty-fast.json new file mode 100644 index 00000000..04fc88d3 --- /dev/null +++ b/test/perf-baseline-tty-fast.json @@ -0,0 +1 @@ +{"harness":"6cf9f4b8943e7e29","build":{"compiler":"0.17.0","target":"x86_64-linux.5.10...7.2-gnu.2.38","cpu":"x86_64","driver_optimize":"fast","core_optimize":"fast","c_optimize":"fast","terminal_optimize":"fast","platform":"tty","grammars":"full","mupdf":true,"jpx":true,"tracy":false,"quic":false,"theme_animation":true,"terminal_simd":true,"prebuilt_shaders":false},"cols":120,"rows":40,"reps":10,"only":"medium","fixtures":[{"name":"small","lines":1000,"cols":60,"bytes":62694},{"name":"medium","lines":50000,"cols":60,"bytes":3201944},{"name":"large","lines":300000,"cols":60,"bytes":19464444},{"name":"longline","lines":400,"cols":8000,"bytes":3200400},{"name":"esp32p4","lines":12,"cols":240,"bytes":2892}],"cells":[{"op":"open","fixture":"medium","min_us":1695,"med_us":2024,"p90_us":2180,"max_us":2292},{"op":"render","fixture":"medium","min_us":79,"med_us":82,"p90_us":92,"max_us":94},{"op":"key-down","fixture":"medium","min_us":81,"med_us":82,"p90_us":83,"max_us":84},{"op":"key-right","fixture":"medium","min_us":80,"med_us":82,"p90_us":91,"max_us":91},{"op":"page-down","fixture":"medium","min_us":81,"med_us":84,"p90_us":90,"max_us":171},{"op":"wheel","fixture":"medium","min_us":79,"med_us":80,"p90_us":90,"max_us":101},{"op":"edit-char","fixture":"medium","min_us":1332,"med_us":1691,"p90_us":1967,"max_us":1987},{"op":"edit-twin","fixture":"medium","min_us":2160,"med_us":2457,"p90_us":2718,"max_us":2757},{"op":"body-2m","fixture":"medium","min_us":5047,"med_us":13525,"p90_us":16257,"max_us":20323},{"op":"body-appends","fixture":"medium","min_us":155834,"med_us":261597,"p90_us":329936,"max_us":333538},{"op":"deep-sel","fixture":"medium","min_us":75,"med_us":76,"p90_us":84,"max_us":96}]} diff --git a/test/perf.zig b/test/perf.zig index c9235954..d01d1bb5 100644 --- a/test/perf.zig +++ b/test/perf.zig @@ -1054,7 +1054,7 @@ fn measureTerminalSession(io: std.Io, mib: usize, reps: usize, json: bool) !void .undo_output = undo_output, .history_rows = state.vt.screens.active.pages.scrollbar().total, .history_bytes = state.vt.screens.active.pages.page_size, - .history_limit_bytes = state.vt.screens.active.pages.maxSize(), + .history_limit_bytes = state.vt.screens.active.pages.limits.max(.bytes), .row_count_decreases = row_count_decreases, .allocator_calls = counter.calls, .allocator_live_after_output = live_after_output, @@ -1385,7 +1385,7 @@ fn reportText( for (fixtures) |fx| { if (base != null) o(" {s:>19}", .{fx.name}) else o(" {s:>12}", .{fx.name}); } - o("\n{s}\n", .{if (base != null) "-" ** (12 + fixtures.len * 20) else "-" ** (12 + fixtures.len * 13)}); + o("\n{s}\n", .{if (base != null) &@as([12 + fixtures.len * 20]u8, @splat('-')) else &@as([12 + fixtures.len * 13]u8, @splat('-'))}); var worst_jitter: f64 = 0; for (std.enums.values(Op), 0..) |op, oi| { o("{s:<12}", .{op.label()}); @@ -1412,7 +1412,7 @@ fn reportText( for (term_fixtures) |fx| { if (base != null) o(" {s:>19}", .{fx.name}) else o(" {s:>12}", .{fx.name}); } - o("\n{s}\n", .{if (base != null) "-" ** (12 + term_fixtures.len * 20) else "-" ** (12 + term_fixtures.len * 13)}); + o("\n{s}\n", .{if (base != null) &@as([12 + term_fixtures.len * 20]u8, @splat('-')) else &@as([12 + term_fixtures.len * 13]u8, @splat('-'))}); for (std.enums.values(TermOp), 0..) |op, oi| { o("{s:<12}", .{op.label()}); for (0..term_fixtures.len) |fi| { @@ -1524,10 +1524,11 @@ fn parseBase(src: []const u8, opts: Options, bytes: *const [fixtures.len]usize) defer parsed.deinit(); const report = parsed.value; if (!std.mem.eql(u8, report.harness, harness_id)) return error.BaselineHarnessMismatch; - inline for (std.meta.fields(BuildIdentity)) |field| { - const before = @field(report.build, field.name); - const after = @field(build_identity, field.name); - const same = if (field.type == []const u8) std.mem.eql(u8, before, after) else before == after; + const info = @typeInfo(BuildIdentity).@"struct"; + inline for (info.field_names, info.field_types) |name, T| { + const before = @field(report.build, name); + const after = @field(build_identity, name); + const same = if (T == []const u8) std.mem.eql(u8, before, after) else before == after; if (!same) return error.BaselineBuildMismatch; } if (report.cols != opts.cols or report.rows != opts.rows or report.reps != opts.reps or diff --git a/test/snapshot.zig b/test/snapshot.zig index 5522fbb9..2d8a8664 100644 --- a/test/snapshot.zig +++ b/test/snapshot.zig @@ -157,8 +157,8 @@ pub fn main(init: std.process.Init) !void { script_i += 1; } if (exe == null) fatal("usage: pardes-snap [scripts...] [--update] [--jobs=N]", .{}); - const exe_z = try arena.dupeZ(u8, exe.?); - lspmock_bin = if (lspmock) |p| try arena.dupeZ(u8, p) else null; + const exe_z = try arena.dupeSentinel(u8, exe.?, 0); + lspmock_bin = if (lspmock) |p| try arena.dupeSentinel(u8, p, 0) else null; if (scripts.len == 0) { scripts = try listSnaps(arena, try absPath(arena, orig_cwd, "test/snapshots")); @@ -443,7 +443,7 @@ fn runBatch( fn runOne(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const u8, update: bool) u8 { if (careful) beCareful(); const stem = std.fs.path.stem(script_path); - const report_z = arena.dupeZ(u8, reportPath(arena, script_path) catch return 1) catch return 1; + const report_z = arena.dupeSentinel(u8, reportPath(arena, script_path) catch return 1, 0) catch return 1; const fd = libc.open(report_z, .{ .ACCMODE = .WRONLY, .CREAT = true, .TRUNC = true }, @as(libc.mode_t, 0o644)); if (fd >= 0) { _ = libc.dup2(fd, 1); @@ -457,7 +457,7 @@ fn runOne(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const u8 // dirty to every manual `cmp` audit. Unlink only this script's exact path // before it starts; a new mismatch below writes it back. const actual_path = std.fmt.allocPrint(arena, "{s}.actual", .{base_path}) catch return 1; - const actual_path_z = arena.dupeZ(u8, actual_path) catch return 1; + const actual_path_z = arena.dupeSentinel(u8, actual_path, 0) catch return 1; if (record_dir == null) _ = libc.unlink(actual_path_z); const golden: ?[]u8 = if (record_dir == null) readFileAlloc(arena, golden_path) catch null else null; const started = eh.nowMs(); @@ -473,7 +473,7 @@ fn runOne(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const u8 return 0; } if (update) { - eh.writeFile(arena.dupeZ(u8, golden_path) catch return 1, out) catch return 1; + eh.writeFile(arena.dupeSentinel(u8, golden_path, 0) catch return 1, out) catch return 1; std.debug.print("UPDATED {s} ({d} bytes)\n", .{ stem, out.len }); return 0; } @@ -485,7 +485,7 @@ fn runOne(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const u8 std.debug.print("PASS {s} ({d}ms)\n", .{ stem, took }); return 0; } - eh.writeFile(arena.dupeZ(u8, actual_path) catch return 1, out) catch |err| { + eh.writeFile(arena.dupeSentinel(u8, actual_path, 0) catch return 1, out) catch |err| { std.debug.print("FAIL {s}: differs from golden; cannot write {s}: {s} ({d}ms)\n", .{ stem, actual_path, @errorName(err), took }); printFirstDiff(golden.?, out); return 1; @@ -557,7 +557,7 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const try mkdir(arena, work, false); // deterministic shell: fixed prompt, no history, no user rc leakage try eh.writeFile(try std.fmt.allocPrintSentinel(arena, "{s}/.bashrc", .{home}, 0), "PS1='$ '\nHISTFILE=\n"); - _ = setenv("HOME", try arena.dupeZ(u8, home), 1); + _ = setenv("HOME", try arena.dupeSentinel(u8, home, 0), 1); // Keep startup configuration hermetic even when the developer exports an // XDG directory that points outside this per-snapshot fake home. const config_home = try std.fmt.allocPrintSentinel(arena, "{s}/.config", .{home}, 0); @@ -602,8 +602,8 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const // take turns — which cost more wall clock than the other 51 scripts put // together. Scripts name it `$DUMP`. const dump_path = try std.fmt.allocPrint(arena, "{s}/dump.zon", .{base}); - _ = setenv("PARDES_DUMP", try arena.dupeZ(u8, dump_path), 1); - if (chdirRc(try arena.dupeZ(u8, work)) < 0) return error.ChdirFailed; + _ = setenv("PARDES_DUMP", try arena.dupeSentinel(u8, dump_path, 0), 1); + if (chdirRc(try arena.dupeSentinel(u8, work, 0)) < 0) return error.ChdirFailed; const chunks = try arena.alloc([]const u8, countCaptures(src)); var chunk_len: usize = 0; @@ -636,7 +636,7 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const try eh.appendFile(try std.fmt.allocPrintSentinel(arena, "{s}/pardes/init", .{config_home}, 0), setting); } else if (std.mem.eql(u8, cmd, "file")) { const name = tok.next() orelse return error.BadScript; - try eh.writeFile(try arena.dupeZ(u8, name), try unescape(arena, tok.rest())); + try eh.writeFile(try arena.dupeSentinel(u8, name, 0), try unescape(arena, tok.rest())); } else if (std.mem.eql(u8, cmd, "lines")) { const name = tok.next() orelse return error.BadScript; const n = try std.fmt.parseInt(usize, tok.next() orelse return error.BadScript, 10); @@ -646,7 +646,7 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const // scroll test needs and `file` can only give as one huge script line const tail = tok.rest(); const buf = try numberedLines(arena, n, tail); - try eh.writeFile(try arena.dupeZ(u8, name), buf); + try eh.writeFile(try arena.dupeSentinel(u8, name, 0), buf); } else if (std.mem.eql(u8, cmd, "ppmdiag")) { // The diagonal-split test PPM from the old e2e (white over blue), // grown to 512x512 with the white half filled by a fixed LCG @@ -658,7 +658,7 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const // down to flat color and a block always wins). const name = tok.next() orelse return error.BadScript; const ppm = try ppmDiag(arena); - try eh.writeFile(try arena.dupeZ(u8, name), ppm); + try eh.writeFile(try arena.dupeSentinel(u8, name, 0), ppm); } else if (std.mem.eql(u8, cmd, "dirmk")) { try mkdir(arena, tok.next() orelse return error.BadScript, false); } else if (std.mem.eql(u8, cmd, "run")) { @@ -668,7 +668,7 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const // different inotify event. This runs in the script's cwd, as a // child of the RUNNER, so nothing it does reaches the app's ptys: // whatever the app then shows, it woke up for by itself. - if (system(try arena.dupeZ(u8, tok.rest())) != 0) return error.RunFailed; + if (system(try arena.dupeSentinel(u8, tok.rest(), 0)) != 0) return error.RunFailed; } else if (std.mem.eql(u8, cmd, "start")) { const rows = try std.fmt.parseInt(u16, tok.next() orelse return error.BadScript, 10); const cols = try std.fmt.parseInt(u16, tok.next() orelse return error.BadScript, 10); @@ -676,7 +676,7 @@ fn runScript(arena: std.mem.Allocator, exe_z: [:0]const u8, script_path: []const var nextra: usize = 0; while (tok.next()) |a| : (nextra += 1) { if (nextra >= extra.len) return error.BadScript; - extra[nextra] = (try arena.dupeZ(u8, a)).ptr; + extra[nextra] = (try arena.dupeSentinel(u8, a, 0)).ptr; } if (h) |*hp| hp.deinit(); // scripts may restart (e.g. dump then -l) // a new process is a new screen: capture it whole, or its first @@ -963,13 +963,13 @@ fn treeAsleep(root: libc.pid_t) bool { while (n > 0) { n -= 1; const pid = stack[n]; - const dir_path = std.fmt.bufPrintZ(&path_buf, "/proc/{d}/task", .{pid}) catch continue; + const dir_path = std.fmt.bufPrintSentinel(&path_buf, "/proc/{d}/task", .{pid}, 0) catch continue; const dir = libc.opendir(dir_path) orelse continue; // exited between steps defer _ = libc.closedir(dir); while (libc.readdir(dir)) |d| { const tid = std.mem.sliceTo(@as([*:0]const u8, @ptrCast(&d.name)), 0); if (tid[0] == '.') continue; - const stat = readProc(&buf, std.fmt.bufPrintZ(&path_buf, "/proc/{d}/task/{s}/stat", .{ pid, tid }) catch continue) orelse continue; + const stat = readProc(&buf, std.fmt.bufPrintSentinel(&path_buf, "/proc/{d}/task/{s}/stat", .{ pid, tid }, 0) catch continue) orelse continue; // "pid (comm) S ..." — comm can hold spaces and parens, so the // state is the char two past the LAST ')' const close = std.mem.lastIndexOfScalar(u8, stat, ')') orelse continue; @@ -983,7 +983,7 @@ fn treeAsleep(root: libc.pid_t) bool { 'R', 'D', 'Z' => return false, else => {}, } - const kids = readProc(&buf, std.fmt.bufPrintZ(&path_buf, "/proc/{d}/task/{s}/children", .{ pid, tid }) catch continue) orelse continue; + const kids = readProc(&buf, std.fmt.bufPrintSentinel(&path_buf, "/proc/{d}/task/{s}/children", .{ pid, tid }, 0) catch continue) orelse continue; var it = std.mem.tokenizeAny(u8, kids, " \n"); while (it.next()) |k| { if (n >= stack.len) return false; // deeper than we can walk: assume busy @@ -1554,7 +1554,7 @@ fn absPath(arena: std.mem.Allocator, cwd: []const u8, p: []const u8) ![]const u8 } fn listSnaps(arena: std.mem.Allocator, dir_path: []const u8) ![][]const u8 { - const dir_z = try arena.dupeZ(u8, dir_path); + const dir_z = try arena.dupeSentinel(u8, dir_path, 0); const count = countSnapEntries(dir_z, dir_path); const scripts = try arena.alloc([]const u8, count); const dir = libc.opendir(dir_z) orelse fatal("no snapshots/ dir at {s}", .{dir_path}); @@ -1583,7 +1583,7 @@ fn countSnapEntries(dir_z: [:0]const u8, dir_path: []const u8) usize { } fn readFileAlloc(arena: std.mem.Allocator, path: []const u8) ![]u8 { - const path_z = try arena.dupeZ(u8, path); + const path_z = try arena.dupeSentinel(u8, path, 0); const fd = libc.open(path_z, .{ .ACCMODE = .RDONLY }); if (fd < 0) return error.OpenFailed; defer _ = libc.close(fd); @@ -1611,7 +1611,7 @@ fn readFileAlloc(arena: std.mem.Allocator, path: []const u8) ![]u8 { } fn mkdir(arena: std.mem.Allocator, path: []const u8, exist_ok: bool) !void { - const path_z = try arena.dupeZ(u8, path); + const path_z = try arena.dupeSentinel(u8, path, 0); const rc = libc.mkdir(path_z, 0o755); if (rc != 0) { if (exist_ok and libc.errno(rc) == .EXIST) return; diff --git a/test/snapshots/exec.golden b/test/snapshots/exec.golden index df49336c..30473c9e 100644 --- a/test/snapshots/exec.golden +++ b/test/snapshots/exec.golden @@ -22,15 +22,17 @@ == snap kept grid=140x31 cursor=6,3 |3: ZZARG ls |4: ./c.sh e.txt +|8: |9: == snap chord grid=140x31 cursor=6,3 |3: ZZARG Exec ls -|9: CHORDARG:ZZARG +|5: ./c.sh ZZARG +|6: CHORDARG:ZZARG == snap deleted grid=140x31 cursor=4,5 |3: ls ls |4: e.txt e.txt -|8: -|9: +|5: +|6: |17: |18: |19: diff --git a/test/snapshots/tinywin.golden b/test/snapshots/tinywin.golden deleted file mode 100644 index 787a9d8f..00000000 --- a/test/snapshots/tinywin.golden +++ /dev/null @@ -1,83 +0,0 @@ -== snap stacked grid=100x31 cursor=14,3 -| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -|$ /tmp/pardes-snap/tinywin/cwd Tty+bash Save Mode Filter Collapse Del -| $ :^[n^[n^[n -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| /tmp/pardes-snap/tinywin/cwd/+New Save Tty Collapse Del -| 1 -== snap shrunk grid=60x4 cursor=59,3 -| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes -| New Tty Find Grep Joincol Delcol -|$ /tmp/pardes-snap/tinywin/cwd Tty+bash Save Mode Filter Col -| /tmp/pardes-snap/tinywin/cwd/+New Save Tty Collapse Del -== snap columns grid=100x31 cursor=23,3 -| Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit -| New Tty Find Grep Joincol Delcol -|$ /tmp/pardes-snap/tinywin/cwd Tty+bash Save Mode Filter Collapse Del -| $ :^[n^[n^[n cn cn cn -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| /tmp/pardes-snap/tinywin/cwd/+New Save Tty Collapse Del -| 1 -== snap narrow grid=4x31 cursor=2,20 -| Ne -| Ne -|$ /t -| mp -| /p -| ar -| de -| s- -| sn -| ap -| $ -| ^[ -| n^ -| [n -| ^[ -| n -| cn -| c -| n -| cn -| -| /t -| mp -| /p -| ar -| de -| s- -| sn -| ap diff --git a/test/snapshots/tinywin.snap b/test/snapshots/tinywin.snap deleted file mode 100644 index 3d22d583..00000000 --- a/test/snapshots/tinywin.snap +++ /dev/null @@ -1,31 +0,0 @@ -# Shrinking the window past "one row per pane" used to panic: computeGeom gave -# every pane in a column at least one row, so `y` walked off the bottom and -# renderPane got a rect outside the surface (assert). Panes that no longer fit -# now get h = 0 and simply do not render until the window grows back. -start 31 100 -wait 8000 $ -key a-n -stable 400 8000 -key a-n -stable 400 8000 -key a-n -stable 400 8000 -key a-n -stable 700 15000 -snap stacked -resize 4 60 -stable 700 10000 -snap shrunk -# ...and the same sideways: more columns than the window is wide -resize 31 100 -stable 700 10000 -key space c n -stable 600 8000 -key space c n -stable 600 8000 -key space c n -stable 700 15000 -snap columns -resize 31 4 -stable 700 10000 -snap narrow diff --git a/test/unit_profile_test.zig b/test/unit_profile_test.zig index 721f1212..a4cdd09e 100644 --- a/test/unit_profile_test.zig +++ b/test/unit_profile_test.zig @@ -149,11 +149,8 @@ fn fixture(init: std.process.Init) !void { var write_buffer: [1024]u8 = undefined; var reader = std.Io.File.stdin().readerStreaming(io, &read_buffer); var writer = std.Io.File.stdout().writerStreaming(io, &write_buffer); - var server = try std.zig.Server.init(.{ - .in = &reader.interface, - .out = &writer.interface, - .zig_version = if (std.mem.eql(u8, mode, "version")) "wrong-version" else builtin.zig_version_string, - }); + var server: std.zig.Server = .{ .in = &reader.interface, .out = &writer.interface }; + try server.serveStringMessage(.zig_version, if (std.mem.eql(u8, mode, "version")) "wrong-version" else builtin.zig_version_string); while (true) { const request = try server.receiveMessage(); switch (request.tag) { diff --git a/tools/gen_themes.zig b/tools/gen_themes.zig index 65e85d1c..be5fde2f 100644 --- a/tools/gen_themes.zig +++ b/tools/gen_themes.zig @@ -152,13 +152,14 @@ fn byName(_: void, a: Theme, b: Theme) bool { fn emit(w: *std.Io.Writer, t: Theme) !void { try w.writeAll("// Generated by tools/gen_themes.zig. Do not edit.\npub const theme = .{\n"); try w.print(" .name = \"{s}\",\n", .{t.name}); - inline for (@typeInfo(Theme).@"struct".fields) |f| { - if (comptime std.mem.eql(u8, f.name, "name")) continue; - if (comptime std.mem.eql(u8, f.name, "palette")) continue; - try w.print(" .{s} = ", .{f.name}); - if (comptime @typeInfo(f.type) == .optional) { - if (@field(t, f.name)) |c| try rgb(w, c) else try w.writeAll("null"); - } else try rgb(w, @field(t, f.name)); + const info = @typeInfo(Theme).@"struct"; + inline for (info.field_names, info.field_types) |name, T| { + if (comptime std.mem.eql(u8, name, "name")) continue; + if (comptime std.mem.eql(u8, name, "palette")) continue; + try w.print(" .{s} = ", .{name}); + if (comptime @typeInfo(T) == .optional) { + if (@field(t, name)) |c| try rgb(w, c) else try w.writeAll("null"); + } else try rgb(w, @field(t, name)); try w.writeAll(",\n"); } if (t.palette) |p| { -- cgit v1.3 From 4e89db185fa4e3bfe4358d2da3b76fad0cc7e547 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 21 Oct 2026 21:30:24 -0300 Subject: Esc in a raw terminal is pardes's; Shift-Esc goes to the program (ProgramEsc) --- README.md | 4 ++-- docs/helix-keys.md | 4 ++-- docs/typ/builtins-gui.json | 1 + docs/typ/builtins-tty.json | 1 + docs/typ/cheatsheet.typ | 4 ++-- docs/typ/guide.typ | 2 +- docs/typ/reference.typ | 3 ++- src/CHANGELOG.md | 5 +++++ src/config.zig | 13 +++++++++--- src/pardes.zig | 47 ++++++++++++++++++++++++++++++++++++++---- src/tutor.txt | 4 ++-- test/snapshots/builtins.golden | 4 ++-- test/snapshots/builtins.snap | 1 + 13 files changed, 74 insertions(+), 19 deletions(-) (limited to 'docs/typ') diff --git a/README.md b/README.md index 0a03bdba..4ad49cc6 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ Get the source with `git clone https://git.sr.ht/~gbrls/pardes && cd pardes` (also at https://git.0x4200.cafe/pardes). Install with Zig 0.17: `zig build -Dplatform=tty --prefix ~/.local` for `pardes` in a terminal, or `-Dplatform=gui` for the `pardes-gui` window. -The terminal should report the mouse; Shift-Esc needs the kitty keyboard -protocol, and images need kitty graphics (else they are drawn as PETSCII +The terminal should report the mouse; Shift-Esc (the Esc a terminal +pane's program gets) needs the kitty keyboard protocol, and images need kitty graphics (else they are drawn as PETSCII glyphs). Run `pardes` or `pardes FILE`. Read the [guide](docs/typ/guide.typ) (about 15 minutes), then try `Tutor` diff --git a/docs/helix-keys.md b/docs/helix-keys.md index ddbab93b..0b71f60b 100644 --- a/docs/helix-keys.md +++ b/docs/helix-keys.md @@ -107,7 +107,7 @@ language-backend queries, and the shell pipe. | `gh` / `gl` | line start / line end (last char, not the newline) | | helix-verified | | `Ctrl-d` / `Ctrl-u` | half page down/up, cursor follows | matches `page_cursor_half_down/up` | helix-verified | | `Ctrl-f` | full page down | matches `page_down`; file panes only get `Ctrl-b` (see next row) | helix-verified | -| `Ctrl-b` | file panes: full page up. Terminal panes: **toggle raw tty/editor mode** (`opts.tty_toggle`, configurable; `Shift-Esc` also enters). In raw tty Shift-Esc goes to the child | tty toggle is pardes-specific and wins on terminals; harness `pane:"tty"` cases avoid `Ctrl-b` | helix-verified (file) / pardes-specific (tty) | +| `Ctrl-b` | file panes: full page up. Terminal panes: **toggle raw tty/editor mode** (`opts.tty_toggle`, configurable). In raw tty Esc runs `Last` and Shift-Esc goes to the child as a plain Esc (`ProgramEsc on` swaps them) | tty toggle is pardes-specific and wins on terminals; harness `pane:"tty"` cases avoid `Ctrl-b` | helix-verified (file) / pardes-specific (tty) | | `PageUp` / `PageDown` | full page | matches helix `page_up`/`page_down` (view scroll + cursor snap to the scrolloff edge) | helix-verified | | `zt` / `zz` / `zb` | scroll current line to top / center / bottom | matches `align_view_top/center/bottom` (helix harness pins scrolloff to pardes' 3) | helix-verified | | `Z` | sticky view mode: the `z` keys stay armed after each until Esc, which only leaves the mode; other keys do nothing meanwhile | helix's sticky view node | helix-verified | @@ -122,7 +122,7 @@ language-backend queries, and the shell pipe. | `y` | yank each range's text into the register (`"` names one, else `"`), one value per range | line-yank vim-ism removed (phase 5); yank keeps selection AND cursor (helix). The system clipboard is `"+y` / `SPC y`, helix's own split: a `d` of one character never clobbers what the desktop holds | helix-verified | | `u` / `U` | undo / redo | restores the pre-edit selection (helix); snapshot granularity, `Alt-u`/`Alt-U` are the same two: helix walks a history tree by time with them, and pardes's history is linear, so earlier and later ARE undo and redo | helix-verified | | `p` (normal) | paste the register after each range: value i at range i, the last value repeated when there are fewer | helix `paste_impl`. `"+p` asks the system clipboard (`SPC p`); on a tty that read is OSC 52, which most terminals refuse: an honest no-op rather than a paste of the wrong text | helix-verified | -| `Esc` (body normal) | clear a pending modal prefix / exit select mode, keeping the selection, then run `Last`: hop to the pane you were in before this one, whichever kind it was, exactly like `SPC j j` — so held down it alternates between two panes, two files as readily as a file and its shell. A PDF pane is the ONE exception: there Esc is the document's own cancel (drop the mouse selection and the search overlay, stay where you are reading) and `Shift-Esc` is the hop out, while raw tty only intercepts unmodified Esc at a detected shell prompt | Pardes-specific focus binding layered on helix's cleanup. A leader path, tag, topbar or search owns Esc while it is active; raw tty forwards it | pardes-specific (cleanup helix-verified) | +| `Esc` (body normal) | clear a pending modal prefix / exit select mode, keeping the selection, then run `Last`: hop to the pane you were in before this one, whichever kind it was, exactly like `SPC j j` — so held down it alternates between two panes, two files as readily as a file and its shell. A PDF pane is the ONE exception: there Esc is the document's own cancel (drop the mouse selection and the search overlay, stay where you are reading) and `Shift-Esc` is the hop out, while raw tty takes unmodified Esc as `Last` and sends Shift-Esc to the program (with `ProgramEsc on`, Esc goes to the program except at a detected shell prompt) | Pardes-specific focus binding layered on helix's cleanup. A leader path, tag, topbar or search owns Esc while it is active; raw tty forwards it | pardes-specific (cleanup helix-verified) | | `Esc` (insert) | back to normal mode, cursor right after the insertion (no vim left-step) | | helix-verified | | `Enter` (normal) | acme **look** chord: EXPLICIT selection, else file-ish word under cursor | pardes-specific, keep (helix normal-mode Enter unbound). Covers helix `gf`. Implicit motion residue falls back to the cursor word | pardes-specific | | `Tab` (normal) | acme **execute** chord | pardes-specific, keep; explicit-selection rule as Enter | pardes-specific | diff --git a/docs/typ/builtins-gui.json b/docs/typ/builtins-gui.json index f602ee92..851b8673 100644 --- a/docs/typ/builtins-gui.json +++ b/docs/typ/builtins-gui.json @@ -109,6 +109,7 @@ {"name": "Pet", "leader": null, "also": [], "arg": true, "scope": "root", "setting": false, "choices": null, "doc": "An optional SDL workspace-tag companion; never consumes input or text cells."}, {"name": "Petscii", "leader": "SPC t p", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "glyph art over the host's pixels: an image pane's picture, or the kitty graphics a terminal's program placed (yazi's previews)"}, {"name": "Placement", "leader": "SPC c p", "also": [], "arg": true, "scope": "root", "setting": true, "choices": "acme, pardes", "doc": "Where a new pane goes: acme, as makenewwindow does, or pardes, the older rules."}, + {"name": "ProgramEsc", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "In a raw terminal, Esc goes to the program and Shift-Esc backs out, on; off (the default) swaps them."}, {"name": "Putall", "leader": null, "also": [], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "acme's Putall: every pane holding unsaved edits to a file is saved, each as its own Save; one that is refused (changed on disk since, a write that fails) says so and the rest are saved all the same."}, {"name": "Recent", "leader": "SPC f r", "also": [], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "List the files opened lately, closed ones too, each a place to open again."}, {"name": "Redo", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Redo the last undone edit."}, diff --git a/docs/typ/builtins-tty.json b/docs/typ/builtins-tty.json index e02f4201..e1276117 100644 --- a/docs/typ/builtins-tty.json +++ b/docs/typ/builtins-tty.json @@ -96,6 +96,7 @@ {"name": "PdfTint", "leader": "SPC t i", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Tint the PDF page to the theme, or show it as printed, stepping through them (or to the one named, `disabled|filtered|full`)."}, {"name": "Petscii", "leader": "SPC t p", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "glyph art over the host's pixels: an image pane's picture, or the kitty graphics a terminal's program placed (yazi's previews)"}, {"name": "Placement", "leader": "SPC c p", "also": [], "arg": true, "scope": "root", "setting": true, "choices": "acme, pardes", "doc": "Where a new pane goes: acme, as makenewwindow does, or pardes, the older rules."}, + {"name": "ProgramEsc", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "In a raw terminal, Esc goes to the program and Shift-Esc backs out, on; off (the default) swaps them."}, {"name": "Putall", "leader": null, "also": [], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "acme's Putall: every pane holding unsaved edits to a file is saved, each as its own Save; one that is refused (changed on disk since, a write that fails) says so and the rest are saved all the same."}, {"name": "Recent", "leader": "SPC f r", "also": [], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "List the files opened lately, closed ones too, each a place to open again."}, {"name": "Redo", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Redo the last undone edit."}, diff --git a/docs/typ/cheatsheet.typ b/docs/typ/cheatsheet.typ index d2df7e70..36bff0a7 100644 --- a/docs/typ/cheatsheet.typ +++ b/docs/typ/cheatsheet.typ @@ -72,8 +72,8 @@ Helix-style: motions *select*, then an edit acts on the selection. Mode box: bla == Keys: panes #pairs( [#key("Ctrl-w") #keys("h", "j", "k", "l")], [then a direction: focus a neighbour (not in insert or raw `$`)], - [#key("Esc")], [back to the previous pane (raw: only at a prompt with nothing typed; insert: to normal)], - [#key("Shift-Esc")], [back to the previous pane from any mode, with the kitty keyboard protocol or in the GUI; elsewhere a plain Esc], + [#key("Esc")], [back to the previous pane (insert: to normal)], + [#key("Shift-Esc")], [back to the previous pane from any mode but raw, where it is the program's Esc; needs the kitty keyboard protocol or the GUI, elsewhere a plain Esc], [#keys("Ctrl-o", "Ctrl-i")], [jump history back, forward; this file first], [#key("Alt-n")], [new terminal below], [#key("Alt-c")], [move the pane to a new column], diff --git a/docs/typ/guide.typ b/docs/typ/guide.typ index 7058592f..93bc653a 100644 --- a/docs/typ/guide.typ +++ b/docs/typ/guide.typ @@ -42,7 +42,7 @@ steps raw, normal, insert. #pairs( [#mode-box(" ") normal], [#key("Esc"): back to the previous pane (#word("Last")), unlike helix. #key("Shift-Esc"): the same.], [#mode-box("^") insert], [#key("Esc"): back to normal. #key("Shift-Esc"): out of insert and back to the previous pane.], - [#mode-box("$") raw], [#key("Esc"): to the program, except at a shell prompt with nothing typed on it, where it goes back to the previous pane. #key("Shift-Esc"): always back. Either way the terminal stays raw.], + [#mode-box("$") raw], [#key("Esc"): back to the previous pane. #key("Shift-Esc"): an Esc to the program. Either way the terminal stays raw. #word("ProgramEsc") `on` swaps them back: #key("Esc") goes to the program, except at a shell prompt with nothing typed on it, and #key("Shift-Esc") always goes back.], [a PDF], [#key("Esc"): clears the selection and the search highlights. #key("Shift-Esc"): back to the previous pane.], ) diff --git a/docs/typ/reference.typ b/docs/typ/reference.typ index 05176951..455d2645 100644 --- a/docs/typ/reference.typ +++ b/docs/typ/reference.typ @@ -415,6 +415,7 @@ word clicked in a tag does. The same lines go in the startup file [#word("MessageAnimation")], [on: messages ease in and dissolve], [#word("MessageLinger"), #word("MessageFall"), #word("MessageDissolve")], [800, 180, 150 milliseconds, at most 60000], [#word("PagerColor")], [on: the next paged text keeps its colours], + [#word("ProgramEsc")], [off: in a raw terminal #key("Esc") goes back a pane and #key("Shift-Esc") is the program's Esc; on swaps them, and #key("Esc") goes back only at an empty shell prompt], [#word("Pager") `pardes|off`], [`pardes`: what a terminal's commands page through, `pardes -`; `off` leaves `PAGER`, `GIT_PAGER` and `SYSTEMD_PAGER` as the environment has them (#doc("fs", section: "pardes-stdin")). It applies to terminals started after it], [#word("Placement") `acme|pardes`], [`acme`: where new panes go (#doc("fs", section: "placement"))], [#word("BootShell") `keep|replace`], [`keep`; `replace` closes the untouched lone shell a dragged document lands beside], @@ -969,7 +970,7 @@ it was. = On screen -- *Esc at a prompt.* pardes knows a shell prompt with nothing typed on it +- *Esc at a prompt* (with #word("ProgramEsc") on). pardes knows a shell prompt with nothing typed on it from the OSC 133 marks it injects into bash and fish (marks a shell sends itself do not count); for other shells, from no program holding the terminal, typed text or not. diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index 362aaf5b..76a1fd56 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -24,6 +24,11 @@ scroll as it glides, instead of jumping a row of the track at a time. - A click in another pane glides the cursor once, straight to where it was clicked, no longer first to that pane's old cursor. +- Esc in a raw terminal goes back to the previous pane, as it does from + normal mode; Shift-Esc sends the program its Esc. `ProgramEsc on` + restores the old way round. A terminal without the kitty keyboard + protocol sends Shift-Esc as a plain Esc, so under one a program gets + no Esc unless ProgramEsc is on. - Built with Zig 0.17. A bare `zig build` still puts the binaries in `~/.local/bin`, now as a copy beside the prefix, which `--prefix` no diff --git a/src/config.zig b/src/config.zig index 8166954d..f3cc0948 100644 --- a/src/config.zig +++ b/src/config.zig @@ -153,6 +153,7 @@ pub const leader_path = paths: { table.set(.JumpTrail, null); table.set(.ChipShadow, null); table.set(.ThumbFlash, null); + table.set(.ProgramEsc, null); if (builtins.capabilities.lift) table.set(.Lift, null); table.set(.Motion, null); table.set(.InactiveDim, null); @@ -283,8 +284,9 @@ pub const jump_keys = [_]struct { chord: Chord, cmd: Builtin }{ }; /// Shift-Esc: the Esc nothing swallows. In every mode and pane it does what -/// Esc does from normal mode, back to the previous pane (Last); a raw -/// terminal's program never sees it. Ctrl-b alone toggles raw. +/// Esc does from normal mode, back to the previous pane (Last); in a raw +/// terminal plain Esc does it and Shift-Esc is the program's Esc, unless +/// ProgramEsc is on. Ctrl-b alone toggles raw. pub const back_out: []const Chord = &.{.{ .cp = Key.escape, .shift = true }}; pub const tty_toggle_default: u21 = 'b'; @@ -764,6 +766,9 @@ pub const Runtime = struct { /// T7: in a terminal, a pane's scroll thumb brightens as it scrolls and /// fades back (truecolor terminals). thumb_flash: bool = false, + /// In a raw terminal, Esc goes to the program and Shift-Esc backs out + /// (off, the default: Esc backs out and Shift-Esc is the program's). + program_esc: bool = false, /// How long a message stays after the key or click that dismisses it. message_linger_ms: u16 = 800, /// How long its fall into the row takes, easing out (§8.1: arriving, @@ -1022,7 +1027,7 @@ pub const Runtime = struct { /// The message timings a setting word sets, each in milliseconds. pub const MessageTime = enum { linger, fall, dissolve }; - pub const Toggle = enum { colors, wrap, tree_context_tag_style, tag_bottom, debug, focus_tint, syntax_bold, pager_color, verbose, message_animation, ligatures, cursor_blink, selection_glow, hover_glow, occlusion, parallax, jump_trail, chip_shadow, thumb_flash }; + pub const Toggle = enum { colors, wrap, tree_context_tag_style, tag_bottom, debug, focus_tint, syntax_bold, pager_color, verbose, message_animation, ligatures, cursor_blink, selection_glow, hover_glow, occlusion, parallax, jump_trail, chip_shadow, thumb_flash, program_esc }; /// A bundled post pass, a Shadertoy file in shaders/post/: the CRT, and /// G4's bloom, vignette and grain (docs/effects.md). pub const Scene = enum { crt, bloom, vignette, grain }; @@ -1090,6 +1095,7 @@ pub const Runtime = struct { .{ .word = "JumpTrail", .action = .{ .toggle = .jump_trail }, .doc = "In a terminal, a jump of the cursor leaves a short trail that fades, on or off." }, .{ .word = "ChipShadow", .action = .{ .toggle = .chip_shadow }, .doc = "In a terminal, a notice chip casts a cell's shadow right and down, on or off." }, .{ .word = "ThumbFlash", .action = .{ .toggle = .thumb_flash }, .doc = "In a terminal, a pane's scroll thumb brightens as it scrolls and fades back, on or off." }, + .{ .word = "ProgramEsc", .action = .{ .toggle = .program_esc }, .doc = "In a raw terminal, Esc goes to the program and Shift-Esc backs out, on; off (the default) swaps them." }, .{ .word = "Lift", .action = .lift, .availability = .lift, .doc = "How the focused pane stands off the page: off, shadow, rim or auto." }, .{ .word = "Motion", .action = .motion, .doc = "How animations move: off, crisp, smooth, bouncy or playful." }, .{ .word = "InactiveDim", .action = .inactive_dim, .doc = "Fade the unfocused panes' text by a percentage, 0 through 100, 0 off." }, @@ -1876,6 +1882,7 @@ pub const Runtime = struct { .jump_trail => "JumpTrail on\n", .chip_shadow => "ChipShadow on\n", .thumb_flash => "ThumbFlash on\n", + .program_esc => "ProgramEsc on\n", }, .shell => "Shell fish\n", .tagline_size => "TaglineSize 73\n", diff --git a/src/pardes.zig b/src/pardes.zig index 72470490..c885acc2 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -6374,10 +6374,23 @@ pub const Pardes = struct { } const pane = p.panes[p.active] orelse return; p.noteTyped(); + // In a raw terminal the two Escs swap unless ProgramEsc is on: Esc + // backs out, and Shift-Esc is the program's, sent as a plain Esc. + const raw_esc = key.cp == Key.escape and !key.ctrl and !key.alt and !p.settings.program_esc and + pane.isTerminal() and pane.body.mode == .tty and pane.focus == .body and pane.prompt == .none and + tagline.focusedHeader(p) == null; + if (raw_esc and key.shift) { + p.leader_on = false; + p.ctrl_w_pending = false; + panes.terminal.followOutput(pane); + var plain = key; + plain.shift = false; + return panes.terminal.forwardKey(p, p.active, plain); + } // Shift-Esc backs out of whatever the pane is in -- a prompt, insert // mode, a pending count, a raw program -- to the previous pane, as // Esc does from normal mode. Nothing under it sees the key. - if (hit(key, config.back_out)) { + if (raw_esc or hit(key, config.back_out)) { p.leader_on = false; p.ctrl_w_pending = false; if (pane.prompt != .none) { @@ -6405,8 +6418,8 @@ pub const Pardes = struct { p.ctrl_w_pending = false; if (key.ctrl and !key.alt and key.cp == p.opts.tty_toggle) return p.toggleTty(p.active); - // Bare Escape leaves only at a shell prompt (Shift-Esc, above, - // always). + // With ProgramEsc on, bare Escape leaves only at a shell prompt + // (Shift-Esc, above, always). if (key.cp == Key.escape and !key.ctrl and !key.alt and !key.shift and exec.takesCommandLine(p, p.active)) return exec.runBuiltin(p, .Last, p.active, "", null); panes.terminal.followOutput(pane); // typing snaps back to live output @@ -8442,10 +8455,36 @@ test "Esc back into a file leaves its view where it was" { try std.testing.expectEqual(@as(usize, @intCast(row)) -| @as(usize, dp.rows) / 2, dp.file.?.scroll); } -test "raw tty Escape only leaves at a shell prompt" { +test "raw tty Esc backs out and Shift-Esc is the program's Esc" { + if (platform == .web) return; + const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 24, .file = "mise.toml" }); + defer p.deinit(); + _ = exec.spawnTty(p, 0); + const shell = p.active; + const pane = p.panes[shell].?; + var buf: [256]u8 = undefined; + _ = drainWrites(p, &buf); + + p.update(.{ .key = .{ .cp = 'x', .text = "x" } }); + _ = drainWrites(p, &buf); + p.update(.{ .key = .{ .cp = Key.escape } }); // past typed text too + try std.testing.expectEqual(@as(usize, 0), p.active); + try std.testing.expectEqualStrings("", drainWrites(p, &buf)); + try std.testing.expectEqual(Text.Mode.tty, pane.body.mode); + + p.update(.{ .key = .{ .cp = Key.escape } }); // back into the shell + try std.testing.expectEqual(shell, p.active); + _ = drainWrites(p, &buf); + p.update(.{ .key = .{ .cp = Key.escape, .shift = true } }); + try std.testing.expectEqual(shell, p.active); + try std.testing.expectEqualStrings("\x1b", drainWrites(p, &buf)); +} + +test "with ProgramEsc raw tty Escape only leaves at a shell prompt" { if (platform == .web) return; const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 24, .file = "mise.toml" }); defer p.deinit(); + p.settings.program_esc = true; _ = exec.spawnTty(p, 0); const shell = p.active; const pane = p.panes[shell].?; diff --git a/src/tutor.txt b/src/tutor.txt index 8f5cf241..5df02f1a 100644 --- a/src/tutor.txt +++ b/src/tutor.txt @@ -29,8 +29,8 @@ pane you were in before (not what helix does). Come back with Esc again. 3. Press Alt-n: a terminal opens, in NORMAL mode. Press Ctrl-b: its - box shows $ (RAW), and keys go to the shell. At its empty prompt, - Esc brings you back here; the terminal stays $. + box shows $ (RAW), and keys go to the shell. Esc brings you back + here; the terminal stays $. Shift-Esc sends the shell an Esc. -> Guide: Modes diff --git a/test/snapshots/builtins.golden b/test/snapshots/builtins.golden index b9d5c5b2..9eb9718b 100644 --- a/test/snapshots/builtins.golden +++ b/test/snapshots/builtins.golden @@ -59,8 +59,8 @@ |44: 29 pane you were in before (not what helix does). Come back with |45: 30 Esc again. |46: 31 3. Press Alt-n: a terminal opens, in NORMAL mode. Press Ctrl-b: its -|47: 32 box shows $ (RAW), and keys go to the shell. At its empty prompt, -|48: 33 Esc brings you back here; the terminal stays $. +|47: 32 box shows $ (RAW), and keys go to the shell. Esc brings you back +|48: 33 here; the terminal stays $. Shift-Esc sends the shell an Esc. |49: 34 |50: 35 -> Guide: Modes |51: 36 diff --git a/test/snapshots/builtins.snap b/test/snapshots/builtins.snap index fc0ab796..c59b79d6 100644 --- a/test/snapshots/builtins.snap +++ b/test/snapshots/builtins.snap @@ -32,6 +32,7 @@ wheel up 110 50 wheel up 110 50 wheel up 110 50 wheel up 110 50 +wheel up 110 50 wait 10000 Look enter, right-click wait 10000 Exec tab, middle-click wait 10000 Filter -- cgit v1.3 From 3643635640e97eb2e43730d58fcc46214e21851e Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 21 Oct 2026 21:42:33 -0300 Subject: Window mode: pick the pane to focus with an outline or a label --- docs/helix-keys.md | 4 +- docs/ideas.typ | 4 +- docs/typ/builtins-gui.json | 9 ++-- docs/typ/builtins-tty.json | 9 ++-- docs/typ/cheatsheet.typ | 4 +- docs/typ/guide.typ | 2 +- docs/typ/reference.typ | 6 ++- src/CHANGELOG.md | 7 +++ src/builtins.zig | 10 +++++ src/config.zig | 14 +++--- src/draw.zig | 17 +++++++- src/layout.zig | 72 ++++++++++++++++++++++++++++--- src/mouse.zig | 1 + src/pardes.zig | 85 +++++++++++++++++++++++++++++++------ src/tutor.txt | 7 +-- test/panes.zig | 3 ++ test/pdf.zig | 2 + test/snapshots/builtins.golden | 12 +++--- test/snapshots/builtins.snap | 11 +++-- test/snapshots/cornerdrag-left.snap | 2 +- test/snapshots/delask.golden | 3 +- test/snapshots/delask.snap | 4 +- test/snapshots/doccol.snap | 4 +- test/snapshots/jumps.golden | 1 - test/snapshots/jumps.snap | 2 +- test/snapshots/leader.golden | 12 +++--- test/snapshots/leader.snap | 10 +++-- test/snapshots/lspdebug.snap | 6 +-- test/snapshots/tagalign2col.golden | 3 +- test/snapshots/tagalign2col.snap | 2 +- test/snapshots/tagnav.golden | 5 +-- test/snapshots/tagnav.snap | 16 +++---- test/snapshots/windownav.golden | 8 +--- test/snapshots/windownav.snap | 27 ++++++------ test/snapshots/windowops.golden | 2 - test/snapshots/windowops.snap | 10 ++--- 36 files changed, 277 insertions(+), 119 deletions(-) (limited to 'docs/typ') diff --git a/docs/helix-keys.md b/docs/helix-keys.md index 0b71f60b..8155685f 100644 --- a/docs/helix-keys.md +++ b/docs/helix-keys.md @@ -127,8 +127,8 @@ language-backend queries, and the shell pipe. | `Enter` (normal) | acme **look** chord: EXPLICIT selection, else file-ish word under cursor | pardes-specific, keep (helix normal-mode Enter unbound). Covers helix `gf`. Implicit motion residue falls back to the cursor word | pardes-specific | | `Tab` (normal) | acme **execute** chord | pardes-specific, keep; explicit-selection rule as Enter | pardes-specific | | `:` (normal, body or tag) | in the body, focuses the pane's tag in normal mode at its remembered cursor (the first time, on `Save`); in the tag, goes back to the body; in a column or workspace tag, back to the active pane. The tag's normal and insert modes ARE the body's: every motion, selection, edit and undo works there, and `0` goes to the line's start, the path's. Tab runs the word under the cursor or the selection and Enter looks it up (in a column or workspace tag Enter runs it too), and either hands the keyboard back to the body first. Clicks choose a new cursor position and type into the tag. | Each tag keeps its own cursor during the session. The computed path/marker/page is reachable and yankable but read-only: an edit into it is refused, and typing into a file's path drafts a new name. File-name changes are staged as described in [editable tags](typ/guide.typ). | pardes-specific | -| `Ctrl-w k` / `SPC w k` (pane with nothing above) | focuses its column's tag, then the workspace tag. `Ctrl-w j` walks back to the panes, `Ctrl-w h`/`l` walk the column tags. Headers edit exactly as a pane tag does. | Column commands target that column's active pane, or its first pane when coming from elsewhere. Workspace and column text are independently editable and persist in dumps. See [editable tags](typ/guide.typ). | pardes-specific | -| `Ctrl-w` + `h/j/k/l`/arrows | directional pane focus prefix — editor normal mode only | pardes' own window handling (helix window mode skipped, section C). Runs the SAME `Left`/`Down`/`Up`/`Right` builtins `SPC w h/j/k/l` runs; Raw **tty** mode forwards Ctrl-w to the child. Insert mode owns `Ctrl-w` = delete-word-back, so a tag being TYPED into swallows it; from a tag in normal mode it moves focus to the neighbour's BODY, as from a body, and from the top pane `Up` reaches the column and workspace tags | pardes-specific | +| `Ctrl-w k` / `SPC w k` (window mode, pane with nothing above) | focuses its column's tag, then the workspace tag. `Ctrl-w j` walks back to the panes, `Ctrl-w h`/`l` walk the column tags. Headers edit exactly as a pane tag does. | Column commands target that column's active pane, or its first pane when coming from elsewhere. Workspace and column text are independently editable and persist in dumps. See [editable tags](typ/guide.typ). | pardes-specific | +| `Ctrl-w` / `SPC w`, then `h/j/k/l`/arrows | window mode (`Window`): an outline moves between panes, `Enter`/`Esc` focuses it, a pane's label letter focuses that pane — editor normal mode only | pardes' own window handling (helix window mode skipped, section C). On a header `Ctrl-w` stays a prefix for the `Left`/`Down`/`Up`/`Right` header walk; Raw **tty** mode forwards Ctrl-w to the child. Insert mode owns `Ctrl-w` = delete-word-back, so a tag being TYPED into swallows it; from a tag in normal mode it moves focus to the neighbour's BODY, as from a body, and from the top pane `Up` reaches the column and workspace tags | pardes-specific | | `Alt-n` | new terminal below (outside raw tty) | shadows helix `Alt-n` (select next sibling), which pardes spells `Alt-right` alone | pardes-specific | | `Alt-c` | move active terminal to a fresh column (outside raw tty) | helix `Alt-c` is change-noyank; the pardes window op wins (do-not-touch contract). `Alt-d` + `i` covers the behavior | waived (`alt-c-window-op`) | | `Space` (normal, body) | starts the pardes LEADER: a key path runs the same builtin words used by tags and the topbar. The main groups are `f` files, `h` docs, `c` columns, `t` toggles/effects, `a` panel animations, `s` session, `j` jumps, `l` language, and `w` directional focus; `SPC ?` lists every path and ` ?` lists one group in `+Help`. Neither `Exit` (quits the editor, acme's Exit) nor `Kill` (stops the commands pardes typed into terminals, acme's Kill) has a leader path: both are the topbar's and the root `ctl`'s. The pending path appears on the active pane's transient body/message row. Esc or an unmapped key abandons it. Paths, Help rows, and dispatch are all generated from the builtin registry at comptime; the leader applies only to a BODY in normal mode because tags and tty programs own their input | pardes-specific; helix spends Space on pickers/LSP (section C), while pardes uses acme-style executable words | diff --git a/docs/ideas.typ b/docs/ideas.typ index 2485e3f9..87782dc5 100644 --- a/docs/ideas.typ +++ b/docs/ideas.typ @@ -31,7 +31,9 @@ - the gap it fills: sending from a pane no REPL routes (a .txt, a scratch, a README) without binding anything -- OPEN (2026-10-01): an explicit pane picker for moving between panes +- DONE (2026-10-21, window mode: SPC w / Ctrl-w enter, h/j/k/l move the + outline, Enter or Esc commits, labels always shown, other keys ignored): + an explicit pane picker for moving between panes - the problem: SPC w h/l into a column that lands on a raw terminal leaves the keys with its program, so Ctrl-w/SPC can't move on without Ctrl-b or the mouse (raw terminals must keep Ctrl-w: bash deletes a word with it) diff --git a/docs/typ/builtins-gui.json b/docs/typ/builtins-gui.json index 851b8673..cb5f1060 100644 --- a/docs/typ/builtins-gui.json +++ b/docs/typ/builtins-gui.json @@ -34,7 +34,7 @@ {"name": "Diff", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Stack a diff's hunks as a diff viewer shows them, each under its place and the declarations around it, in a +Diff; on a +Diff, show the diff itself as text."}, {"name": "DiffLook", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "hunks, text", "doc": "A .diff or .patch looked at: hunks, a +Diff stacking its hunks, or text, the file itself; Diff goes from one to the other."}, {"name": "DirLook", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "pane, terminal", "doc": "A directory looked at: pane, a pane listing it as acme's directory window, or terminal, ls in a terminal there."}, - {"name": "Down", "leader": "SPC w j", "also": ["C-w j", "C-w down"], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Move the keyboard to the pane below, off a tag onto the pane under it."}, + {"name": "Down", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Move the keyboard to the pane below, off a tag onto the pane under it."}, {"name": "Dump", "leader": "SPC s d", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "Write the session's panes and layout to a dump file, for Restore."}, {"name": "DumpConfig", "leader": null, "also": [], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "Open the settings in effect, each a word to click, and the startup file's path."}, {"name": "DumpDir", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "The directory Dump writes to and a relative Restore reads from; bare, the default."}, @@ -64,7 +64,7 @@ {"name": "Jumplist", "leader": "SPC j l", "also": [], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "List the places jumped from, each a place to go."}, {"name": "Kill", "leader": null, "also": [], "arg": true, "scope": "root", "setting": false, "choices": null, "doc": "acme's Kill: stop the commands pardes started -- the lines it typed into a terminal, from an exec, a middle click or a pty/run, while their shell says they run (C mark to D)."}, {"name": "Last", "leader": "SPC j j", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Go back to the last place jumped from in another pane."}, - {"name": "Left", "leader": "SPC w h", "also": ["C-w h", "C-w left"], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Move the keyboard to the pane, or column tag, to the left."}, + {"name": "Left", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Move the keyboard to the pane, or column tag, to the left."}, {"name": "Lift", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off, shadow, rim, auto", "doc": "How the focused pane stands off the page: off, shadow, rim or auto."}, {"name": "Ligatures", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "A font's programming ligatures draw across their cells, on or off."}, {"name": "LocationsConfig", "leader": null, "also": [], "arg": true, "scope": "root", "setting": false, "choices": null, "doc": "Set how location rows are drawn, or show how they are when bare."}, @@ -117,7 +117,7 @@ {"name": "Rename", "leader": "SPC l r", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Rename the symbol under the cursor everywhere, to its argument."}, {"name": "Repl", "leader": null, "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Binds this terminal as a language's REPL, so an exec on that language's files is typed into it instead of run."}, {"name": "Restore", "leader": "SPC s r", "also": [], "arg": true, "scope": "root", "setting": false, "choices": null, "doc": "Replace every pane with those of a dump file, the last one Dump wrote when bare."}, - {"name": "Right", "leader": "SPC w l", "also": ["C-w l", "C-w right"], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Move the keyboard to the pane, or column tag, to the right."}, + {"name": "Right", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Move the keyboard to the pane, or column tag, to the right."}, {"name": "Save", "leader": "SPC f s", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Write the pane's text to its file, or to the file its argument names."}, {"name": "SelectRefs", "leader": "SPC l h", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Select every reference to the symbol under the cursor."}, {"name": "SelectionGlow", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "A soft halo of the selection's colour round it in the body, on or off."}, @@ -144,9 +144,10 @@ {"name": "Tutor", "leader": "SPC h t", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "Open the tutor, a document to work through."}, {"name": "Undo", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "acme's Undo and Redo: step the pane's body back or forward through its edits, from a tag, a pane ctl or exec."}, {"name": "Unmount", "leader": null, "also": [], "arg": true, "scope": "root", "setting": false, "choices": null, "doc": "Unmount the 9P tree mounted under /n/."}, - {"name": "Up", "leader": "SPC w k", "also": ["C-w k", "C-w up"], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Move the keyboard to the pane above, and from a column's top pane to its tag."}, + {"name": "Up", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Move the keyboard to the pane above, and from a column's top pane to its tag."}, {"name": "Verbose", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "A builtin says its own name on the message row as it runs, on or off."}, {"name": "Vignette", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off, 0-3", "doc": "The window's corners fall into shade: a level, 0 (off) through 3."}, + {"name": "Window", "leader": "SPC w", "also": ["C-w"], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Window mode: h/j/k/l move an outline between the panes; Enter or Esc focuses the outlined pane, `:` its tag, the letter shown on a pane that one."}, {"name": "WindowOpacity", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "The window's opacity, a percentage."}, {"name": "Wrap", "leader": "SPC t w", "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "Long lines wrap onto the next row, on or off."}, {"name": "WsDiagnostics", "leader": "SPC l D", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "List the workspace's diagnostics from the language server."}, diff --git a/docs/typ/builtins-tty.json b/docs/typ/builtins-tty.json index e1276117..7490bbd7 100644 --- a/docs/typ/builtins-tty.json +++ b/docs/typ/builtins-tty.json @@ -31,7 +31,7 @@ {"name": "Diff", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Stack a diff's hunks as a diff viewer shows them, each under its place and the declarations around it, in a +Diff; on a +Diff, show the diff itself as text."}, {"name": "DiffLook", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "hunks, text", "doc": "A .diff or .patch looked at: hunks, a +Diff stacking its hunks, or text, the file itself; Diff goes from one to the other."}, {"name": "DirLook", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "pane, terminal", "doc": "A directory looked at: pane, a pane listing it as acme's directory window, or terminal, ls in a terminal there."}, - {"name": "Down", "leader": "SPC w j", "also": ["C-w j", "C-w down"], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Move the keyboard to the pane below, off a tag onto the pane under it."}, + {"name": "Down", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Move the keyboard to the pane below, off a tag onto the pane under it."}, {"name": "Dump", "leader": "SPC s d", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "Write the session's panes and layout to a dump file, for Restore."}, {"name": "DumpConfig", "leader": null, "also": [], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "Open the settings in effect, each a word to click, and the startup file's path."}, {"name": "DumpDir", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "The directory Dump writes to and a relative Restore reads from; bare, the default."}, @@ -56,7 +56,7 @@ {"name": "Jumplist", "leader": "SPC j l", "also": [], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "List the places jumped from, each a place to go."}, {"name": "Kill", "leader": null, "also": [], "arg": true, "scope": "root", "setting": false, "choices": null, "doc": "acme's Kill: stop the commands pardes started -- the lines it typed into a terminal, from an exec, a middle click or a pty/run, while their shell says they run (C mark to D)."}, {"name": "Last", "leader": "SPC j j", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Go back to the last place jumped from in another pane."}, - {"name": "Left", "leader": "SPC w h", "also": ["C-w h", "C-w left"], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Move the keyboard to the pane, or column tag, to the left."}, + {"name": "Left", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Move the keyboard to the pane, or column tag, to the left."}, {"name": "LocationsConfig", "leader": null, "also": [], "arg": true, "scope": "root", "setting": false, "choices": null, "doc": "Set how location rows are drawn, or show how they are when bare."}, {"name": "Look", "leader": null, "also": ["enter", "right-click"], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Look at its argument: open the file or address it names, else find the word, as a right click does."}, {"name": "LookNext", "leader": "SPC j n", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Select the next Look location across panes; Enter opens it."}, @@ -104,7 +104,7 @@ {"name": "Rename", "leader": "SPC l r", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Rename the symbol under the cursor everywhere, to its argument."}, {"name": "Repl", "leader": null, "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Binds this terminal as a language's REPL, so an exec on that language's files is typed into it instead of run."}, {"name": "Restore", "leader": "SPC s r", "also": [], "arg": true, "scope": "root", "setting": false, "choices": null, "doc": "Replace every pane with those of a dump file, the last one Dump wrote when bare."}, - {"name": "Right", "leader": "SPC w l", "also": ["C-w l", "C-w right"], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Move the keyboard to the pane, or column tag, to the right."}, + {"name": "Right", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Move the keyboard to the pane, or column tag, to the right."}, {"name": "Save", "leader": "SPC f s", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Write the pane's text to its file, or to the file its argument names."}, {"name": "SelectRefs", "leader": "SPC l h", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Select every reference to the symbol under the cursor."}, {"name": "Shell", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": null, "doc": "The shell new terminals run; bare, $SHELL if it is executable, else /bin/sh."}, @@ -127,8 +127,9 @@ {"name": "Tutor", "leader": "SPC h t", "also": ["topbar"], "arg": false, "scope": "root", "setting": false, "choices": null, "doc": "Open the tutor, a document to work through."}, {"name": "Undo", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "acme's Undo and Redo: step the pane's body back or forward through its edits, from a tag, a pane ctl or exec."}, {"name": "Unmount", "leader": null, "also": [], "arg": true, "scope": "root", "setting": false, "choices": null, "doc": "Unmount the 9P tree mounted under /n/."}, - {"name": "Up", "leader": "SPC w k", "also": ["C-w k", "C-w up"], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Move the keyboard to the pane above, and from a column's top pane to its tag."}, + {"name": "Up", "leader": null, "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Move the keyboard to the pane above, and from a column's top pane to its tag."}, {"name": "Verbose", "leader": null, "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "A builtin says its own name on the message row as it runs, on or off."}, + {"name": "Window", "leader": "SPC w", "also": ["C-w"], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "Window mode: h/j/k/l move an outline between the panes; Enter or Esc focuses the outlined pane, `:` its tag, the letter shown on a pane that one."}, {"name": "Wrap", "leader": "SPC t w", "also": [], "arg": true, "scope": "root", "setting": true, "choices": "on, off", "doc": "Long lines wrap onto the next row, on or off."}, {"name": "WsDiagnostics", "leader": "SPC l D", "also": [], "arg": false, "scope": "pane", "setting": false, "choices": null, "doc": "List the workspace's diagnostics from the language server."}, {"name": "WsSymbols", "leader": "SPC l S", "also": [], "arg": true, "scope": "pane", "setting": false, "choices": null, "doc": "Search the workspace's symbols for its argument."}, diff --git a/docs/typ/cheatsheet.typ b/docs/typ/cheatsheet.typ index 36bff0a7..90c59518 100644 --- a/docs/typ/cheatsheet.typ +++ b/docs/typ/cheatsheet.typ @@ -71,7 +71,7 @@ Helix-style: motions *select*, then an edit acts on the selection. Mode box: bla == Keys: panes #pairs( - [#key("Ctrl-w") #keys("h", "j", "k", "l")], [then a direction: focus a neighbour (not in insert or raw `$`)], + [#key("Ctrl-w")], [window mode: #keys("h", "j", "k", "l") move the outline, #key("Enter")/#key("Esc") or a pane's letter focuses (not in insert or raw `$`)], [#key("Esc")], [back to the previous pane (insert: to normal)], [#key("Shift-Esc")], [back to the previous pane from any mode but raw, where it is the program's Esc; needs the kitty keyboard protocol or the GUI, elsewhere a plain Esc], [#keys("Ctrl-o", "Ctrl-i")], [jump history back, forward; this file first], @@ -91,7 +91,7 @@ Helix-style: motions *select*, then an edit acts on the selection. Mode box: bla key("SPC d"), word("Del"), key("SPC n t"), word("Tty"), key("SPC n 9"), word("Tty9p"), - key("SPC w h"), [focus left], + key("SPC w"), word("Window"), key("SPC j j"), word("Last"), key("SPC j l"), word("Jumplist"), key("SPC y"), [clip yank], diff --git a/docs/typ/guide.typ b/docs/typ/guide.typ index 93bc653a..2833f705 100644 --- a/docs/typ/guide.typ +++ b/docs/typ/guide.typ @@ -54,7 +54,7 @@ it is a plain Esc. The previous pane is the last one you jumped from, else the next pane down the column. #pairs( - [#key("Ctrl-w") #key("h")], [the keyboard to the pane on the left; #key("j") below, #key("k") above, #key("l") right], + [#key("Ctrl-w") or #key("SPC w")], [window mode (#word("Window")): every pane shows a letter and the focused one is outlined; #keys("h", "j", "k", "l") move the outline, #key("Enter") or #key("Esc") gives that pane the keyboard, #key(":") its tag, a pane's letter gives it that one. #key("k") past a column's top pane goes on to its tag], [#keys("Ctrl-o", "Ctrl-i")], [back and forward through the places you jumped to (the jump list), this file's first: another file's only once it has none left that way (#word("JumpScope") `all`: every place in order)], ) diff --git a/docs/typ/reference.typ b/docs/typ/reference.typ index 455d2645..30ca9646 100644 --- a/docs/typ/reference.typ +++ b/docs/typ/reference.typ @@ -599,8 +599,10 @@ takes: (256 steps each), #word("Find") `pat`, #word("Edit") `...`, #word("Tty") `[shell]` (a new terminal in its directory), #word("Delcol") for its column, and #word("Left")/#word("Right")/#word("Up")/#word("Down"), which give the - keyboard to the pane beside it that way (#key("Ctrl-w") with - #keys("h", "l", "k", "j")), up from a column's top pane to its tag. + keyboard to the pane beside it that way, up from a column's top pane to + its tag; #word("Window") (#key("Ctrl-w"), #key("SPC w")) picks the pane + first: #keys("h", "j", "k", "l") move an outline, #key("Enter") or + #key("Esc") or a pane's letter focuses. - `get`: reload from the file (refused once over unsaved edits, `: Modified (get again to discard)`). It is an undo step, so #word("Undo") brings back what was there: the sure way back to the file on disk. - `lock`/`unlock` (acme's). The lock binds only clients that take it and belongs to the open that wrote it: `exec 3>$pane/ctl; echo lock >&3; ...; exec 3>&-`. A `lock` another open holds fails at once, `file in use` diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index 76a1fd56..6f94b98f 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -29,6 +29,13 @@ restores the old way round. A terminal without the kitty keyboard protocol sends Shift-Esc as a plain Esc, so under one a program gets no Esc unless ProgramEsc is on. +- Window mode (`Window`, Ctrl-w or SPC w): every pane shows a letter + and the focused one is outlined; h/j/k/l move the outline without + giving any pane the keys, Enter or Esc focuses the outlined pane, `:` + its tag, and a + pane's letter jumps straight to it. Ctrl-w h/j/k/l and SPC w h/j/k/l + no longer move the focus at once; on a column or workspace tag Ctrl-w + h/j/k/l still walk the tags. - Built with Zig 0.17. A bare `zig build` still puts the binaries in `~/.local/bin`, now as a copy beside the prefix, which `--prefix` no diff --git a/src/builtins.zig b/src/builtins.zig index 83966228..6ecd3c9e 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -1819,6 +1819,16 @@ pub const Right = struct { } }; +/// Window mode: h/j/k/l move an outline between the panes; Enter or Esc +/// focuses the outlined pane, `:` its tag, the letter shown on a pane that one. +pub const Window = struct { + pub fn run(c: Ctx) void { + tagline.exitHeader(c.p); + c.p.window_pick = if (c.p.panes[c.id] != null) c.id else c.p.active; + c.p.setMessage(c.p.window_pick.?, "Window: h/j/k/l move, Enter or Esc focuses the outlined pane, : its tag, a letter that pane"); + } +}; + // ---- the jump group ---- /// Ctrl-o: one step back into the history. diff --git a/src/config.zig b/src/config.zig index f3cc0948..a92aabb6 100644 --- a/src/config.zig +++ b/src/config.zig @@ -119,10 +119,11 @@ pub const leader_path = paths: { .Ascii = "ta", .Dump = "sd", .Restore = "sr", - .Left = "wh", - .Down = "wj", - .Up = "wk", - .Right = "wl", + .Left = null, + .Down = null, + .Up = null, + .Right = null, + .Window = "w", .Back = "jo", .Forward = "ji", .Last = "jj", @@ -212,7 +213,7 @@ pub const leader_path = paths: { test "Space-k is unbound while Exit, Kill and other k chords remain available" { try std.testing.expect(leader_path.get(.Kill) == null); try std.testing.expectEqualStrings("q", leader_path.get(.Exit).?); - try std.testing.expectEqualStrings("wk", leader_path.get(.Up).?); + try std.testing.expectEqualStrings("w", leader_path.get(.Window).?); try std.testing.expectEqualStrings("lk", leader_path.get(.Hover).?); try std.testing.expectEqualStrings("d", leader_path.get(.Del).?); for (pardes.builtin_rows) |row| if (row.cmd == .Kill) { @@ -264,7 +265,8 @@ pub const select_button: Mouse.Button = .left; pub const look_cmd: Builtin = .Look; pub const exec_cmd: Builtin = .Exec; -// Ctrl-w remains available when a terminal owns printable keys. +// Ctrl-w: window mode (layout.windowKey), as SPC w; on a header it +// prefixes h/j/k/l, a move between the headers. pub const window_prefix: []const Chord = &.{.{ .cp = 'w', .ctrl = true }}; pub const window_keys = [_]struct { letter: Chord, arrow: Chord, cmd: Builtin }{ diff --git a/src/draw.zig b/src/draw.zig index 31157b1d..1cf136bd 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -1208,6 +1208,21 @@ fn joinPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r @memset(storage, .{}); var temporary: Surface = .{ .cols = columns + TAG_TEXT_INSET, .rows = rows, .cells = storage }; try paintPaneTag(p, &temporary, arena, pane, .{ .x = 0, .y = 0, .w = columns + TAG_TEXT_INSET, .h = rows }, id, active, capacity); + // Window mode (layout.windowKey): the outlined pane's tag in the + // selection's colours, and each pane's letter over its tag's start. + if (p.window_pick) |pick| { + const th = p.theme(); + if (pick == id) for (storage) |*cell| { + cell.style.bg = .{ .rgb = th.sel_bg }; + cell.style.fg = .{ .rgb = th.sel_fg }; + cell.default = false; + }; + if (layout.windowLabel(p, id)) |letter| if (columns >= 3) for (" ? ", 0..) |ch, i| { + const at = temporary.at(@intCast(TAG_TEXT_INSET + i), 0); + const style: CellStyle = .{ .fg = .{ .rgb = chrome.tag_bg }, .bg = .{ .rgb = chrome.tag_fg }, .bold = true, .font_role = at.style.font_role }; + temporary.set(@intCast(TAG_TEXT_INSET + i), 0, &.{if (ch == '?') letter else ch}, style); + }; + } const tag_fg: Color = .{ .rgb = if (active and p.settings.focus_tint) chrome.tag_active_fg else chrome.tag_fg }; // One layer, a row to each line the tag shows. const layer = &s.tag_layers[id]; @@ -1220,7 +1235,7 @@ fn joinPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r layer.cols = columns; layer.rows = rows; layer.context_rows = 0; - layer.bg = if (active and p.settings.focus_tint) chrome.tag_active_bg else chrome.tag_bg; + layer.bg = if (p.window_pick == id) p.theme().sel_bg else if (active and p.settings.focus_tint) chrome.tag_active_bg else chrome.tag_bg; layer.slide = 0; layer.fade = 1; layer.cursor = if (p.header_focus) null else if (temporary.cursor) |cursor| diff --git a/src/layout.zig b/src/layout.zig index 40bce75a..6345c91a 100644 --- a/src/layout.zig +++ b/src/layout.zig @@ -27,8 +27,19 @@ pub const MovePlacement = struct { above_h: u16, }; +pub const Dir = enum { left, right, up, down }; + /// Move the keyboard to the nearest pane in `dir`; false when there is none. -pub fn focusDir(p: *Pardes, from: usize, dir: enum { left, right, up, down }) bool { +pub fn focusDir(p: *Pardes, from: usize, dir: Dir) bool { + const b = nearest(p, from, dir) orelse return false; + p.active = b; + // a count typed before the hop was meant for the pane you left + p.panes[b].?.body.normal.clear(); + return true; +} + +/// The pane next to `from` in `dir`, by the screen. +pub fn nearest(p: *const Pardes, from: usize, dir: Dir) ?usize { const a = p.rects[from]; var best: ?usize = null; var best_d: i32 = 0; @@ -55,11 +66,60 @@ pub fn focusDir(p: *Pardes, from: usize, dir: enum { left, right, up, down }) bo best_d = d; } } - const b = best orelse return false; - p.active = b; - // a count typed before the hop was meant for the pane you left - p.panes[b].?.body.normal.clear(); - return true; + return best; +} + +/// Window mode's labels, one a pane in reading order (columns left to +/// right, each top to bottom); h, j, k and l move instead. ponytail: a +/// pane past the 22nd has no label and is reached by moving. +pub const window_labels = "asdfgqwertyuiopzxcvbnm"; + +/// The letter window mode shows on pane `id`. +pub fn windowLabel(p: *const Pardes, id: usize) ?u8 { + var n: usize = 0; + for (0..p.ncol) |c| for (p.col_panes[c][0..p.col_n[c]]) |pane| { + if (n == window_labels.len) return null; + if (pane == id) return window_labels[n]; + n += 1; + }; + return null; +} + +/// Window mode (SPC w, Ctrl-w): h/j/k/l (or the arrows) move an outline +/// from pane to pane and nothing else gets the keys; Enter or Esc focuses +/// the outlined pane, `:` its tag, and a pane's label letter that one. Up past a +/// column's top pane goes on to its tag, as the Up word does. Any other +/// key changes nothing. +pub fn windowKey(p: *Pardes, key: pardes.Key) void { + const at = p.window_pick orelse return; + if (p.panes[at] == null) { + p.window_pick = null; + return; + } + if (key.ctrl or key.alt) return; + for (config.window_keys) |wk| if (pardes.hit(key, &.{ wk.letter, wk.arrow })) { + const dir: Dir = switch (wk.cmd) { + .Left => .left, + .Down => .down, + .Up => .up, + else => .right, + }; + if (nearest(p, at, dir)) |next| { + p.window_pick = next; + } else if (dir == .up) { + p.window_pick = null; + p.active = at; + pardes.exec.runBuiltin(p, .Up, at, "", null); + } + return; + }; + const chosen = if (key.cp == pardes.Key.enter or key.cp == pardes.Key.escape or key.cp == ':') at else for (0..p.panes.len) |id| { + if (p.panes[id] != null and key.cp < 128 and windowLabel(p, id) == @as(u8, @intCast(key.cp))) break id; + } else return; + p.window_pick = null; + p.active = chosen; + p.panes[chosen].?.body.normal.clear(); + if (key.cp == ':') tagline.enterTag(p, p.panes[chosen].?); } /// Column `c`'s serial, handed out the first time it is asked for. diff --git a/src/mouse.zig b/src/mouse.zig index 43323f9a..76c65a16 100644 --- a/src/mouse.zig +++ b/src/mouse.zig @@ -465,6 +465,7 @@ pub fn handleMouse(p: *Pardes, event: Mouse) void { var m = event; // A click goes somewhere else: the question it leaves unanswered is // taken back, and the pane stays. A wheel only looks around. + if (m.kind == .press) p.window_pick = null; if (m.kind == .press and switch (m.button) { .left, .middle, .right => true, else => false, diff --git a/src/pardes.zig b/src/pardes.zig index c885acc2..cb2ebe56 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -2983,9 +2983,7 @@ fn chordName(comptime c: config.Chord) []const u8 { fn shortcutCount(comptime b: Builtin) comptime_int { var count = 0; - for (config.window_keys) |wk| if (wk.cmd == b) { - count += 2; - }; + if (b == .Window) count += 1; for (config.jump_keys) |jk| if (jk.cmd == b) { count += 1; }; @@ -3003,13 +3001,9 @@ fn shortcuts(comptime b: Builtin) []const u8 { @setEvalBranchQuota(20000); var parts: [shortcutCount(b)][]const u8 = undefined; var part: usize = 0; - for (config.window_keys) |wk| { - if (wk.cmd != b) continue; - // the prefix has one spelling and this is it - const pfx = chordName(config.window_prefix[0]) ++ " "; - parts[part] = pfx ++ chordName(wk.letter); - parts[part + 1] = pfx ++ chordName(wk.arrow); - part += 2; + if (b == .Window) { + parts[part] = chordName(config.window_prefix[0]); + part += 1; } for (config.jump_keys) |jk| { if (jk.cmd == b) { @@ -4614,6 +4608,8 @@ pub const Pardes = struct { /// default one. register: u21 = 0, leader_on: bool = false, + /// Window mode's outlined pane (layout.windowKey); null outside it. + window_pick: ?usize = null, leader_keys: [4]u8 = undefined, leader_n: u8 = 0, /// The keyboard is on a header: the column tag `header_column` names, or @@ -6372,6 +6368,7 @@ pub const Pardes = struct { } return; } + if (p.window_pick != null) return layout.windowKey(p, key); const pane = p.panes[p.active] orelse return; p.noteTyped(); // In a raw terminal the two Escs swap unless ProgramEsc is on: Esc @@ -6447,12 +6444,16 @@ pub const Pardes = struct { } return; } - // insert mode owns Ctrl-w (delete word backward, helix); the focus - // prefix applies outside raw tty mode + // insert mode owns Ctrl-w (delete word backward, helix); outside raw + // tty mode it enters window mode, or on a header prefixes a move + // between the headers const t = header orelse if (pane.focus == .tag) &pane.tag else &pane.body; if (hit(key, config.window_prefix) and t.mode != .insert and (header != null or pane.prompt == .none)) { - p.ctrl_w_pending = true; - return; + if (header != null) { + p.ctrl_w_pending = true; + return; + } + return exec.runBuiltin(p, .Window, p.active, "", null); } // global window ops (any mode): Alt-n new terminal below, Alt-c move // the active terminal into a fresh column @@ -8534,6 +8535,61 @@ test "Shift-Esc backs out to the previous pane in every mode, never into raw" { try std.testing.expect(p.active != 0); } +test "window mode moves an outline and focuses it on Enter, Esc or a label" { + const p = try Pardes.init(std.testing.allocator, .{ .cols = 120, .rows = 30 }); + defer p.deinit(); + _ = try p.setTestFile("left\n"); + _ = try p.newShell(1, ""); + try std.testing.expect(layout.splitColumn(p, 0, 1, false)); + p.newScratchBelow(1); + p.sync(); + const lower = for (p.panes, 0..) |slot, id| { + if (slot != null and id > 1) break id; + } else return error.TestExpectedScratch; + p.active = 0; + // Ctrl-w enters it; h/j/k/l move only the outline. + p.update(.{ .key = .{ .cp = 'w', .ctrl = true } }); + try std.testing.expectEqual(@as(?usize, 0), p.window_pick); + p.update(.{ .key = .{ .cp = 'l', .text = "l" } }); + try std.testing.expect(p.window_pick != null and p.window_pick.? != 0); + p.update(.{ .key = .{ .cp = 'j', .text = "j" } }); + try std.testing.expectEqual(@as(?usize, lower), p.window_pick); + try std.testing.expectEqual(@as(usize, 0), p.active); + p.update(.{ .key = .{ .cp = Key.enter } }); + try std.testing.expectEqual(lower, p.active); + try std.testing.expect(p.window_pick == null); + // SPC w enters it too, and Esc also leaves it on the outlined pane. + p.update(.{ .key = .{ .cp = ' ', .text = " " } }); + p.update(.{ .key = .{ .cp = 'w', .text = "w" } }); + p.update(.{ .key = .{ .cp = 'h', .text = "h" } }); + p.update(.{ .key = .{ .cp = Key.escape } }); + try std.testing.expectEqual(@as(usize, 0), p.active); + try std.testing.expect(p.window_pick == null); + // Other keys change nothing. + p.update(.{ .key = .{ .cp = 'w', .ctrl = true } }); + p.update(.{ .key = .{ .cp = '!', .text = "!" } }); + try std.testing.expectEqual(@as(?usize, 0), p.window_pick); + p.update(.{ .key = .{ .cp = Key.escape } }); + // `:` focuses the outlined pane's tag. + p.update(.{ .key = .{ .cp = 'w', .ctrl = true } }); + p.update(.{ .key = .{ .cp = 'l', .text = "l" } }); + p.update(.{ .key = .{ .cp = ':', .text = ":" } }); + try std.testing.expect(p.active != 0 and p.panes[p.active].?.focus == .tag); + p.update(.{ .key = .{ .cp = Key.escape } }); + // A label goes straight there: the left column's pane is "a". + try std.testing.expectEqual(@as(?u8, 'a'), layout.windowLabel(p, 0)); + try std.testing.expect(p.executeBuiltinLine(p.active, "Window")); + p.update(.{ .key = .{ .cp = 'a', .text = "a" } }); + try std.testing.expectEqual(@as(usize, 0), p.active); + // Painted: the outlined tag's band in the selection colour, a label on each. + try std.testing.expect(p.executeBuiltinLine(p.active, "Window")); + var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); + defer arena.deinit(); + const shown = try p.render(arena.allocator()); + try std.testing.expectEqual(p.theme().sel_bg, shown.tag_layers[0].bg); + try std.testing.expectEqualStrings("a", shown.tag_layers[0].cells[1].text[0..shown.tag_layers[0].cells[1].len]); +} + test "raw tty Ctrl-B switches to editor mode without sending child input" { if (platform == .web) return; const p = try Pardes.init(std.testing.allocator, .{ .file = "mise.toml" }); @@ -8660,6 +8716,7 @@ test "hopping between two panes does not grow the jump stack" { p.update(.{ .key = .{ .cp = ' ' } }); p.update(.{ .key = .{ .cp = 'w' } }); p.update(.{ .key = .{ .cp = dir } }); + p.update(.{ .key = .{ .cp = Key.enter } }); try std.testing.expectEqual(want, p.active); } try std.testing.expectEqual(depth, p.njumps); diff --git a/src/tutor.txt b/src/tutor.txt index 5df02f1a..b71b3bf2 100644 --- a/src/tutor.txt +++ b/src/tutor.txt @@ -83,7 +83,8 @@ shows its output, and the keyboard stays here. 2. `Exec` `New` in this column's tag: a scratch opens and takes the keyboard. - 3. Ctrl-w h, j, k, l move the keyboard between panes; Ctrl-o and + 3. Ctrl-w shows a letter on every pane: h, j, k, l move the outline + and Enter goes there, or press a pane's letter. Ctrl-o and Ctrl-i walk back and forward through where you have been. 4. `Del` the scratch and the command pane, each in its own tag. @@ -283,7 +284,7 @@ typed SPC d `Del` SPC q `Exit` SPC f s `Save` SPC f f `Find` SPC f n `New` SPC y yank to the clipboard SPC p paste from it - SPC w h focus left (and j, k, l) + SPC w window mode: h/j/k/l, Enter SPC j j `Last` SPC j o / SPC j i back / forward SPC s a `Attach` SPC s D `Detach` SPC t ... the toggles SPC l ... the language @@ -328,7 +329,7 @@ typed 2-1 `Exec` the middle word with the left selection keyboard: Enter = `Look`, Tab = `Exec` - PANES Ctrl-w h/j/k/l focus a neighbour (NORMAL mode) + PANES Ctrl-w h/j/k/l pick a pane, Enter (NORMAL mode) Ctrl-o / Ctrl-i jump history back / forward Alt-n new terminal Alt-c pane into a new column diff --git a/test/panes.zig b/test/panes.zig index c8f4b7eb..e98e3a54 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -384,6 +384,7 @@ const TagNavigationTests = struct { fn window(p: *Pardes, letter: u21) void { p.update(.{ .key = .{ .cp = 'w', .ctrl = true } }); key(p, letter); + key(p, Key.enter); } test "a tag remembers its cursor, starts on Save, and a click moves it" { @@ -4718,12 +4719,14 @@ test "cancelled normal gestures leave no count or subprefix after mouse and focu .focus, .last => { p.update(.{ .key = .{ .cp = 'w', .ctrl = true } }); p.update(.{ .key = .{ .cp = 'l' } }); + p.update(.{ .key = .{ .cp = Key.enter } }); try std.testing.expectEqual(other, p.active); if (gesture == .last) { p.update(.{ .key = .{ .cp = Key.escape } }); } else { p.update(.{ .key = .{ .cp = 'w', .ctrl = true } }); p.update(.{ .key = .{ .cp = 'h' } }); + p.update(.{ .key = .{ .cp = Key.enter } }); } try std.testing.expectEqual(@as(usize, 0), p.active); }, diff --git a/test/pdf.zig b/test/pdf.zig index 6c9308d4..b8a768c8 100644 --- a/test/pdf.zig +++ b/test/pdf.zig @@ -1470,9 +1470,11 @@ test "Escape cancels PDF chrome in place and Shift-Escape leaves the pane" { panes.Pdf.openSections(p, 0); p.update(.{ .key = .{ .cp = 'w', .ctrl = true } }); p.update(.{ .key = .{ .cp = 'j' } }); + p.update(.{ .key = .{ .cp = Key.enter } }); try std.testing.expectEqual(@as(usize, 1), p.active); p.update(.{ .key = .{ .cp = 'w', .ctrl = true } }); p.update(.{ .key = .{ .cp = 'k' } }); + p.update(.{ .key = .{ .cp = Key.enter } }); try std.testing.expectEqual(@as(usize, 0), p.active); // Everything a reader can see over the page: a search overlay and a live diff --git a/test/snapshots/builtins.golden b/test/snapshots/builtins.golden index 9eb9718b..1836ad05 100644 --- a/test/snapshots/builtins.golden +++ b/test/snapshots/builtins.golden @@ -9,14 +9,14 @@ | 5 line 5 | 6 line 6 | 7 -== snap window-group grid=120x67 cursor=7,10 +== snap column-group grid=120x67 cursor=7,10 |9: /tmp/pardes-snap/builtins/cwd/+Help Save Tty Collapse Del -|10: 1 pardes builtins under SPC w +|10: 1 pardes builtins under SPC c |11: 2 -|12: 3 SPC w h Left C-w h, C-w left -|13: 4 SPC w j Down C-w j, C-w down -|14: 5 SPC w k Up C-w k, C-w up -|15: 6 SPC w l Right C-w l, C-w right +|12: 3 SPC c d Delcol +|13: 4 SPC c j Joincol topbar +|14: 5 SPC c n Newcol topbar +|15: 6 SPC c p Placement |16: 7 == snap docs-group grid=120x67 cursor=7,10 |10: 1 pardes builtins under SPC h diff --git a/test/snapshots/builtins.snap b/test/snapshots/builtins.snap index c59b79d6..73509c24 100644 --- a/test/snapshots/builtins.snap +++ b/test/snapshots/builtins.snap @@ -33,6 +33,10 @@ wheel up 110 50 wheel up 110 50 wheel up 110 50 wheel up 110 50 +wheel up 110 50 +wheel up 110 50 +wheel up 110 50 +wheel up 110 50 wait 10000 Look enter, right-click wait 10000 Exec tab, middle-click wait 10000 Filter @@ -43,10 +47,11 @@ stable 700 15000 key space j n space j n space j n wait 10000 Look enter, right-click wait 10000 Exec tab, middle-click -key space w ? -wait 10000 Right +key space c ? +wait 10000 under SPC c +wait 10000 Joincol stable 700 15000 -snap window-group +snap column-group key space h ? wait 10000 Tutor diff --git a/test/snapshots/cornerdrag-left.snap b/test/snapshots/cornerdrag-left.snap index e76bfb89..3b95c01e 100644 --- a/test/snapshots/cornerdrag-left.snap +++ b/test/snapshots/cornerdrag-left.snap @@ -12,7 +12,7 @@ start 31 100 -n 3 wait 8000 w.txt stable 700 20000 # a second pane in the RIGHT column -key c-w l +key c-w l enter stable 400 5000 key a-n stable 700 15000 diff --git a/test/snapshots/delask.golden b/test/snapshots/delask.golden index 7d911239..bded23bf 100644 --- a/test/snapshots/delask.golden +++ b/test/snapshots/delask.golden @@ -28,10 +28,9 @@ | | | */tmp/pardes-snap/delask/cwd/+New Save Tty Collapse Del -| 1 bottom-pane Up +| 1 bottom-pane == snap asked grid=100x36 cursor=18,20 |20: 1 middle-pane Del: give space to k above j below -|29: 1 bottom-pane == snap kept grid=100x36 cursor=18,20 |20: 1 middle-pane == snap below-took grid=100x36 cursor=18,20 diff --git a/test/snapshots/delask.snap b/test/snapshots/delask.snap index 9e120f9f..79ab527e 100644 --- a/test/snapshots/delask.snap +++ b/test/snapshots/delask.snap @@ -19,7 +19,7 @@ key i text bottom-pane key esc settle 100 -key c-w k +key c-w k enter stable 400 5000 snap three # asked, and nothing closes yet @@ -45,7 +45,7 @@ key i text third-pane key esc settle 100 -key c-w k +key c-w k enter stable 400 5000 key A send \x20DelBelow diff --git a/test/snapshots/doccol.snap b/test/snapshots/doccol.snap index 3a9befa3..bdc5db67 100644 --- a/test/snapshots/doccol.snap +++ b/test/snapshots/doccol.snap @@ -10,7 +10,7 @@ file c.txt CCC # a FILE boots alone (and always outranked -n), so the shell whose ls output # the looks below are clicked in is opened here: Alt-n stacks it below a.txt # and Alt-c moves it into a column of its own on the right — the layout the -# boot used to hand over — and SPC w h comes back to a.txt, which is where the +# boot used to hand over — and SPC w h Enter comes back to a.txt, which is where the # boot left focus. (`New`/`Newcol` open an empty +New scratch now, not a # shell, so the shell has to be asked for by name.) # Builtins announce themselves by default, and an announcement is a band at @@ -26,7 +26,7 @@ key a-n key a-c wait 8000 c.txt stable 700 20000 -key space w h +key space w h enter stable 400 5000 snap boot # look b.txt in the shell's ls output: the second doc splits the first, so diff --git a/test/snapshots/jumps.golden b/test/snapshots/jumps.golden index 30d1dcea..4aa18d54 100644 --- a/test/snapshots/jumps.golden +++ b/test/snapshots/jumps.golden @@ -36,7 +36,6 @@ |3: 1 line 1 ls |4: 2 line 2 big.txt == snap to-file grid=150x31 cursor=7,3 -|3: 1 line 1 ls Left == snap goto-100 grid=150x31 cursor=7,27 |3: 76 line 76 ls |4: 77 line 77 big.txt diff --git a/test/snapshots/jumps.snap b/test/snapshots/jumps.snap index f8d69d2a..7e66aa91 100644 --- a/test/snapshots/jumps.snap +++ b/test/snapshots/jumps.snap @@ -29,7 +29,7 @@ key a-n key a-c stable 700 15000 snap to-shell -key space w h +key space w h enter stable 400 5000 snap to-file # a FAR motion inside one pane: 100G is a jump, so the line we left is diff --git a/test/snapshots/leader.golden b/test/snapshots/leader.golden index 2fdd66b3..a584f201 100644 --- a/test/snapshots/leader.golden +++ b/test/snapshots/leader.golden @@ -85,14 +85,14 @@ |38: 3 SPC h c Changelog topbar |39: 4 SPC h m Messages |40: 5 SPC h t Tutor topbar -== snap help-window grid=100x41 cursor=7,6 +== snap help-column grid=100x41 cursor=7,6 |5: /tmp/pardes-snap/leader/cwd/+Help Save Tty Collapse Del -|6: 1 pardes builtins under SPC w +|6: 1 pardes builtins under SPC c |7: 2 -|8: 3 SPC w h Left C-w h, C-w left -|9: 4 SPC w j Down C-w j, C-w down -|10: 5 SPC w k Up C-w k, C-w up -|11: 6 SPC w l Right C-w l, C-w right +|8: 3 SPC c d Delcol +|9: 4 SPC c j Joincol topbar +|10: 5 SPC c n Newcol topbar +|11: 6 SPC c p Placement |12: 7 |35: |36: diff --git a/test/snapshots/leader.snap b/test/snapshots/leader.snap index 02205190..f6068cba 100644 --- a/test/snapshots/leader.snap +++ b/test/snapshots/leader.snap @@ -39,7 +39,7 @@ stable 700 15000 snap deleted # ...and the +Help it squeezed goes too, so the full index below opens with # room to show it -key c-w j +key c-w j enter key space d stable 700 15000 @@ -54,10 +54,12 @@ wait 10000 Ascii wait 10000 Palette wait 10000 Petscii wait 10000 Wrap -key space w ? -wait 10000 Right +# SPC w is Window itself now, not a group; the column group stands in +key space c ? +wait 10000 under SPC c +wait 10000 Joincol stable 700 15000 -snap help-window +snap help-column key space l ? wait 10000 WsDiagnostics stable 700 15000 diff --git a/test/snapshots/lspdebug.snap b/test/snapshots/lspdebug.snap index 3aca07cc..ec8d136d 100644 --- a/test/snapshots/lspdebug.snap +++ b/test/snapshots/lspdebug.snap @@ -23,7 +23,7 @@ stable 400 10000 key space l w wait 10000 lsp explain — the definition query wait 10000 row(s) -key space w j +key space w j enter key space d stable 700 15000 snap why-closed @@ -33,7 +33,7 @@ key space l i wait 10000 backend: lsp-client wait 10000 protocol servers (lsp-client): wait 10000 zls -key space w j +key space w j enter key / text client queries key enter @@ -43,7 +43,7 @@ wait 10000 definition # rows go: k, back to the source above key space d key k -key space w j +key space w j enter key space d stable 700 15000 snap report-closed diff --git a/test/snapshots/tagalign2col.golden b/test/snapshots/tagalign2col.golden index 6c4b997a..3fe442db 100644 --- a/test/snapshots/tagalign2col.golden +++ b/test/snapshots/tagalign2col.golden @@ -2,11 +2,10 @@ | Newcol Joincol Find Grep Help Changelog Tutor Dump Themes Config Debug Exit | New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/tagalign2col/cwd/deep/proj/document.txt Save Tty Collapse Del /tmp/pardes-snap/tagalign2col/cwd Tty+bash Save Mode Filter Collapse Del -| 1 alpha ls Left +| 1 alpha ls | 2 beta deep | 3 gamma == snap aligned grid=160x31 cursor=4,9 -|3: 1 alpha ls |6: /tmp/pardes-snap/tagalign2col/cwd Tty+bash Save Mode Filter Collapse Del |7: ls |8: deep diff --git a/test/snapshots/tagalign2col.snap b/test/snapshots/tagalign2col.snap index 0849ffae..7bd99ff5 100644 --- a/test/snapshots/tagalign2col.snap +++ b/test/snapshots/tagalign2col.snap @@ -10,7 +10,7 @@ stable 700 20000 key a-n key a-c stable 700 15000 -key space w h +key space w h enter stable 400 5000 snap onecol # A left sibling does not move either existing tag's command text. diff --git a/test/snapshots/tagnav.golden b/test/snapshots/tagnav.golden index 5abfbc3a..e7c6eca4 100644 --- a/test/snapshots/tagnav.golden +++ b/test/snapshots/tagnav.golden @@ -8,16 +8,13 @@ | 3 gamma | /tmp/pardes-snap/tagnav/cwd Tty+bash Save Mode F | ilter Collapse Del -| ls Up +| ls | w.txt == snap colon grid=100x31 cursor=36,2 -|9: ls == snap word grid=100x31 cursor=40,2 == snap in-tag grid=100x31 cursor=42,2 == snap right grid=100x31 cursor=54,6 -|4: 1 alpha Right ls == snap right-tag grid=100x31 cursor=89,2 -|4: 1 alpha ls == snap left-tag grid=100x31 cursor=42,2 == snap back-to-body grid=100x31 cursor=7,4 == snap tty-on grid=100x31 cursor=54,6 diff --git a/test/snapshots/tagnav.snap b/test/snapshots/tagnav.snap index 2f5906bb..cd83dbd9 100644 --- a/test/snapshots/tagnav.snap +++ b/test/snapshots/tagnav.snap @@ -15,18 +15,18 @@ wait 8000 Newcol Joincol wait 8000 w.txt stable 700 20000 # A FILE boots alone, so the launch shell is opened here: Alt-n opens it and -# focuses it, Alt-c puts it in a column of its own on the right, SPC w h comes -# back to the file. +# focuses it, Alt-c puts it in a column of its own on the right, SPC w h Enter +# comes back to the file. key a-n key a-c stable 700 15000 -key space w h +key space w h enter stable 400 5000 # Alt-n: a shell below the file, so the left column has two rows and every # direction has somewhere to go key a-n stable 700 15000 -key space w k +key space w k enter stable 400 5000 snap start # `:` -> the file's OWN tagline, normal mode, on Save @@ -43,7 +43,7 @@ stable 400 5000 snap in-tag # the window keys move between panes from a tag as from a body: the tag lets # go and the neighbour's BODY takes the keyboard -key c-w l +key c-w l enter stable 400 5000 snap right # `:` there -> that pane's own tag, on its Save the first time @@ -51,7 +51,7 @@ key : stable 400 5000 snap right-tag # back left, and `:` finds the file's tag cursor where l left it -key c-w h +key c-w h enter stable 400 5000 key : stable 400 5000 @@ -63,7 +63,7 @@ snap back-to-body # A TERMINAL KEEPS ITS TTY MODE. Put the launch shell in raw tty mode (Ctrl-b), # click its tagline and come back: its box reads `$` throughout, because the # tag's mode is the tag's own. -key c-w l +key c-w l enter stable 400 5000 key c-b stable 700 15000 @@ -82,7 +82,7 @@ snap tty-restored # normal mode, then the workspace's; Down comes back the same way. key c-b stable 700 15000 -key c-w h +key c-w h enter stable 400 5000 key c-w k stable 400 5000 diff --git a/test/snapshots/windownav.golden b/test/snapshots/windownav.golden index b4fce259..fa3054af 100644 --- a/test/snapshots/windownav.golden +++ b/test/snapshots/windownav.golden @@ -3,7 +3,7 @@ | New Tty Find Grep Joincol Delcol New Tty Find Grep Joincol Delcol | /tmp/pardes-snap/windownav/cwd/w.txt Save Tty Co /tmp/pardes-snap/windownav/cwd Tty+bash Save Mod | llapse Del e Filter Collapse Del -| 1 alpha ls Left +| 1 alpha ls | 2 beta w.txt | 3 gamma == snap to-term grid=100x31 cursor=54,6 @@ -21,16 +21,10 @@ |9: ls |10: w.txt == snap up grid=100x31 cursor=7,4 -|9: ls Up == snap right grid=100x31 cursor=54,6 -|4: 1 alpha Right ls -|9: ls == snap left grid=100x31 cursor=7,4 -|4: 1 alpha ls Left == snap down grid=100x31 cursor=4,11 -|4: 1 alpha Down ls == snap toggle-doc grid=100x31 cursor=7,4 -|4: 1 alpha ls |9: ls Last == snap toggle-back grid=100x31 cursor=4,11 |4: 1 alpha Last ls diff --git a/test/snapshots/windownav.snap b/test/snapshots/windownav.snap index 66509e11..d929bb6f 100644 --- a/test/snapshots/windownav.snap +++ b/test/snapshots/windownav.snap @@ -1,6 +1,7 @@ # RULE: moving focus is a BUILTIN like any other, so there is ONE -# implementation and every route reaches it. SPC w h/j/k/l run Left/Down/Up/ -# Right — the geometric focusDir the Ctrl-w prefix also runs — and SPC j j +# implementation and every route reaches it. SPC w (as Ctrl-w) is window mode: +# h/j/k/l move an outline by the same geometric nearest pane Left/Down/Up/Right +# use and Enter focuses it — and SPC j j # plus body-normal Esc run Last, the hop to the pane you were in BEFORE this # one, whichever kind it was. It reads the focus history the core already keeps # to hand focus back when a pane closes, and going somewhere is itself recorded, @@ -14,13 +15,13 @@ wait 8000 w.txt stable 700 20000 # A FILE boots alone now, so the terminal every hop below needs is opened here: # Alt-n opens it and focuses it, Alt-c puts it in a column of its own on the -# right, SPC w h comes straight back — which also puts the shell on the stack, +# right, SPC w h Enter comes straight back — which also puts the shell on the stack, # and Last only ever names a pane that is on it. (`New`/`Newcol` open an empty # +New scratch now, not a shell.) key a-n key a-c stable 700 15000 -key space w h +key space w h enter stable 400 5000 # left column = the file, right column = that shell; the file has focus snap start @@ -46,23 +47,23 @@ snap esc-back-to-file key a-n stable 700 15000 snap altn -# SPC w k: up out of that new shell into the file above it -key space w k +# SPC w k Enter: up out of that new shell into the file above it +key space w k enter stable 400 5000 snap up -# SPC w l: right, into the launch shell -key space w l +# SPC w l Enter: right, into the launch shell +key space w l enter stable 400 5000 snap right -# SPC w h: left, back into the file column -key space w h +# SPC w h Enter: left, back into the file column +key space w h enter stable 400 5000 snap left -# SPC w j: down, into the shell under the file -key space w j +# SPC w j Enter: down, into the shell under the file +key space w j enter stable 400 5000 snap down -# SPC j j from a terminal: the file, which is where SPC w h left off +# SPC j j from a terminal: the file, which is where SPC w h Enter left off key space j j stable 400 5000 snap toggle-doc diff --git a/test/snapshots/windowops.golden b/test/snapshots/windowops.golden index 88bd2782..8a6b3986 100644 --- a/test/snapshots/windowops.golden +++ b/test/snapshots/windowops.golden @@ -139,7 +139,6 @@ |20: ls |21: w.txt == snap focus-right grid=100x31 cursor=44,6 -|20: ls Right == snap debug-on grid=100x31 cursor=44,6 |1: New Tty Find Grep Joincol Delcol New Tty Find Grep Jo╭────────────────────────────────────╮ |2: /tmp/pardes-snap/windowops/cwd Tty+bas /tmp/pardes-snap/win│pardes resizes=1 │ @@ -151,7 +150,6 @@ |8: │pinch 1.0000 │ |9: │tscroll 0.0000 │ |10: ╰────────────────────────────────────╯ -|20: ls == style debug-on grid=100x31 |0: 0-1 d,#1d2824, 2-66 #b2c3b8,#1d2824, 67-71 #f5f7ee,#3c614a, 72-72 #f5f7ee,#1d2824, 73-99 #b2c3b8,#1d2824, |1: 0-1 d,#887455, 2-39 #b2c3b8,#1d2824, 40-41 #b2c3b8,#887455, 42-61 #becfc4,#314738, 62-99 d,d, diff --git a/test/snapshots/windowops.snap b/test/snapshots/windowops.snap index 8166f663..e003292c 100644 --- a/test/snapshots/windowops.snap +++ b/test/snapshots/windowops.snap @@ -1,4 +1,4 @@ -# hover resize hints, border drags, grip resize, move drag, Alt-n, Ctrl-w focus (routed through the Right builtin), Debug box +# hover resize hints, border drags, grip resize, move drag, Alt-n, Ctrl-w focus (window mode), Debug box file w.txt x start 31 100 -n 3 wait 8000 w.txt @@ -38,10 +38,10 @@ snap moved key a-n stable 700 15000 snap altn -# Ctrl-w l: focus right, into the pane just moved to the right column. The -# prefix runs the SAME Right builtin `SPC w l` runs (windownav covers the -# leader side); `h` from here would have nothing to its left to prove. -key c-w l +# Ctrl-w l Enter: window mode, the outline right, into the pane just moved to +# the right column, and Enter focuses it (windownav covers the leader side, +# SPC w); `h` from here would have nothing to its left to prove. +key c-w l enter stable 400 5000 snap focus-right # Debug overlay on (topbar middle-click on Debug), then off -- cgit v1.3 From 6076ab9e805838d4c4e8bb795428fae0a85671e9 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 21 Oct 2026 22:53:57 -0300 Subject: Window mode: the pane's letter in its tag's box, no message --- docs/typ/guide.typ | 2 +- src/CHANGELOG.md | 4 ++-- src/builtins.zig | 1 - src/draw.zig | 17 +++++++---------- src/pardes.zig | 6 ++++-- 5 files changed, 14 insertions(+), 16 deletions(-) (limited to 'docs/typ') diff --git a/docs/typ/guide.typ b/docs/typ/guide.typ index 2833f705..78710c73 100644 --- a/docs/typ/guide.typ +++ b/docs/typ/guide.typ @@ -54,7 +54,7 @@ it is a plain Esc. The previous pane is the last one you jumped from, else the next pane down the column. #pairs( - [#key("Ctrl-w") or #key("SPC w")], [window mode (#word("Window")): every pane shows a letter and the focused one is outlined; #keys("h", "j", "k", "l") move the outline, #key("Enter") or #key("Esc") gives that pane the keyboard, #key(":") its tag, a pane's letter gives it that one. #key("k") past a column's top pane goes on to its tag], + [#key("Ctrl-w") or #key("SPC w")], [window mode (#word("Window")): each pane's tag box shows a letter instead of its mode, and the focused pane's tag is outlined; #keys("h", "j", "k", "l") move the outline, #key("Enter") or #key("Esc") gives that pane the keyboard, #key(":") its tag, a pane's letter gives it that one. #key("k") past a column's top pane goes on to its tag], [#keys("Ctrl-o", "Ctrl-i")], [back and forward through the places you jumped to (the jump list), this file's first: another file's only once it has none left that way (#word("JumpScope") `all`: every place in order)], ) diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index 6ebabb5b..ab9432ef 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -29,8 +29,8 @@ restores the old way round. A terminal without the kitty keyboard protocol sends Shift-Esc as a plain Esc, so under one a program gets no Esc unless ProgramEsc is on. -- Window mode (`Window`, Ctrl-w or SPC w): every pane shows a letter - and the focused one is outlined; h/j/k/l move the outline without +- Window mode (`Window`, Ctrl-w or SPC w): each pane's tag box shows a + letter in place of its mode, and the focused pane's tag is outlined; h/j/k/l move the outline without giving any pane the keys, Enter or Esc focuses the outlined pane, `:` its tag, and a pane's letter jumps straight to it. Ctrl-w h/j/k/l and SPC w h/j/k/l diff --git a/src/builtins.zig b/src/builtins.zig index 6ecd3c9e..46b61ff7 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -1825,7 +1825,6 @@ pub const Window = struct { pub fn run(c: Ctx) void { tagline.exitHeader(c.p); c.p.window_pick = if (c.p.panes[c.id] != null) c.id else c.p.active; - c.p.setMessage(c.p.window_pick.?, "Window: h/j/k/l move, Enter or Esc focuses the outlined pane, : its tag, a letter that pane"); } }; diff --git a/src/draw.zig b/src/draw.zig index 1cf136bd..3d0d4d3c 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -941,7 +941,9 @@ fn renderPane(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r: .bg = .{ .rgb = band }, .font_role = .tagline, }); - s.set(r.x, tag_y, switch (pane.body.mode) { + // In window mode the box holds the pane's letter instead of its mode. + const label: ?u8 = if (p.window_pick != null) layout.windowLabel(p, id) else null; + s.set(r.x, tag_y, if (label) |*letter| @as(*const [1]u8, letter) else switch (pane.body.mode) { .normal => config.tag_normal, .insert => config.tag_insert, .tty => config.tag_tty, @@ -1209,19 +1211,14 @@ fn joinPaneTag(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane, r var temporary: Surface = .{ .cols = columns + TAG_TEXT_INSET, .rows = rows, .cells = storage }; try paintPaneTag(p, &temporary, arena, pane, .{ .x = 0, .y = 0, .w = columns + TAG_TEXT_INSET, .h = rows }, id, active, capacity); // Window mode (layout.windowKey): the outlined pane's tag in the - // selection's colours, and each pane's letter over its tag's start. - if (p.window_pick) |pick| { + // selection's colours. + if (p.window_pick == id) { const th = p.theme(); - if (pick == id) for (storage) |*cell| { + for (storage) |*cell| { cell.style.bg = .{ .rgb = th.sel_bg }; cell.style.fg = .{ .rgb = th.sel_fg }; cell.default = false; - }; - if (layout.windowLabel(p, id)) |letter| if (columns >= 3) for (" ? ", 0..) |ch, i| { - const at = temporary.at(@intCast(TAG_TEXT_INSET + i), 0); - const style: CellStyle = .{ .fg = .{ .rgb = chrome.tag_bg }, .bg = .{ .rgb = chrome.tag_fg }, .bold = true, .font_role = at.style.font_role }; - temporary.set(@intCast(TAG_TEXT_INSET + i), 0, &.{if (ch == '?') letter else ch}, style); - }; + } } const tag_fg: Color = .{ .rgb = if (active and p.settings.focus_tint) chrome.tag_active_fg else chrome.tag_fg }; // One layer, a row to each line the tag shows. diff --git a/src/pardes.zig b/src/pardes.zig index cb2ebe56..aaa9d177 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -8581,13 +8581,15 @@ test "window mode moves an outline and focuses it on Enter, Esc or a label" { try std.testing.expect(p.executeBuiltinLine(p.active, "Window")); p.update(.{ .key = .{ .cp = 'a', .text = "a" } }); try std.testing.expectEqual(@as(usize, 0), p.active); - // Painted: the outlined tag's band in the selection colour, a label on each. + // Painted: the outlined tag's band in the selection colour, each pane's + // letter in its tag's box. try std.testing.expect(p.executeBuiltinLine(p.active, "Window")); var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); const shown = try p.render(arena.allocator()); try std.testing.expectEqual(p.theme().sel_bg, shown.tag_layers[0].bg); - try std.testing.expectEqualStrings("a", shown.tag_layers[0].cells[1].text[0..shown.tag_layers[0].cells[1].len]); + const box = shown.at(p.rects[0].x, p.tagTop(p.panes[0].?, p.rects[0])); + try std.testing.expectEqualStrings("a", box.text[0..box.len]); } test "raw tty Ctrl-B switches to editor mode without sending child input" { -- cgit v1.3