From 60592ae0d7a98e071e516fcac70c5bf1427f20be Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Thu, 22 Feb 2024 08:38:12 +0800 Subject: IME composition is now replaced by the result instead of being printed alongside. For now, it always gets reset from the start after pressing Return, which is to be fixed next. --- indra/llui/lllineeditor.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'indra/llui/lllineeditor.cpp') diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 34d08b99de..f306ecd513 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -1009,7 +1009,7 @@ void LLLineEditor::addChar(const llwchar uni_char) getWindow()->hideCursorUntilMouseMove(); } -void LLLineEditor::addString(char *s) +void LLLineEditor::addString(char *s, bool editing) { if (hasSelection()) deleteSelection(); @@ -1018,9 +1018,13 @@ void LLLineEditor::addString(char *s) .substr(getCursor(), 1))) return; mText.erase(getCursor(), 1); + } else if (editing) { + mText.clear(); + setCursor(0); } mText.insert(getCursor(), utf8str_to_wstring(s)); - setCursor(getCursor() + 1); + if (editing) setCursor(strlen(s)); + else setCursor(getCursor() + 1); getWindow()->hideCursorUntilMouseMove(); } @@ -1665,7 +1669,7 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char) return handled; } -BOOL LLLineEditor::handleUnicodeStringHere(char *uni_str) +BOOL LLLineEditor::handleUnicodeStringHere(char *uni_str, bool editing) { auto handled = FALSE; @@ -1674,7 +1678,7 @@ BOOL LLLineEditor::handleUnicodeStringHere(char *uni_str) handled = TRUE; LLLineEditorRollback rollback(this); - addString(uni_str); + addString(uni_str, editing); mKeystrokeTimer.reset(); deselect(); -- cgit v1.2.3