Fix review findings in the regex engine, search count and journal v2
- PCRE2: compile with the ANYCRLF newline convention and DOLLAR_ENDONLY,
as ECMAScript reads '.' and '$'. With PCRE2's default (LF only) '.'
matched the CR of a CRLF line, so regex replace-all deleted CRs.
- Replacement $0 is the whole match, two digits are read greedily and a
group the pattern lacks expands to nothing, as std::regex_replace
(libstdc++) does; these cases are now compared in the tests.
- Plain search visits overlapping matches going forward too, and counts
them, as the backward search found them ('aa' in 'aaa' read 2/1).
- The recovery prompt's replayed content is used on 'y' only if the
journal is unchanged since; otherwise it is replayed again.
- A version 1 journal continued after recovery is rewritten as a
compacted version 2 journal when it needs a chunked checkpoint,
instead of receiving records an older kte would skip. (The version is
read through a separate descriptor: the journal fd is write-only.)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015rcVQiiWyTzoNrsvLSaAfB
This commit is contained in:
@@ -558,6 +558,15 @@ before the fix (unless noted).
|
||||
1.55 s -> 0.10 s per keystroke.
|
||||
- Only one checkpoint per journal is queued at a time; whole-file edits
|
||||
in a row on a large buffer each queued a full copy of it.
|
||||
- Review of this work found, and these are fixed: with PCRE2, '.'
|
||||
matched the CR of CRLF lines (regex replace-all deleted it) — PCRE2
|
||||
now uses the ANYCRLF newline convention and $ matches only at the end;
|
||||
$0, out-of-range $n and $nn in replacements now follow libstdc++;
|
||||
plain search visits overlapping matches in both directions (the count
|
||||
could read "2/1"); the recovery prompt replays again if the journal
|
||||
changed while it was open; a version 1 journal continued after
|
||||
recovery gets a chunked checkpoint only by being rewritten as
|
||||
version 2.
|
||||
|
||||
**Known limitations (not fixed)**
|
||||
- Without PCRE2 (std::regex builds), catastrophic regex backtracking
|
||||
|
||||
Reference in New Issue
Block a user