RegexEngine.h/.cc wrap the regex engine for search, regex replace-all and the terminal and ImGui renderers' match highlighting: - With KTE_USE_PCRE2 (default ON; used when pkg-config finds libpcre2-8, linked as -lpcre2-8) patterns are compiled by PCRE2 with its JIT and matched under a match limit: catastrophic backtracking stops with a status note instead of hanging the editor, and matching does not recurse on the C stack (no large-stack thread; the per-keystroke and per-frame line limit is 1 MiB instead of 2,000 bytes). Otherwise std::regex is used as before. - Replacement strings follow std::regex_replace (ECMAScript as libstdc++ reads it) with either engine: the PCRE2 path expands $&, $n, $`, $', $$ itself and steps over empty matches the same way. - Regex search walks lines over the materialized text instead of calling GetLineView per row. The terminal renderer compiles the pattern once per frame (it compiled it for every row). - 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 the buffer. - default.nix and the Dockerfile add pcre2 and pkg-config. On 26 MB: regex keystroke 1.6 -> 0.14 ms, next 62 -> 6 ms, replace-all 929 -> 438 ms; a rarely matching regex over 105 MB: 1.55 s -> 0.10 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015rcVQiiWyTzoNrsvLSaAfB
26 lines
837 B
Docker
26 lines
837 B
Docker
# Minimal Dockerfile for building and testing kte on Linux
|
|
# This container provides a build environment with all dependencies.
|
|
# Mount the source tree at /kte when running the container.
|
|
FROM alpine:3.19
|
|
|
|
# Install build dependencies
|
|
RUN apk add --no-cache \
|
|
g++ \
|
|
cmake \
|
|
make \
|
|
ncurses-dev \
|
|
pcre2-dev \
|
|
pkgconf \
|
|
sdl2-dev \
|
|
mesa-dev \
|
|
freetype-dev \
|
|
libx11-dev \
|
|
libxext-dev
|
|
|
|
# Set working directory where source will be mounted
|
|
WORKDIR /kte
|
|
|
|
# Default command: build and run tests
|
|
# Add DirectFB include path for SDL2 compatibility on Alpine
|
|
CMD ["sh", "-c", "cmake -B build -DBUILD_GUI=ON -DBUILD_TESTS=ON -DCMAKE_CXX_FLAGS='-I/usr/include/directfb' && cmake --build build --target kte && cmake --build build --target kge && cmake --build build --target kte_tests && ./build/kte_tests"]
|