diff options
author | McCabe Maxsted | 2011-04-13 16:19:40 -0700 |
---|---|---|
committer | McCabe Maxsted | 2011-04-13 16:19:40 -0700 |
commit | cf8be1ce5466f1005f89e0a49693e6450e280fa3 (patch) | |
tree | 7aee6da0537fb5aecea4bc85b9505f0c83f7d779 /linden/indra/llui | |
parent | Identify Windows Server 2008 and 2008 R2, added Win 8 detection for future-pr... (diff) | |
download | meta-impy-cf8be1ce5466f1005f89e0a49693e6450e280fa3.zip meta-impy-cf8be1ce5466f1005f89e0a49693e6450e280fa3.tar.gz meta-impy-cf8be1ce5466f1005f89e0a49693e6450e280fa3.tar.bz2 meta-impy-cf8be1ce5466f1005f89e0a49693e6450e280fa3.tar.xz |
Fixed crash in spellchecking when deleting selections while lagging
Diffstat (limited to 'linden/indra/llui')
-rw-r--r-- | linden/indra/llui/lllineeditor.cpp | 31 | ||||
-rw-r--r-- | linden/indra/llui/lltexteditor.cpp | 23 |
2 files changed, 30 insertions, 24 deletions
diff --git a/linden/indra/llui/lllineeditor.cpp b/linden/indra/llui/lllineeditor.cpp index 1d998be..7618985 100644 --- a/linden/indra/llui/lllineeditor.cpp +++ b/linden/indra/llui/lllineeditor.cpp | |||
@@ -604,21 +604,24 @@ std::vector<S32> LLLineEditor::getMisspelledWordsPositions() | |||
604 | { | 604 | { |
605 | wordEnd++; | 605 | wordEnd++; |
606 | } | 606 | } |
607 | //got a word :D | ||
608 | std::string selectedWord(std::string(text.begin(), | ||
609 | text.end()).substr(wordStart,wordEnd-wordStart)); | ||
610 | 607 | ||
611 | if(!glggHunSpell->isSpelledRight(selectedWord)) | 608 | //got a word? -- MC |
612 | { | 609 | if (wordStart != wordEnd) |
613 | //misspelled word here, and you have just right clicked on it! | 610 | { |
614 | //get the center of this word.. | 611 | std::string selectedWord(std::string(text.begin(), |
615 | //S32 center = llround( (wordEnd-wordStart)/2 ) + wordStart; | 612 | text.end()).substr(wordStart,wordEnd-wordStart)); |
616 | //turn this cursor position into a pixel pos | 613 | |
617 | //center = findPixelNearestPos(center-getCursor()); | 614 | if(!selectedWord.empty() && !glggHunSpell->isSpelledRight(selectedWord)) |
615 | { | ||
616 | //misspelled word here, and you have just right clicked on it! | ||
617 | //get the center of this word.. | ||
618 | //S32 center = llround( (wordEnd-wordStart)/2 ) + wordStart; | ||
619 | //turn this cursor position into a pixel pos | ||
620 | //center = findPixelNearestPos(center-getCursor()); | ||
618 | 621 | ||
619 | thePosesOfBadWords.push_back( | 622 | thePosesOfBadWords.push_back(wordStart); |
620 | wordStart); | 623 | thePosesOfBadWords.push_back(wordEnd); |
621 | thePosesOfBadWords.push_back(wordEnd); | 624 | } |
622 | } | 625 | } |
623 | } | 626 | } |
624 | wordEnd++; | 627 | wordEnd++; |
@@ -2056,7 +2059,7 @@ void LLLineEditor::drawMisspelled(LLRect background) | |||
2056 | } | 2059 | } |
2057 | } | 2060 | } |
2058 | 2061 | ||
2059 | if (glggHunSpell->getSpellCheckHighlight()) | 2062 | if (!misspellLocations.empty() && glggHunSpell->getSpellCheckHighlight()) |
2060 | { | 2063 | { |
2061 | for (int i =0; i<(int)misspellLocations.size(); i++) | 2064 | for (int i =0; i<(int)misspellLocations.size(); i++) |
2062 | { | 2065 | { |
diff --git a/linden/indra/llui/lltexteditor.cpp b/linden/indra/llui/lltexteditor.cpp index 0cafd4b..963eede 100644 --- a/linden/indra/llui/lltexteditor.cpp +++ b/linden/indra/llui/lltexteditor.cpp | |||
@@ -527,17 +527,20 @@ std::vector<S32> LLTextEditor::getMisspelledWordsPositions() | |||
527 | { | 527 | { |
528 | wordEnd++; | 528 | wordEnd++; |
529 | } | 529 | } |
530 | //got a word :D | ||
531 | |||
532 | std::string regText(text.begin(),text.end()); | ||
533 | std::string selectedWord(regText.substr(wordStart,wordEnd-wordStart)); | ||
534 | 530 | ||
535 | if(!glggHunSpell->isSpelledRight(selectedWord)) | 531 | //got a word? -- MC |
536 | { | 532 | if (wordStart != wordEnd) |
537 | //misspelled word here, and you have just right clicked on it | 533 | { |
534 | std::string regText(text.begin(),text.end()); | ||
535 | std::string selectedWord(regText.substr(wordStart,wordEnd-wordStart)); | ||
536 | |||
537 | if(!selectedWord.empty() && !glggHunSpell->isSpelledRight(selectedWord)) | ||
538 | { | ||
539 | //misspelled word here, and you have just right clicked on it | ||
538 | 540 | ||
539 | thePosesOfBadWords.push_back(wordStart); | 541 | thePosesOfBadWords.push_back(wordStart); |
540 | thePosesOfBadWords.push_back(wordEnd); | 542 | thePosesOfBadWords.push_back(wordEnd); |
543 | } | ||
541 | } | 544 | } |
542 | } | 545 | } |
543 | wordEnd++; | 546 | wordEnd++; |
@@ -3281,7 +3284,7 @@ void LLTextEditor::drawMisspelled() | |||
3281 | } | 3284 | } |
3282 | } | 3285 | } |
3283 | //draw | 3286 | //draw |
3284 | if (glggHunSpell->getSpellCheckHighlight()) | 3287 | if (!misspellLocations.empty() && glggHunSpell->getSpellCheckHighlight()) |
3285 | { | 3288 | { |
3286 | for (int i = 0; i<(int)misspellLocations.size() ;i++) | 3289 | for (int i = 0; i<(int)misspellLocations.size() ;i++) |
3287 | { | 3290 | { |