X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FFontList.cpp;h=923986f11af7c3899b0fde29966dcdfc751f7517;hb=2098f1d8c20d51e63e670bcdc9da8996068975bf;hp=36b79cec569901b66682dbaae87362faf226ef9c;hpb=1d2077e51e1bd7b7194a377be36ed171f9b974bc;p=lyx.git diff --git a/src/FontList.cpp b/src/FontList.cpp index 36b79cec56..923986f11a 100644 --- a/src/FontList.cpp +++ b/src/FontList.cpp @@ -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); }