summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/helix-keys.md4
-rw-r--r--docs/typ/reference.typ3
-rw-r--r--test/hxcases/waivers.jsonl2
3 files changed, 7 insertions, 2 deletions
diff --git a/docs/helix-keys.md b/docs/helix-keys.md
index c928d5ec..0d9f38b7 100644
--- a/docs/helix-keys.md
+++ b/docs/helix-keys.md
@@ -287,6 +287,7 @@ keeps the matches it found so far.
| an all-lowercase pattern | matches case-blind | helix's smart-case. mvzr has no such flag, so the surface is lowercased instead (ASCII folding is byte-for-byte, so the offsets are identical) | helix-verified |
| `^` and `$` | hold at every line's start and end | helix compiles with `multi_line(true)`; pardes gets the same by searching each line as its own haystack (`src/regexp.zig`) | helix-verified |
| `.` | never matches a newline | as the Rust regex crate: a pattern without `\n` searches line by line, and one that names `\n` has its `.`s made `[^\n]` (`src/regexp.zig`) | helix-verified |
+| `\s`, `[^...]` | never match a newline unless the pattern names `\n` | the same line-by-line search; helix's `\s` and negated classes do match one, so its `S\s+` also splits at every newline, the last line's too, where pardes keeps a newline inside its piece unless the pattern is `\s+\|\n` (waivers `split-regex-ws`, `split-regex-ws-tty`) | pardes-specific |
| many matches | up to `memory.limits.selections` ranges, 1024; matches past it are dropped | helix has no limit. The room for them is allocated when a second range appears and given back at one range, so a single cursor costs nothing | helix-verified up to the limit |
| `K<pat>` / `Alt-K<pat>` Enter | keep only the ranges a match starts inside / only those none does; primary 0, and keeping none leaves the selection alone | helix `keep_selections` / `remove_selections`, on the same prompt as `s`/`S` (markers `Keep /`, `Remove /`). The range is searched as `s` searches it, line by line with its lines' context, where helix matches the range's text alone: a `^` right at a range that starts mid-line matches in helix and not here | helix-verified |
@@ -405,7 +406,8 @@ Files (all in `test/hxcases/`):
change-noyank), `msel-ins-checkpoint` (undo restores the primary range
alone), `gc-noscroll` (`gc` runs Callstack), `o-partial-indent-drops`
(`o` keeps a partial indent, acme's autoindent, where helix rounds it
- down to whole units). `wiX-edit-drops-sel` and `msel-append` went when insert
+ down to whole units), `split-regex-ws` and `split-regex-ws-tty` (`\s`
+ never matches a newline in pardes's line-by-line search). `wiX-edit-drops-sel` and `msel-append` went when insert
mode began carrying every range through its edits, `msel-yank-paste` with
registers of one value per range, `sel-regex-caret` and
`sel-regex-dot-newline` when `s`/`S` began searching line by line.
diff --git a/docs/typ/reference.typ b/docs/typ/reference.typ
index b1532424..48bdfdbe 100644
--- a/docs/typ/reference.typ
+++ b/docs/typ/reference.typ
@@ -719,7 +719,8 @@ over the match where the search starts.
Patterns are mvzr's (classes, `\d\w\s`, `{m,n}`, lazy `*?`), searched as
sam searches, line by line: `^` and `$` match at any line's start and end,
-`.` and `[^...]` never match a newline. The same code (`src/regexp.zig`)
+`.`, `\s` and `[^...]` never match a newline (helix's `\s` and `[^...]` do:
+there `S\s+` splits off a line's newline, here `S\s+|\n` does). The same code (`src/regexp.zig`)
serves addresses, #word("Edit"), and normal mode's #key("s") and #key("S"). The
ceiling:
diff --git a/test/hxcases/waivers.jsonl b/test/hxcases/waivers.jsonl
index e4fe39e1..81694a1e 100644
--- a/test/hxcases/waivers.jsonl
+++ b/test/hxcases/waivers.jsonl
@@ -2,3 +2,5 @@
{"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}}}
{"name":"o-partial-indent-drops","reason":"Enter, o and O keep the line's indent as it is, as acme's autoindent does (reference.typ, Indent), where helix's no-language fallback rounds it down to whole indent units, so two spaces under a 4-space unit open a line with none.","reference":{"name":"o-partial-indent-drops","text":" foo\n\n","mode":"insert","cursor":{"row":1,"col":0},"anchor":{"row":1,"col":0}},"expected":{"name":"o-partial-indent-drops","text":" foo\n \n","mode":"insert","cursor":{"row":1,"col":2},"anchor":{"row":1,"col":2}}}
+{"name":"split-regex-ws","reason":"Patterns are searched as sam searches, line by line (reference.typ, Regular expressions), so \\s, like . and [^...], never matches a newline unless the pattern names \\n: the last piece keeps the newline that helix's \\s+ splits off. %S\\s+|\\n<ret> gives helix's pieces.","reference":{"name":"split-regex-ws","text":"one two three\n","mode":"normal","cursor":{"row":0,"col":2},"anchor":{"row":0,"col":0},"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":13},"anchor":{"row":0,"col":9}}],"primary":0},"expected":{"name":"split-regex-ws","text":"one two three\n","mode":"normal","cursor":{"row":0,"col":2},"anchor":{"row":0,"col":0},"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":14},"anchor":{"row":0,"col":9}}],"primary":0}}
+{"name":"split-regex-ws-tty","reason":"Patterns are searched as sam searches, line by line (reference.typ, Regular expressions), so \\s, like . and [^...], never matches a newline unless the pattern names \\n: the last piece keeps the newline that helix's \\s+ splits off. %S\\s+|\\n<ret> gives helix's pieces.","reference":{"name":"split-regex-ws-tty","text":"one two three\n","mode":"normal","cursor":{"row":0,"col":2},"anchor":{"row":0,"col":0},"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":13},"anchor":{"row":0,"col":9}}],"primary":0},"expected":{"name":"split-regex-ws-tty","text":"one two three\n","mode":"normal","cursor":{"row":0,"col":2},"anchor":{"row":0,"col":0},"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":14},"anchor":{"row":0,"col":9}}],"primary":0}}