Update highlighter logic, add release scripts, and bump version to 1.3.6.
Some checks failed
Release / Bump Homebrew formula (push) Has been cancelled
Release / Build Linux amd64 (push) Has been cancelled
Release / Build Linux arm64 (push) Has been cancelled
Release / Build macOS arm64 (.app) (push) Has been cancelled
Release / Create GitHub Release (push) Has been cancelled

- Refined cached state validation in `HighlighterEngine` to ensure row validity and buffer consistency.
- Added `make-release` and `make-app-release` scripts for streamlined release builds.
- Disabled AddressSanitizer (ASAN) by default.
- Version bump to 1.3.6.
This commit is contained in:
2025-12-03 16:20:04 -08:00
parent f6c4a5ab34
commit dc2cf4c0a6
4 changed files with 50 additions and 4 deletions

View File

@@ -4,7 +4,7 @@ project(kte)
include(GNUInstallDirs)
set(CMAKE_CXX_STANDARD 17)
set(KTE_VERSION "1.3.5")
set(KTE_VERSION "1.3.6")
# Default to terminal-only build to avoid SDL/OpenGL dependency by default.
# Enable with -DBUILD_GUI=ON when SDL2/OpenGL/Freetype are available.
@@ -16,7 +16,7 @@ option(KTE_UNDO_DEBUG "Enable undo instrumentation logs" OFF)
option(KTE_ENABLE_TREESITTER "Enable optional Tree-sitter highlighter adapter" OFF)
# Optionally enable AddressSanitizer (ASan)
option(ENABLE_ASAN "Enable AddressSanitizer for builds" ON)
option(ENABLE_ASAN "Enable AddressSanitizer for builds" OFF)
if (ENABLE_ASAN)
message(STATUS "ASan enabled")

16
make-app-release Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -eu
set -o pipefail
mkdir -p cmake-build-release
cmake -S . -B cmake-build-release -DBUILD_GUI=ON -DCMAKE_BUILD_TYPE=Release
cd cmake-build-release
make clean
rm -fr kge.app*
make
zip -r kge.app.zip kge.app
sha256sum kge.app.zip
open .
cd ..

26
make-release Executable file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -eu
set -o pipefail
KTE_VERSION=$(grep 'KTE_VERSION' CMakeLists.txt | grep -o '"[0-9.]*"' | tr -d '"')
KTE_VERSION="v${KTE_VERSION}"
if [ "${KTE_VERSION}" = "v" ]
then
echo "invalid version" > /dev/stderr
exit 1
fi
echo "kte version ${KTE_VERSION}"
TREE="$(git status --porcelain --untracked-files=no)"
if [ ! -z "${TREE}" ]
then
echo "tree is dirty" > /dev/stderr
exit 1
fi
git tag "${KTE_VERSION}"
git push && git push --tags
( ./make-app-release )

View File

@@ -75,9 +75,13 @@ HighlighterEngine::GetLine(const Buffer &buf, int row, std::uint64_t buf_version
int best = -1;
for (const auto &kv: state_cache_) {
int r = kv.first;
// Only use cached state if it's for the current version and row still exists
if (r <= row - 1 && kv.second.version == buf_version) {
if (r > best)
best = r;
// Validate that the cached row index is still valid in the buffer
if (r >= 0 && static_cast<std::size_t>(r) < buf.Rows().size()) {
if (r > best)
best = r;
}
}
}
if (best >= 0) {