From c53d9099c137354386a59b0acc757d991a230740 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Sun, 2 Aug 2009 10:09:29 +0000 Subject: [PATCH] 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 --- src/Paragraph.cpp | 6 +++--- src/Paragraph.h | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 5f23849553..94b816ca23 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -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); } diff --git a/src/Paragraph.h b/src/Paragraph.h index e1cb33e0f1..c323c000ed 100644 --- a/src/Paragraph.h +++ b/src/Paragraph.h @@ -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.