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);
+ }
+ }
}