]> git.lyx.org Git - features.git/commitdiff
Move isLetter() logic to Paragraph::isLetter().
authorAbdelrazak Younes <younes@lyx.org>
Fri, 1 May 2009 10:54:32 +0000 (10:54 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Fri, 1 May 2009 10:54:32 +0000 (10:54 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29468 a592a061-630c-0410-9148-cb99ea01b6c8

src/DocIterator.cpp
src/Paragraph.cpp

index 49705bc96b0fce1d29113a092c610ea2f9ea3f21..6115bf287992a0f7760ee9095bf816b675c6abc9 100644 (file)
@@ -612,14 +612,7 @@ bool operator==(StableDocIterator const & dit1, StableDocIterator const & dit2)
 
 bool isLetter(DocIterator const & dit)
 {
-       return dit.inTexted()
-               && dit.inset().allowSpellCheck()
-               && dit.pos() != dit.lastpos()
-               && (dit.paragraph().isLetter(dit.pos())
-                   // We want to pass the ' and escape chars to ispell
-                   || contains(from_utf8(lyxrc.spellchecker_esc_chars + '\''),
-                               dit.paragraph().getChar(dit.pos())))
-               && !dit.paragraph().isDeleted(dit.pos());
+       return dit.inTexted() && dit.paragraph().isLetter(dit.pos());
 }
 
 } // namespace lyx
index 198b1182f9e589d214e46b40db62cdd38ab5a860..2bd646e0833c874f39ce88b6173da932a3320ae0 100644 (file)
@@ -2352,7 +2352,12 @@ bool Paragraph::isLetter(pos_type pos) const
        if (Inset const * inset = getInset(pos))
                return inset->isLetter();
        char_type const c = d->text_[pos];
-       return isLetterChar(c) || isDigit(c);
+    // We want to pass the ' and escape chars to the spellchecker
+       static docstring const quote = from_utf8(lyxrc.spellchecker_esc_chars + '\'');
+       return (isLetterChar(c) || isDigit(c) || contains(quote, c))
+               && (!d->inset_owner_ || d->inset_owner_->allowSpellCheck())
+               && pos != size()
+               && !isDeleted(pos);
 }
 
 
@@ -2912,8 +2917,6 @@ void Paragraph::collectWords()
        //lyxerr << "Words: ";
        pos_type n = size();
        for (pos_type pos = 0; pos < n; ++pos) {
-               if (isDeleted(pos))
-                       continue;
                if (!isLetter(pos))
                        continue;
                pos_type from = pos;