Optimization: don't do suggestion if we only want to mark misspelled words.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30825 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2009-08-02 10:09:29 +00:00
parent 1f53de6592
commit c53d9099c1
2 changed files with 6 additions and 5 deletions

View 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);
}

View 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.