]> git.lyx.org Git - features.git/commitdiff
Factor out Buffer::requestSpellcheck() function
authorJuergen Spitzmueller <spitz@lyx.org>
Thu, 25 Nov 2021 16:04:17 +0000 (17:04 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Thu, 25 Nov 2021 16:04:17 +0000 (17:04 +0100)
src/Buffer.cpp
src/Buffer.h
src/Text3.cpp

index e78a443a88ab3c44e721f15d7b493c85109bc080..7cb5ac205d332b4130d6848a21f3e596d22bb87a 100644 (file)
@@ -5381,6 +5381,15 @@ int Buffer::spellCheck(DocIterator & from, DocIterator & to,
 }
 
 
+void Buffer::requestSpellcheck()
+{
+       ParagraphList::iterator pit = paragraphs().begin();
+       ParagraphList::iterator pend = paragraphs().end();
+       for (; pit != pend; ++pit)
+               pit->requestSpellCheck();
+}
+
+
 void Buffer::Impl::updateStatistics(DocIterator & from, DocIterator & to, bool skipNoOutput)
 {
        bool inword = false;
index e342199b254705e033cc8e4310ea8ca6e71a5cd0..332ef864044c05498395f2a8ec577b2652e9cd39 100644 (file)
@@ -748,6 +748,8 @@ public:
        /// \return progress if a new word was found.
        int spellCheck(DocIterator & from, DocIterator & to,
                WordLangTuple & word_lang, docstring_list & suggestions) const;
+       /// Marks the whole buffer to be checked (again)
+       void requestSpellcheck();
        ///
        void checkChildBuffers();
        ///
index 825745278290871a56e4327fbf2c4df1c392cd61..1623996ec665aa052bc49ec173e349a3bb079438 100644 (file)
@@ -2762,11 +2762,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        bv->buffer().params().spellignore().push_back(wl);
                        cur.recordUndo();
                        // trigger re-check of whole buffer
-                       ParagraphList & pars = bv->buffer().paragraphs();
-                       ParagraphList::iterator pit = pars.begin();
-                       ParagraphList::iterator pend = pars.end();
-                       for (; pit != pend; ++pit)
-                               pit->requestSpellCheck();
+                       bv->buffer().requestSpellcheck();
                }
                break;
        }
@@ -2800,11 +2796,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                        bv->buffer().params().spellignore().erase(it);
                        cur.recordUndo();
                        // trigger re-check of whole buffer
-                       ParagraphList & pars = bv->buffer().paragraphs();
-                       ParagraphList::iterator pit = pars.begin();
-                       ParagraphList::iterator pend = pars.end();
-                       for (; pit != pend; ++pit)
-                               pit->requestSpellCheck();
+                       bv->buffer().requestSpellcheck();
                }
                break;
        }