Fix round-four regressions: save fallback, replace memory, regex skip
- Save's in-place fallbacks (no temp file; no hard-link copy) now apply only when the directory refuses a new name (EACCES, EPERM, ENAMETOOLONG). On ENOSPC, EDQUOT or EIO the in-place write truncated the file and then failed, leaving it corrupt; now the save fails and the file is untouched (checked on a full tmpfs). - replace_rows_text/replace_buffer_text delete and insert only the span between the old and new text's common prefix and suffix (kept on UTF-8 boundaries). Replace-all recorded the whole buffer twice in the undo tree per run. - Regex search skips long lines only while typing (limit lowered to 2,000 bytes, as for renderer highlighting; '.*q' on a 20 KB line took 12 s), reports how many were skipped, and next/previous match search every line. Previously matches on long lines could not be found. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015rcVQiiWyTzoNrsvLSaAfB
This commit is contained in:
+6
-5
@@ -13,11 +13,12 @@
|
||||
|
||||
namespace kte {
|
||||
// Renderers highlight regex matches only on lines up to this many bytes, and
|
||||
// incremental regex search skips longer lines: std::regex can take time
|
||||
// quadratic in line length even for ordinary patterns, with no way to
|
||||
// interrupt it, and these run on every frame or keystroke.
|
||||
constexpr std::size_t kRegexRenderLineLimit = 10000;
|
||||
constexpr std::size_t kRegexIncrementalLineLimit = 20000;
|
||||
// search-as-you-type skips longer lines (an explicit search does not):
|
||||
// std::regex can take time quadratic in line length even for ordinary
|
||||
// patterns (".*q" on a 20 KB line: 12 s), with no way to interrupt it, and
|
||||
// these run on every frame or keystroke.
|
||||
constexpr std::size_t kRegexRenderLineLimit = 2000;
|
||||
constexpr std::size_t kRegexIncrementalLineLimit = 2000;
|
||||
|
||||
// Run fn to completion on a thread with a large stack (address space is
|
||||
// reserved, pages are committed only as used), so regex work over long lines
|
||||
|
||||
Reference in New Issue
Block a user