Various cleanups.

- Update input handling to retain SDL_TEXTINPUT after Tab insertion for better platform consistency.
- Allow multiple app instances in macOS by modifying `Info.plist`.
- Bump version to 1.3.8-alpha.
This commit is contained in:
2025-12-04 00:05:13 -08:00
parent 998b1b9817
commit 495183ebd2
3 changed files with 315 additions and 308 deletions

View File

@@ -4,7 +4,7 @@ project(kte)
include(GNUInstallDirs)
set(CMAKE_CXX_STANDARD 20)
set(KTE_VERSION "1.3.7")
set(KTE_VERSION "1.3.8-alpha")
# Default to terminal-only build to avoid SDL/OpenGL dependency by default.
# Enable with -DBUILD_GUI=ON when SDL2/OpenGL/Freetype are available.

View File

@@ -345,7 +345,9 @@ GUIInputHandler::ProcessSDLEvent(const SDL_Event &e)
segment = std::string_view(text).substr(start);
}
if (!segment.empty()) {
MappedInput ins{true, CommandId::InsertText, std::string(segment), 0};
MappedInput ins{
true, CommandId::InsertText, std::string(segment), 0
};
q_.push(ins);
}
if (has_nl) {
@@ -364,15 +366,14 @@ GUIInputHandler::ProcessSDLEvent(const SDL_Event &e)
produced = map_key(key, mods,
k_prefix_, esc_meta_,
uarg_active_, uarg_collecting_, uarg_negative_, uarg_had_digits_, uarg_value_,
uarg_active_, uarg_collecting_, uarg_negative_, uarg_had_digits_,
uarg_value_,
uarg_text_,
mi);
// If we inserted a TAB on KEYDOWN, suppress any subsequent SDL_TEXTINPUT
// for this keystroke to avoid double insertion on platforms that emit it.
if (produced && mi.hasCommand && mi.id == CommandId::InsertText && mi.arg == "\t") {
suppress_text_input_once_ = true;
}
// Note: Do NOT suppress SDL_TEXTINPUT after inserting a TAB. Most platforms
// do not emit TEXTINPUT for Tab, and suppressing here would incorrectly
// eat the next character typed if no TEXTINPUT follows the Tab press.
// If we just consumed a universal-argument digit or '-' on KEYDOWN and emitted UArgStatus,
// suppress the subsequent SDL_TEXTINPUT for this keystroke to avoid duplicating the digit in status.
@@ -404,7 +405,8 @@ GUIInputHandler::ProcessSDLEvent(const SDL_Event &e)
}
// Alt/Meta + letter can also generate TEXTINPUT on some platforms
const bool is_meta_symbol = (
key == SDLK_COMMA || key == SDLK_PERIOD || key == SDLK_LESS || key == SDLK_GREATER);
key == SDLK_COMMA || key == SDLK_PERIOD || key == SDLK_LESS || key ==
SDLK_GREATER);
if (is_alt && ((key >= SDLK_a && key <= SDLK_z) || is_meta_symbol)) {
should_suppress = true;
}
@@ -574,6 +576,8 @@ GUIInputHandler::ProcessSDLEvent(const SDL_Event &e)
// Attach universal-argument count if present, then clear the state
if (uarg_active_ &&mi
.
id != CommandId::UArgStatus
)

View File

@@ -24,5 +24,8 @@
<string>10.13</string>
<key>NSHighResolutionCapable</key>
<true/>
<!-- Allow running multiple instances of the app -->
<key>LSMultipleInstancesProhibited</key>
<false/>
</dict>
</plist>