]> git.lyx.org Git - features.git/commitdiff
Optimization: don't do suggestion if we only want to mark misspelled words.
authorAbdelrazak Younes <younes@lyx.org>
Sun, 2 Aug 2009 10:09:29 +0000 (10:09 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sun, 2 Aug 2009 10:09:29 +0000 (10:09 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30825 a592a061-630c-0410-9148-cb99ea01b6c8

src/Paragraph.cpp
src/Paragraph.h

index 5f238495532eb41bd0b354e3da1561ec7bc14a73..94b816ca239324efd5c04fd6e815f88796dcc997 100644 (file)
@@ -3060,7 +3060,7 @@ void Paragraph::updateWords()
 
 
 bool Paragraph::spellCheck(pos_type & from, pos_type & to, WordLangTuple & wl,
-       docstring_list & suggestions) const
+       docstring_list & suggestions, bool do_suggestion) const
 {
        SpellChecker * speller = theSpellChecker();
        if (!speller)
@@ -3088,7 +3088,7 @@ bool Paragraph::spellCheck(pos_type & from, pos_type & to, WordLangTuple & wl,
        if (lyxrc.spellcheck_continuously)
                d->fontlist_.setMisspelled(from, to, misspelled);
 
-       if (misspelled)
+       if (misspelled && do_suggestion)
                speller->suggest(wl, suggestions);
        else
                suggestions.clear();
@@ -3103,7 +3103,7 @@ bool Paragraph::isMisspelled(pos_type pos) const
        pos_type to = pos;
        WordLangTuple wl;
        docstring_list suggestions;
-       return spellCheck(from, to, wl, suggestions);
+       return spellCheck(from, to, wl, suggestions, false);
 }
 
 
index e1cb33e0f1cc9ebf42a90aecf077dc96fad2a16d..c323c000edc830c4966527d6e6a124471331f692 100644 (file)
@@ -417,10 +417,11 @@ public:
        ///
        void updateWords();
 
-       /// Spellcheck word at position \p from and fill in found misspelled word.
+       /// Spellcheck word at position \p from and fill in found misspelled word
+       /// and \p suggestions if \p do_suggestion is true.
        /// \return true if pointed word is misspelled.
        bool spellCheck(pos_type & from, pos_type & to, WordLangTuple & wl,
-               docstring_list & suggestions) const;
+               docstring_list & suggestions, bool do_suggestion =  true) const;
 
        /// Spellcheck word at position \p pos.
        /// \return true if pointed word is misspelled.