diff options
| author | Gabriel Schneider <[email protected]> | 2026-07-31 05:04:26 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-08-01 15:02:08 -0300 |
| commit | 5bf8d6dd077517270377e5d8551108ecf252374f (patch) | |
| tree | c7783fa9fc133980d3d6fff0129e8de5a1b43601 /test/snapshots/multicursor.snap | |
| parent | eefac04995ffad847a4098f16d2e82ccab16438b (diff) | |
| download | pardes-5bf8d6dd077517270377e5d8551108ecf252374f.tar.gz pardes-5bf8d6dd077517270377e5d8551108ecf252374f.zip | |
multiple cursors, regex selection, and Ctrl-c comments
The primary cursor stays exactly where it was — cur_row/cur_col plus vsel — and
sels[] holds helix's OTHER ranges. That split is why nothing moved at one
cursor: with nsel == 0 not one line of the existing motion, operator, render or
mouse code takes a different branch, which is what protects 800 differential
cases and 67 goldens.
paneRanges/setPaneRanges are the whole list; setPaneRanges IS helix's
Selection::new (min width 1, sorted, overlaps merged, primary follows its range
through a merge). An ordinary key runs the single-selection handler once per
range, visited last-first so an edit never disturbs a range still waiting, and
each finished pass is remembered as a distance from the END of the text, which
an earlier edit cannot move — helix's change mapping without a change map.
pushUndo fires once per keystroke, yanks accumulate, and a builtin acts from
the primary and stops the replay, which also closes the use-after-free window
if it frees the pane.
s and S reuse the / prompt wholesale rather than growing a second one: the
pattern is typed into the tag tail, and every keystroke re-runs the match from
the selection the prompt opened on, so the preview is live and Esc is just the
empty pattern. mvzr does runtime patterns — a bytecode VM in a fixed-size
struct with no allocator — with 64 ops and 8 char classes per pattern, no
case-insensitive flag (helix's smart case is done by folding a scratch copy),
no captures, no multi-line anchors. The last two are the two waivers.
Ctrl-c is a whole-list key and not a per-cursor replay, because helix decides
comment-vs-uncomment ONCE for the whole selection; replaying it would take that
decision n times. Comment tokens are a table in config.zig keyed on the same
extension syntax.zig picks grammars by.
Found and fixed a pre-existing single-cursor bug on the way: la<bs><esc> left
the cursor one cell before where the append began. helix's restore_cursor can
never walk past the origin; ours backed up unconditionally. hxdiff was green
before AND after — the old one-selection contract could not see it.
hxdiff 360 -> 481 cases, hxparity 440 -> 561, all goldens from real helix; the
harness contract now reports every range and its primary, omitted when there is
one, so 359 of the 360 old goldens are byte-identical. The one that moved is
o-count: helix's 2o really does leave two cursors and could not say so before.
Diffstat (limited to 'test/snapshots/multicursor.snap')
| -rw-r--r-- | test/snapshots/multicursor.snap | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/snapshots/multicursor.snap b/test/snapshots/multicursor.snap new file mode 100644 index 00000000..2bfccb93 --- /dev/null +++ b/test/snapshots/multicursor.snap @@ -0,0 +1,46 @@ +# MULTIPLE CURSORS on a real file pane. The differential suite (hxdiff) proves +# the model against a real helix but is headless, so this is the part it cannot +# see: that every range is actually on screen, that the primary reads +# differently from the others, and that ONE keystroke edits at all of them. +lines f.txt 12 +start 30 150 -n 3 +wait 8000 f.txt +stable 700 20000 +# open f.txt in the left pane (type its name, right-click to Look) +press left 5 8 +release left 5 8 +stable 400 5000 +key i +text f.txt +key esc +settle 100 +press right 6 8 +release right 6 8 +wait 10000 line 3 +stable 700 15000 +# top of the file, then C C: three cursors, one per line, primary on line 3 +key g g +stable 400 5000 +key C C +stable 400 5000 +snap three-cursors +# the colours ARE the feature here: the primary's cell against the two dimmer +# ones, each with its own bright cursor cell +snapstyle three-cursors +# one keystroke, three edits +key i +text >> +key esc +settle 100 +stable 400 5000 +snap edited-at-three +# a selection per cursor: e selects to the end of the first word at each +key g h w +stable 400 5000 +snap three-selections +snapstyle three-selections +# `,` drops back to the primary alone; the two dim highlights must vanish +key , +stable 400 5000 +snap keep-primary +snapstyle keep-primary |
