Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 998b1b9817 | |||
| dc2cf4c0a6 | |||
| f6c4a5ab34 |
@@ -3,8 +3,8 @@ project(kte)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(KTE_VERSION "1.3.4")
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(KTE_VERSION "1.3.7")
|
||||
|
||||
# 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")
|
||||
@@ -32,25 +32,23 @@ else ()
|
||||
endif ()
|
||||
|
||||
add_compile_options(
|
||||
"-static"
|
||||
"-Wall"
|
||||
"-Wextra"
|
||||
"-Werror"
|
||||
"-Wno-unused-function"
|
||||
"-Wno-unused-parameter"
|
||||
"-g"
|
||||
"$<$<CONFIG:RELEASE>:-O2>"
|
||||
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
add_compile_options("/W4" "$<$<CONFIG:RELEASE>:/O2>")
|
||||
else ()
|
||||
add_compile_options(
|
||||
"-static"
|
||||
"-Wall"
|
||||
"-Wextra"
|
||||
"-Werror"
|
||||
"-pedantic"
|
||||
"-Wno-unused-function"
|
||||
"-Wno-unused-parameter"
|
||||
"$<$<CONFIG:RELEASE>:-O2>"
|
||||
"$<$<CONFIG:DEBUG>:-g>"
|
||||
"$<$<CONFIG:RELEASE>:-O2>")
|
||||
)
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
add_compile_options("-stdlib=libc++")
|
||||
else ()
|
||||
|
||||
23
Command.cc
23
Command.cc
@@ -957,7 +957,9 @@ cmd_theme_set_by_name(const CommandContext &ctx)
|
||||
ltrim(name);
|
||||
rtrim(name);
|
||||
if (name.empty()) {
|
||||
ctx.editor.SetStatus("theme: missing name");
|
||||
// Show current theme when no argument provided
|
||||
ctx.editor.SetStatus(
|
||||
std::string("Current theme: ") + kte::CurrentThemeName());
|
||||
return true;
|
||||
}
|
||||
if (kte::ApplyThemeByName(name)) {
|
||||
@@ -1011,7 +1013,12 @@ cmd_font_set_by_name(const CommandContext &ctx)
|
||||
return (char) std::tolower(c);
|
||||
});
|
||||
if (name.empty()) {
|
||||
ctx.editor.SetStatus("font: missing name");
|
||||
// Show current font when no argument provided
|
||||
auto ® = FontRegistry::Instance();
|
||||
std::string current_font = reg.CurrentFontName();
|
||||
if (current_font.empty())
|
||||
current_font = "default";
|
||||
ctx.editor.SetStatus(std::string("Current font: ") + current_font);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1062,7 +1069,17 @@ cmd_font_set_size(const CommandContext &ctx)
|
||||
ltrim(a);
|
||||
rtrim(a);
|
||||
if (a.empty()) {
|
||||
ctx.editor.SetStatus("font-size: missing value");
|
||||
// Show current font size when no argument provided
|
||||
auto ® = FontRegistry::Instance();
|
||||
float current_size = reg.CurrentFontSize();
|
||||
if (current_size <= 0.0f) {
|
||||
// Fallback to current ImGui font size if available
|
||||
current_size = ImGui::GetFontSize();
|
||||
if (current_size <= 0.0f)
|
||||
current_size = 16.0f;
|
||||
}
|
||||
ctx.editor.SetStatus(
|
||||
std::string("Current font size: ") + std::to_string((int) std::round(current_size)));
|
||||
return true;
|
||||
}
|
||||
char *endp = nullptr;
|
||||
|
||||
@@ -38,7 +38,7 @@ enum class ThemeId {
|
||||
|
||||
// Current theme tracking
|
||||
static inline auto gCurrentTheme = ThemeId::Nord;
|
||||
static inline std::size_t gCurrentThemeIndex = 0;
|
||||
static inline std::size_t gCurrentThemeIndex = 6; // Nord index
|
||||
|
||||
// Forward declarations for helpers used below
|
||||
static size_t ThemeIndexFromId(ThemeId id);
|
||||
|
||||
16
make-app-release
Executable file
16
make-app-release
Executable 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 -DENABLE_ASAN=OFF
|
||||
|
||||
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
26
make-release
Executable 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 )
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user