From 5cf50930dee214fb641bb95bbf8639b8f76930d9 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 28 Sep 2026 11:12:10 -0300 Subject: Normal mode's s and S search as addr does, through one shared regexp.zig The sam-style calling convention for mvzr (a line per haystack, . made [^\\n] only when a pattern names \\n) lived in addr.zig; normal mode's s and S called mvzr over the raw selection, where ^ meant the selection's start and . crossed lines. src/regexp.zig now holds the one Regex (compile, find) both call, and fs.zig and pardes.zig drop an unused mvzr import. hxdiff and hxparity stay at their known 17 and 6 mismatches, none of them regex cases. Co-Authored-By: Claude Opus 5.5 --- docs/fs.md | 2 ++ docs/helix-keys.md | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/fs.md b/docs/fs.md index c54cfc4d..af57a468 100644 --- a/docs/fs.md +++ b/docs/fs.md @@ -274,6 +274,8 @@ takes the longest (`/gam|gamma/` finds `gam`); in a search begun in the middle of a line, `^` inside an alternation can match there; and in a pattern that spans lines, `^`, `$` and `[^...]` keep mvzr's own meaning. pardes has no regex engine of its own on purpose; these are its limits. +Normal mode's `s` and `S` search a selection the same way (src/regexp.zig +is the one place both call), so `^` there also means a line's start. An address that does not evaluate fails the write with why: `bad address syntax`, `no match for regexp`, `address out of range` or `bad regular diff --git a/docs/helix-keys.md b/docs/helix-keys.md index f46f5234..0f847405 100644 --- a/docs/helix-keys.md +++ b/docs/helix-keys.md @@ -245,7 +245,11 @@ re-runs the final pattern down the same path, so a submit can never disagree with what is on screen. Pressed in a tag, column tag or workspace tag they select in that tag's own text, and so does `|` pipe it; `/` searches the body wherever it is pressed (`Pane.prompt_for`). Engine: **mvzr** (`build.zig.zon`), a bytecode VM that -compiles a runtime pattern with no allocator. +compiles a runtime pattern with no allocator, called the way sam searches +(`src/regexp.zig`, shared with a pane's `addr` file): each line is its own +haystack, so `^` and `$` match at every line's start and end and `.` never +crosses a newline, and a pattern naming `\n` runs over the whole selection. +Where helix's `^` is only the selection's start, this is sam's. | Key | Behavior | Notes | Status | | --- | --- | --- | --- | -- cgit v1.3