Share search-match highlighting across renderers; engine owns its stack policy

SearchHighlight compiles the search pattern once per frame and yields each
line's match ranges; the terminal, ImGui and Qt renderers had three copies
of this, and Qt compiled a std::regex for every visible line on every
frame. Qt now uses kte::Regex like the others.

kte::Regex::RunGuarded replaces Command.cc's run_regex_work, which chose
the large stack by comparing engine names. ForEachRegexMatch had no
callers left and is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015rcVQiiWyTzoNrsvLSaAfB
This commit is contained in:
Claude
2026-09-24 12:19:59 -07:00
committed by Kyle Isom
parent 2496722b43
commit 6bc3a6e0af
12 changed files with 158 additions and 173 deletions
+3
View File
@@ -197,6 +197,7 @@ set(COMMON_SOURCES
ErrorRecovery.cc
RegexGuard.cc
RegexEngine.cc
SearchHighlight.cc
TerminalInputHandler.cc
TerminalRenderer.cc
TerminalFrontend.cc
@@ -296,6 +297,7 @@ set(COMMON_HEADERS
TestFrontend.h
TextSpan.h
RegexEngine.h
SearchHighlight.h
UndoNode.h
UndoTree.h
UndoSystem.h
@@ -413,6 +415,7 @@ if (BUILD_TESTS)
ErrorRecovery.cc
RegexGuard.cc
RegexEngine.cc
SearchHighlight.cc
KKeymap.cc
SwapRecorder.h
OptimizedSearch.cc