Merge branch 'main' into qt_removal
Some checks failed
Build and Release / reuse (push) Has been cancelled
Build and Release / clang-format (push) Has been cancelled
Build and Release / get-info (push) Has been cancelled
Build and Release / windows-sdl (push) Has been cancelled
Build and Release / macos-sdl (push) Has been cancelled
Build and Release / linux-sdl (push) Has been cancelled
Build and Release / linux-sdl-gcc (push) Has been cancelled
Build and Release / pre-release (push) Has been cancelled

This commit is contained in:
georgemoralis 2025-10-14 08:42:01 +03:00 committed by GitHub
commit 8796c0355a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -80,10 +80,10 @@ void ImeState::SendEnterEvent() {
// Sync work and input buffers with the latest UTF-8 text // Sync work and input buffers with the latest UTF-8 text
if (current_text.begin()) { if (current_text.begin()) {
ConvertUTF8ToOrbis(current_text.begin(), current_text.size(), ConvertUTF8ToOrbis(current_text.begin(), current_text.size(),
reinterpret_cast<char16_t*>(work_buffer), max_text_length); reinterpret_cast<char16_t*>(work_buffer), max_text_length + 1);
if (text_buffer) { if (text_buffer) {
ConvertUTF8ToOrbis(current_text.begin(), current_text.size(), text_buffer, ConvertUTF8ToOrbis(current_text.begin(), current_text.size(), text_buffer,
max_text_length); max_text_length + 1);
} }
} }
if (text.str) { if (text.str) {
@ -114,10 +114,10 @@ void ImeState::SendCloseEvent() {
// Sync work and input buffers with the latest UTF-8 text // Sync work and input buffers with the latest UTF-8 text
if (current_text.begin()) { if (current_text.begin()) {
ConvertUTF8ToOrbis(current_text.begin(), current_text.size(), ConvertUTF8ToOrbis(current_text.begin(), current_text.size(),
reinterpret_cast<char16_t*>(work_buffer), max_text_length); reinterpret_cast<char16_t*>(work_buffer), max_text_length + 1);
if (text_buffer) { if (text_buffer) {
ConvertUTF8ToOrbis(current_text.begin(), current_text.size(), text_buffer, ConvertUTF8ToOrbis(current_text.begin(), current_text.size(), text_buffer,
max_text_length); max_text_length + 1);
} }
} }
if (text.str) { if (text.str) {
@ -145,7 +145,7 @@ void ImeState::SetText(const char16_t* text, u32 length) {
} }
// Clamp to the effective maximum number of characters // Clamp to the effective maximum number of characters
const u32 clamped_len = std::min(length, max_text_length); const u32 clamped_len = std::min(length, max_text_length) + 1;
if (!ConvertOrbisToUTF8(text, clamped_len, current_text.begin(), current_text.capacity())) { if (!ConvertOrbisToUTF8(text, clamped_len, current_text.begin(), current_text.capacity())) {
LOG_ERROR(Lib_Ime, "ImeState::SetText failed to convert updated text to UTF-8"); LOG_ERROR(Lib_Ime, "ImeState::SetText failed to convert updated text to UTF-8");
return; return;
@ -293,14 +293,14 @@ int ImeUi::InputTextCallback(ImGuiInputTextCallbackData* data) {
eventParam.text_area[0].mode = OrbisImeTextAreaMode::Edit; eventParam.text_area[0].mode = OrbisImeTextAreaMode::Edit;
if (!ui->state->ConvertUTF8ToOrbis(data->Buf, data->BufTextLen, eventParam.str, if (!ui->state->ConvertUTF8ToOrbis(data->Buf, data->BufTextLen, eventParam.str,
ui->state->max_text_length)) { ui->state->max_text_length + 1)) {
LOG_ERROR(Lib_Ime, "Failed to convert UTF-8 to Orbis for eventParam.str"); LOG_ERROR(Lib_Ime, "Failed to convert UTF-8 to Orbis for eventParam.str");
return 0; return 0;
} }
if (!ui->state->ConvertUTF8ToOrbis(data->Buf, data->BufTextLen, if (!ui->state->ConvertUTF8ToOrbis(data->Buf, data->BufTextLen,
ui->ime_param->inputTextBuffer, ui->ime_param->inputTextBuffer,
ui->state->max_text_length)) { ui->state->max_text_length + 1)) {
LOG_ERROR(Lib_Ime, "Failed to convert UTF-8 to Orbis for inputTextBuffer"); LOG_ERROR(Lib_Ime, "Failed to convert UTF-8 to Orbis for inputTextBuffer");
return 0; return 0;
} }