summaryrefslogtreecommitdiff
path: root/docs/next-searchrows.md
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-25 11:40:05 -0300
committerGabriel Schneider <[email protected]>2026-10-25 12:24:05 -0300
commit685b4050bb0caaa95c4c6a209e69f7777469e9fc (patch)
treeb1c34301f9f1febd5e70dfdfee52425cdca0ef4a /docs/next-searchrows.md
parent29d753b420385d7ca214250909e3a33c85cfab8d (diff)
downloadpardes-685b4050bb0caaa95c4c6a209e69f7777469e9fc.tar.gz
pardes-685b4050bb0caaa95c4c6a209e69f7777469e9fc.zip
query: a row is its place as text, `path:line:col` then its code, the path the shortest a Look from the query pane resolves (Query.lookPath: relative, `../` included, when shorter, else absolute, never `@pN` but for a text with no file), aligned per group, the declaration headers `path:line`; its code coloured as its file's language colours it, the file painted whole on the worker (Stream.paintRows, highlightApart, kept in the locations cache, Query.Shades a walk a refill, Query.recolor in place as each lands) with the match tinted over it; the +Preview's places are the query's hits in its file (a Grep searched, a list fed), tinted and ticked, the row's one current and selected, as in a pane that already shows it; tests for B3 on an address, a saved list's Looks, the shortest path, the preview's places and colours, the worker's colours; fsearch, grep, lookrange, lsp-client, lsprelpath (now `../shade.zig`), stepgrain, tagbottom goldens: the address rows; docs/next-searchrows.md: the design and the numbers
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016u3hBPFfja5pK4EBRC1UVD
Diffstat (limited to 'docs/next-searchrows.md')
-rw-r--r--docs/next-searchrows.md89
1 files changed, 89 insertions, 0 deletions
diff --git a/docs/next-searchrows.md b/docs/next-searchrows.md
new file mode 100644
index 00000000..79ffc444
--- /dev/null
+++ b/docs/next-searchrows.md
@@ -0,0 +1,89 @@
+# searchrows: query rows that are addresses, coloured as their files
+
+The author's ask (2026-10-25): the search results "should show Lookable
+locations for the matches, and it should highlight the near text on the
+preview/result pane", then "using treesitter for the highlight I mean",
+then on the row format: "the row can be just path:line:row but the path
+should be minimal i.e. it should be the smallest one that doesn't refer to
+panes like @p1 but that resolves a Look". Change `tsyvmpux`, on
+`zmluwpuv`. Positions, not a verdict.
+
+## The row
+
+ Places.zig:163:8 pub fn firstFrom(hits: []const Hit, at: usize) usize {
+ Places.zig:237:19 const i = firstFrom(set.hits.items, at);
+ ../shade.zig:1:11 pub const Shade = enum {
+
+- `path:line:col`, then the line's code from its first non-blank: plain
+ text, so B3 anywhere on the address is a Look as anywhere, a sweep copies
+ it, and a frozen pane saved is a list of addresses that still work.
+- The path is `Query.lookPath(buf, path, dir)`: the shortest text a Look
+ from the query pane resolves: relative to the pane's directory (`x`,
+ `sub/x`, `../x`) when strictly shorter, else absolute. A relative name a
+ Look would read as something else (`@p...`, `://`) stays absolute. One
+ function, used by every hit row and by the file and declaration headers
+ of Grep, `/`/All and the language server lists.
+- On every row, `/` in the owner included: a bare `:12:5` would be looked
+ up in the +Search itself (a Look resolves against the pane it is in) and
+ a saved list would lose its file.
+- A group's code starts in one column: the address padded to
+ `path + ':' + digits(longest line in the group) + ':' + 3`, then two
+ spaces (a column of four digits or more pushes its own row one cell).
+- Declaration headers carry `path:line` in the same column; file headers
+ stay the bare path (itself a Look).
+
+## Colours
+
+- Rows: `Stream.paintRows` paints a whole file on the worker
+ (`syntax.highlightApart`, the same call as the anim paint-ahead): the text
+ of the pane that shows it, else read from disk there. It lands in the
+ locations cache beside Callstack's (`locations.Cache.put`); each row takes
+ its line's slice when the line still reads as the row does
+ (`Query.Shades`, one walk down each file a refill). Until then rows are
+ plain; on arrival `Query.recolor` colours every query pane's plain rows
+ in place and asks for the next file: one at a time, each (path, revision)
+ once a Grep (a 256 ring). The match tint (`decorateRow`) sits on top, its
+ position past the address (`code_start`). Not on the loop, not in a 9P
+ write (asked again on the next step), not without workers.
+- The +Preview: colours are its own pane's (painted as any file pane), and
+ the query's hits in that file are its places (`Places.search` literal for
+ a Grep, `Places.feed` from the rows for a list), tinted and ticked, the
+ current row's one current and selected, centred. A pane that already
+ shows the file gets the same (`selectPlace`).
+
+## Numbers
+
+`zz grep rows timings` (src/Stream.zig, `GREP_TIMES=<path>`): Debug, a
+TestShell worker, 160x50, the stress file (src/layout.zig x17, 1.22 MB,
+29002 lines), typing `pane` three times with 400 ms of frames after each
+key, then Enter on 2000 rows. Load 2.4-3.0 before, 2.7-2.8 after; after is
+three runs.
+
+| frame work | before | after |
+|---|---|---|
+| keystroke (update + render) p50 / p90 / max | 2.2 / 4.2 / 6.0 ms | 2.0-2.1 / 2.9-6.5 / 4.4-6.7 ms |
+| refill frame (rows remade) p50 / p90 / max | 4.4 / 5.2 / 5.2 ms | 4.8-5.1 / 5.4-6.1 / 5.4-6.1 ms |
+| other frames p50 / p90 / max | 0.9 / 1.3 / 10.6 ms | 0.9 / 1.2-1.3 / 10.0-10.2 ms |
+| Enter (2000 rows written) | 27.0 ms | 28.2-28.7 ms |
+| frames after Enter p50 / max | 0.9 / 1.7 ms | 0.9 / 1.3-1.7 ms |
+
+Rows coloured after Enter: 1718 of 2000; the other 282 are plain in the
+file's own colours too (checked against `highlightApart` of the file). A
+refill costs ~0.4 ms more (the wider rows and the Shades walk), inside the
+noise of the keystroke column; the paint itself never shows on the loop.
+
+## Pushback and rough edges
+
+- The current row's address is barely legible: the address's dim location
+ colour on the current row's mark tint (visible in the screenshot). The
+ thing B3 aims at should read; a brighter location fg on the marked row is
+ a one-line theme decision I left to you.
+- A text with no file (a +New scratch) has no path any Look resolves, so
+ its `/` rows keep `@pN`, the only address that works there.
+- `lsprelpath` asserted the opposite policy ("must NOT become
+ `../shade.zig`"); the author's shortest-path rule wins, the script says so.
+- Rows of a file over 4 MB, and of markdown/typst (their injections share
+ parsers, so no worker paints them) stay plain; a disk file changed after
+ it was painted keeps plain rows for its changed lines until the next Grep.
+- One file painted at a time: a Grep over hundreds of files colours file
+ by file (each lands in a frame); a worker per file if that is slow.