summaryrefslogtreecommitdiff
path: root/indra/llui/lllineeditor.cpp
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2012-03-30 12:45:38 -0400
committerOz Linden <oz@lindenlab.com>2012-03-30 12:45:38 -0400
commit6f71df192720ec3f16e7e7102ad21f4d140b8e07 (patch)
tree35e9865e19498f45ee7a700f564c2e4b1f2d5033 /indra/llui/lllineeditor.cpp
parent04636effcffde85a3b7005491a1fd51395cb37d1 (diff)
parent2114e88cd1291ef1dba4b79bcdcca4b2d134262f (diff)
merge updates
Diffstat (limited to 'indra/llui/lllineeditor.cpp')
-rw-r--r--indra/llui/lllineeditor.cpp54
1 files changed, 24 insertions, 30 deletions
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 5479c080bd..42cfc4cae9 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -66,7 +66,7 @@ const S32 SCROLL_INCREMENT_ADD = 0; // make space for typing
const S32 SCROLL_INCREMENT_DEL = 4; // make space for baskspacing
const F32 AUTO_SCROLL_TIME = 0.05f;
const F32 TRIPLE_CLICK_INTERVAL = 0.3f; // delay between double and triple click. *TODO: make this equal to the double click interval?
-const F32 SPELLCHECK_DELAY = 0.5f; // delay between the last keypress and showing spell checking feedback for the word the cursor is on
+const F32 SPELLCHECK_DELAY = 0.5f; // delay between the last keypress and spell checking the word the cursor is on
const std::string PASSWORD_ASTERISK( "\xE2\x80\xA2" ); // U+2022 BULLET
@@ -617,6 +617,7 @@ bool LLLineEditor::isMisspelledWord(U32 pos) const
void LLLineEditor::onSpellCheckSettingsChange()
{
// Recheck the spelling on every change
+ mMisspellRanges.clear();
mSpellCheckStart = mSpellCheckEnd = -1;
}
@@ -1158,9 +1159,8 @@ void LLLineEditor::cut()
LLUI::reportBadKeystroke();
}
else
- if( mKeystrokeCallback )
{
- mKeystrokeCallback( this );
+ onKeystroke();
}
}
}
@@ -1294,9 +1294,8 @@ void LLLineEditor::pasteHelper(bool is_primary)
LLUI::reportBadKeystroke();
}
else
- if( mKeystrokeCallback )
{
- mKeystrokeCallback( this );
+ onKeystroke();
}
}
}
@@ -1549,10 +1548,7 @@ BOOL LLLineEditor::handleKeyHere(KEY key, MASK mask )
// Notify owner if requested
if (!need_to_rollback && handled)
{
- if (mKeystrokeCallback)
- {
- mKeystrokeCallback(this);
- }
+ onKeystroke();
if ( (!selection_modified) && (KEY_BACKSPACE == key) )
{
mSpellCheckTimer.setTimerExpirySec(SPELLCHECK_DELAY);
@@ -1608,12 +1604,10 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char)
// Notify owner if requested
if( !need_to_rollback && handled )
{
- if( mKeystrokeCallback )
- {
- // HACK! The only usage of this callback doesn't do anything with the character.
- // We'll have to do something about this if something ever changes! - Doug
- mKeystrokeCallback( this );
- }
+ // HACK! The only usage of this callback doesn't do anything with the character.
+ // We'll have to do something about this if something ever changes! - Doug
+ onKeystroke();
+
mSpellCheckTimer.setTimerExpirySec(SPELLCHECK_DELAY);
}
}
@@ -1643,9 +1637,7 @@ void LLLineEditor::doDelete()
if (!prevalidateInput(text_to_delete))
{
- if( mKeystrokeCallback )
- mKeystrokeCallback( this );
-
+ onKeystroke();
return;
}
setCursor(getCursor() + 1);
@@ -1661,10 +1653,8 @@ void LLLineEditor::doDelete()
}
else
{
- if( mKeystrokeCallback )
- {
- mKeystrokeCallback( this );
- }
+ onKeystroke();
+
mSpellCheckTimer.setTimerExpirySec(SPELLCHECK_DELAY);
}
}
@@ -2296,6 +2286,15 @@ void LLLineEditor::setSelectAllonFocusReceived(BOOL b)
mSelectAllonFocusReceived = b;
}
+void LLLineEditor::onKeystroke()
+{
+ if (mKeystrokeCallback)
+ {
+ mKeystrokeCallback(this);
+ }
+
+ mSpellCheckStart = mSpellCheckEnd = -1;
+}
void LLLineEditor::setKeystrokeCallback(callback_t callback, void* user_data)
{
@@ -2418,10 +2417,8 @@ void LLLineEditor::updatePreedit(const LLWString &preedit_string,
// Update of the preedit should be caused by some key strokes.
mKeystrokeTimer.reset();
- if( mKeystrokeCallback )
- {
- mKeystrokeCallback( this );
- }
+ onKeystroke();
+
mSpellCheckTimer.setTimerExpirySec(SPELLCHECK_DELAY);
}
@@ -2575,6 +2572,7 @@ void LLLineEditor::showContextMenu(S32 x, S32 y)
S32 screen_x, screen_y;
localPointToScreen(x, y, &screen_x, &screen_y);
+ setCursorAtLocalPos(x);
if (hasSelection())
{
if ( (mCursorPos < llmin(mSelectionStart, mSelectionEnd)) || (mCursorPos > llmax(mSelectionStart, mSelectionEnd)) )
@@ -2582,10 +2580,6 @@ void LLLineEditor::showContextMenu(S32 x, S32 y)
else
setCursor(llmax(mSelectionStart, mSelectionEnd));
}
- else
- {
- setCursorAtLocalPos(x);
- }
bool use_spellcheck = getSpellCheck(), is_misspelled = false;
if (use_spellcheck)