diff options
Diffstat (limited to 'indra/llui/lllineeditor.cpp')
-rw-r--r-- | indra/llui/lllineeditor.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 453fa29e7c..9f55738401 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -1011,6 +1011,25 @@ void LLLineEditor::addChar(const llwchar uni_char) getWindow()->hideCursorUntilMouseMove(); } +void LLLineEditor::addString(char *s, bool editing) +{ + if (hasSelection()) + deleteSelection(); + else if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode()) { + if (!prevalidateInput(mText.getWString() + .substr(getCursor(), 1))) + return; + mText.erase(getCursor(), 1); + } else if (editing) { + mText.clear(); + setCursor(0); + } + mText.insert(getCursor(), utf8str_to_wstring(s)); + if (editing) setCursor(strlen(s)); + else setCursor(getCursor() + 1); + getWindow()->hideCursorUntilMouseMove(); +} + // Extends the selection box to the new cursor position void LLLineEditor::extendSelection( S32 new_cursor_pos ) { @@ -1652,6 +1671,36 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char) return handled; } +BOOL LLLineEditor::handleUnicodeStringHere(char *uni_str, bool editing) +{ + auto handled = FALSE; + + if ((gFocusMgr.getKeyboardFocus() == this) + && getVisible() && !mReadOnly) { + handled = TRUE; + LLLineEditorRollback rollback(this); + + addString(uni_str, editing); + + mKeystrokeTimer.reset(); + deselect(); + auto need_to_rollback = FALSE; + need_to_rollback |= (mPrevalidateFunc + && !mPrevalidateFunc(mText.getWString())); + + if (need_to_rollback) { + rollback.doRollback(this); + LLUI::getInstance()->reportBadKeystroke(); + } + + if (!need_to_rollback && handled) { + onKeystroke(); + mSpellCheckTimer.setTimerExpirySec(SPELLCHECK_DELAY); + } + } + + return handled; +} BOOL LLLineEditor::canDoDelete() const { |