]> git.lyx.org Git - lyx.git/commitdiff
Workaround for #6865: smarter FontList::setMisspelled implementation
authorStephan Witt <switt@lyx.org>
Thu, 26 Aug 2010 07:09:25 +0000 (07:09 +0000)
committerStephan Witt <switt@lyx.org>
Thu, 26 Aug 2010 07:09:25 +0000 (07:09 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35203 a592a061-630c-0410-9148-cb99ea01b6c8

src/FontList.cpp

index f8f16c94448bce8ded702dc0ae251dea5995e692..d4cb66e46ea1be2ff82d8289e90533ef84ce821a 100644 (file)
@@ -184,10 +184,14 @@ void FontList::set(pos_type pos, Font const & font)
 void FontList::setMisspelled(pos_type startpos, pos_type endpos,
        bool misspelled)
 {
-       // FIXME: optimize!
-       Font f = fontIterator(startpos)->font();
-       f.setMisspelled(misspelled);
-       setRange(startpos, endpos, f);
+       // FIXME: move misspelled state out of font!?
+       for (pos_type p = startpos; p <= endpos; ++p) {
+               Font f = fontIterator(p)->font();
+               if (f.isMisspelled() != misspelled) {
+                       f.setMisspelled(misspelled);
+                       set(p, f);
+               }
+       }
 }