diff options
author | Erik Kundiman <erik@megapahit.org> | 2024-02-22 08:38:12 +0800 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2024-02-22 08:38:12 +0800 |
commit | 60592ae0d7a98e071e516fcac70c5bf1427f20be (patch) | |
tree | 270a0d44f14634f7519ba222bee6203d7ed4c6e8 /indra/llui | |
parent | 15e0231006838044b0315c19ed6a1b67a1da8e75 (diff) |
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.
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llfocusmgr.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llfocusmgr.h | 2 | ||||
-rw-r--r-- | indra/llui/lllineeditor.cpp | 12 | ||||
-rw-r--r-- | indra/llui/lllineeditor.h | 4 | ||||
-rw-r--r-- | indra/llui/lltexteditor.cpp | 10 | ||||
-rw-r--r-- | indra/llui/lltexteditor.h | 4 | ||||
-rw-r--r-- | indra/llui/llview.cpp | 8 | ||||
-rw-r--r-- | indra/llui/llview.h | 4 |
8 files changed, 27 insertions, 19 deletions
diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp index 856e03b3ab..3bc56a8360 100644 --- a/indra/llui/llfocusmgr.cpp +++ b/indra/llui/llfocusmgr.cpp @@ -59,7 +59,7 @@ BOOL LLFocusableElement::handleUnicodeChar(llwchar uni_char, BOOL called_from_pa } // virtual -BOOL LLFocusableElement::handleUnicodeString(char *uni_str, BOOL called_from_parent) +BOOL LLFocusableElement::handleUnicodeString(char *uni_str, bool editing, BOOL called_from_parent) { return FALSE; } diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h index f26690f4cb..e916c9a737 100644 --- a/indra/llui/llfocusmgr.h +++ b/indra/llui/llfocusmgr.h @@ -59,7 +59,7 @@ public: virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); virtual BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent); virtual BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent); - virtual BOOL handleUnicodeString(char *uni_str, BOOL called_from_parent); + virtual BOOL handleUnicodeString(char *uni_str, bool editing, BOOL called_from_parent); /** * If true this LLFocusableElement wants to receive KEYUP and KEYDOWN messages 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(); diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index a8c6ee4536..836f59b843 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -130,7 +130,7 @@ public: /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask ); /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char); - /*virtual*/ BOOL handleUnicodeStringHere(char *uni_str); + /*virtual*/ BOOL handleUnicodeStringHere(char *uni_str, bool editing); /*virtual*/ void onMouseCaptureLost(); // LLEditMenuHandler overrides @@ -297,7 +297,7 @@ public: void removeChar(); void addChar(const llwchar c); - void addString(char *s); + void addString(char *s, bool editing); void setCursorAtLocalPos(S32 local_mouse_x); S32 findPixelNearestPos(S32 cursor_offset = 0) const; S32 calcCursorPos(S32 mouse_x); diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 299af0dec8..d81009246f 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1202,7 +1202,7 @@ void LLTextEditor::addChar(llwchar wc) } } -void LLTextEditor::addString(char *str) +void LLTextEditor::addString(char *str, bool editing) { if (!getEnabled()) return; @@ -1210,6 +1210,10 @@ void LLTextEditor::addString(char *str) deleteSelection(TRUE); else if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode()) removeChar(mCursorPos); + else if (editing) { + clear(); + setCursorPos(0); + } setCursorPos(mCursorPos + addString(mCursorPos, str)); @@ -1948,12 +1952,12 @@ BOOL LLTextEditor::handleUnicodeCharHere(llwchar uni_char) return handled; } -BOOL LLTextEditor::handleUnicodeStringHere(char *uni_str) +BOOL LLTextEditor::handleUnicodeStringHere(char *uni_str, bool editing) { auto handled = FALSE; if (!mReadOnly) { - addString(uni_str); + addString(uni_str, editing); getWindow()->hideCursorUntilMouseMove(); handled = TRUE; } diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 513781e365..0697a2149d 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -101,7 +101,7 @@ public: virtual BOOL handleKeyHere(KEY key, MASK mask ); virtual BOOL handleUnicodeCharHere(llwchar uni_char); - virtual BOOL handleUnicodeStringHere(char *uni_str); + virtual BOOL handleUnicodeStringHere(char *uni_str, bool editing); virtual void onMouseCaptureLost(); @@ -242,7 +242,7 @@ protected: // Undoable operations void addChar(llwchar c); // at mCursorPos S32 addChar(S32 pos, llwchar wc); - void addString(char *s); + void addString(char *s, bool editing); S32 addString(S32 pos, char *str); void addLineBreakChar(BOOL group_together = FALSE); S32 overwriteChar(S32 pos, llwchar wc); diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 6547a99a32..1f39e495a5 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1043,18 +1043,18 @@ BOOL LLView::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) return handled; } -BOOL LLView::handleUnicodeString(char *uni_str, BOOL called_from_parent) +BOOL LLView::handleUnicodeString(char *uni_str, bool editing, BOOL called_from_parent) { auto handled = FALSE; if (getVisible() && getEnabled() && !handled) { - handled = handleUnicodeStringHere(uni_str); + handled = handleUnicodeStringHere(uni_str, editing); if (handled && LLView::sDebugKeys) LL_INFOS() << "Unicode key handled by " << getName() << LL_ENDL; } if (!handled && !called_from_parent && mParentView) - handled = mParentView->handleUnicodeString(uni_str, FALSE); + handled = mParentView->handleUnicodeString(uni_str, editing, FALSE); return handled; } @@ -1064,7 +1064,7 @@ BOOL LLView::handleUnicodeCharHere(llwchar uni_char ) return FALSE; } -BOOL LLView::handleUnicodeStringHere(char *uni_str) +BOOL LLView::handleUnicodeStringHere(char *uni_str, bool editing) { return FALSE; } diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 4e101adecb..f455120db4 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -382,7 +382,7 @@ public: /* virtual */ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); /* virtual */ BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent); /* virtual */ BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent); - /* virtual */ BOOL handleUnicodeString(char *uni_str, BOOL called_from_parent); + /* virtual */ BOOL handleUnicodeString(char *uni_str, bool editing, BOOL called_from_parent); virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, @@ -516,7 +516,7 @@ public: virtual BOOL handleKeyHere(KEY key, MASK mask); virtual BOOL handleKeyUpHere(KEY key, MASK mask); virtual BOOL handleUnicodeCharHere(llwchar uni_char); - virtual BOOL handleUnicodeStringHere(char *uni_str); + virtual BOOL handleUnicodeStringHere(char *uni_str, bool editing); virtual void handleReshape(const LLRect& rect, bool by_user); virtual void dirtyRect(); |