From 911215846f1d5a9b2e37a00e74fb9266d4a0884a Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 31 Jul 2026 11:42:18 -0300 Subject: a Look path can name a range, and search selects what it found MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit file:LINE:COL-ENDLINE:ENDCOL, with the two short forms people actually type reading naturally: file:412:9-21 on one line, file:412-418 whole ones. Ends are inclusive. A path feature, not a search feature — a ranged path typed in a tag or middle-clicked out of a shell's output selects just the same; search is only its first consumer. The dash is the fussy part. `-` was already a file char, so a ranged word survives click expansion whole, but a range needs a number on BOTH sides or my-file:10, build-2 and 2026-07-30 would stop being paths. Table-driven test in look.zig for exactly that. Selecting goes through the cellRange/setPaneRange pair the multi-cursor work left, and hxOff clamps both ends, so a stale range selects what still exists rather than crashing or reaching past EOF — pinned with an 8:6-400:9 range in a nine-line file. Producers: / search, Grep, and five LSP sites through a new spanRow — goto, references, rename tokens and both symbol lists were throwing away real protocol ranges at path:line:col. Left alone deliberately: Find rows are bare paths with nothing to span, a jump is a spot not a span, and the diagnostic and format paths only ever have a point, where half a range would be worse than none. One knock-on worth knowing: n now leaves an EXPLICIT selection, so a topbar execute chords it. grep.snap's no-match step was silently becoming `Grep TARGET`; it runs from the leader path now, which never chords, and the dedicated chord steps stayed where they were. --- test/snapshots/lookrange.snap | 70 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 test/snapshots/lookrange.snap (limited to 'test/snapshots/lookrange.snap') diff --git a/test/snapshots/lookrange.snap b/test/snapshots/lookrange.snap new file mode 100644 index 00000000..d1a86e0c --- /dev/null +++ b/test/snapshots/lookrange.snap @@ -0,0 +1,70 @@ +# RANGED LOOK PATHS. `path:LINE:COL` says where to PARK; a range says what to +# SELECT, and it belongs to the PATH (config.range_sep) rather than to the +# search that is merely the first thing writing one. So this script right- +# clicks the three spellings as ordinary words sitting in a file: +# r.txt:3-5 whole lines 3 through 5 +# r.txt:7:4-9 line 7, columns 4 through 9 +# r.txt:3:2-5:3 line 3 column 2 through line 5 column 3 +# ...and only then presses `/`, whose result rows are exactly this syntax — +# which is how n/N step to a hit with the matched text selected. +# +# `snapstyle` is the assertion that matters: the grid TEXT after a ranged look +# is the same text a plain `:LINE:COL` look leaves, so the selection only shows +# in the styles. +file r.txt aaaa\nbbbb\ncccc dccc\ndddd\neeee\nffff\ngg NEEDLE gg\nhhhh NEEDLE\niiii +file look.txt r.txt:3-5\nr.txt:7:4-9\nr.txt:3:2-5:3\nr.txt:8:6-99:9 +start 30 150 look.txt +wait 8000 r.txt:3-5 +stable 700 20000 +snap opened +# --- form 1: whole lines. r.txt opens BELOW look.txt (an ordinary look) with +# lines 3, 4 and 5 selected whole, terminators included — helix's own `x`. +press right 10 3 +release right 10 3 +wait 10000 cccc dccc +stable 700 15000 +snap wholelines +snapstyle wholelines +# --- form 2: one line, a column span. r.txt is open now, so this re-uses that +# pane (focusPaneByPath) — the same route a `/` result row takes. +press right 12 4 +release right 12 4 +stable 700 15000 +snap onelinespan +snapstyle onelinespan +# --- form 3: the general one, across both lines and columns +press right 12 5 +release right 12 5 +stable 700 15000 +snap fullspan +snapstyle fullspan +# --- a STALE range: line 99 of a nine-line file, which is what a result row +# looks like once the file has changed underneath it. It must CLAMP — no crash, +# no garbage highlight — landing on the last cell that really exists. +press right 12 6 +release right 12 6 +stable 700 15000 +snap stale +snapstyle stale +# --- and now the first consumer. The look above left r.txt focused, so `/` +# arms on it: the rows it writes carry the match's span, and n/N therefore step +# to each hit with the word itself selected. +key / +text NEEDLE +key enter +wait 10000 r.txt:7:4-9 gg NEEDLE +stable 700 15000 +snap results +key n +stable 700 15000 +snap hit1 +snapstyle hit1 +key n +stable 700 15000 +snap hit2 +snapstyle hit2 +# N walks back onto the first hit, still selected +key N +stable 700 15000 +snap back +snapstyle back -- cgit v1.3