]> git.lyx.org Git - features.git/commitdiff
Fix font issue due to mispelled marking.
authorAbdelrazak Younes <younes@lyx.org>
Fri, 1 May 2009 13:45:30 +0000 (13:45 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Fri, 1 May 2009 13:45:30 +0000 (13:45 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29474 a592a061-630c-0410-9148-cb99ea01b6c8

src/FontList.cpp

index 36b79cec569901b66682dbaae87362faf226ef9c..923986f11af7c3899b0fde29966dcdfc751f7517 100644 (file)
@@ -184,12 +184,15 @@ void FontList::set(pos_type pos, Font const & font)
 void FontList::setMisspelled(pos_type startpos, pos_type endpos,
        bool misspelled)
 {
-       // FIXME: Optimize!!!
-       for (pos_type pos = startpos; pos != endpos; ++pos) {
-               Font f = get(pos);
-               f.setMisspelled(misspelled);
-               set(pos, f);
-       }
+       List::iterator start = fontIterator(startpos);
+       if (misspelled && start->font().isMisspelled())
+               return;
+       if (!misspelled && !start->font().isMisspelled())
+               return;
+
+       Font f = start->font();
+       f.setMisspelled(misspelled);
+       setRange(startpos, endpos, f);
 }