From c18baee46900b95e1a6092a85abca7d682235d32 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Fri, 1 May 2009 10:54:32 +0000 Subject: [PATCH] Move isLetter() logic to Paragraph::isLetter(). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29468 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/DocIterator.cpp | 9 +-------- src/Paragraph.cpp | 9 ++++++--- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/DocIterator.cpp b/src/DocIterator.cpp index 49705bc96b..6115bf2879 100644 --- a/src/DocIterator.cpp +++ b/src/DocIterator.cpp @@ -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 diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 198b1182f9..2bd646e083 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -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; -- 2.39.2