]> git.lyx.org Git - lyx.git/blobdiff - src/Paragraph.cpp
Help avoiding shortcut clashes by discriminating strings.
[lyx.git] / src / Paragraph.cpp
index b8db16590caaf2eae6882172eeb823ae02168844..8d7371ff5fa5ecc0dbd884cd849ec4be85dd85ec 100644 (file)
@@ -2847,11 +2847,12 @@ bool Paragraph::isWordSeparator(pos_type pos) const
 {
        if (Inset const * inset = getInset(pos))
                return !inset->isLetter();
+       if (pos == size())
+               return true;
        char_type const c = d->text_[pos];
        // We want to pass the ' and escape chars to the spellchecker
        static docstring const quote = from_utf8(lyxrc.spellchecker_esc_chars + '\'');
-       return (!isLetterChar(c) && !isDigitASCII(c) && !contains(quote, c))
-               || pos == size();
+       return (!isLetterChar(c) && !isDigitASCII(c) && !contains(quote, c));
 }
 
 
@@ -3763,9 +3764,14 @@ void Paragraph::spellCheck() const
 }
 
 
-bool Paragraph::isMisspelled(pos_type pos) const
+bool Paragraph::isMisspelled(pos_type pos, bool check_boundary) const
 {
-       return SpellChecker::misspelled(d->speller_state_.getState(pos));
+       bool result = SpellChecker::misspelled(d->speller_state_.getState(pos));
+       if (result || pos <= 0 || pos >= size())
+               return result;
+       if (check_boundary && isWordSeparator(pos))
+               result = SpellChecker::misspelled(d->speller_state_.getState(pos - 1));
+       return result;
 }