From 3e136122ecdc674e611016f5936b73bef3d26b01 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sun, 8 Nov 2026 22:07:12 -0300 Subject: helix: %S\s+ keeping the line's newline in its last piece is a documented pardes choice, waived in words: helix's split_on_matches (helix-core/src/selection.rs:852-880) runs the Rust regex over the whole range, whose \s matches the newline at 14, so the last piece ends at 13, where pardes searches as sam does, line by line (reference.typ, Regular expressions; src/regexp.zig), and \s never reaches a newline unless the pattern names \n (S\s+|\n gives helix's pieces, checked against hx-harness); waivers.jsonl names split-regex-ws and split-regex-ws-tty (hxdiff 2 to 0), reference.typ adds \s to what never matches a newline, and helix-keys.md has its row Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- test/hxcases/waivers.jsonl | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test') 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 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 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}} -- cgit v1.3