Spellcheck: Improve markup of missspelled words when dropcaps is used
ClosedPublic

Authored by danders on Aug 21 2017, 8:45 AM.

Details

Summary

Since spellchecking is done in separate thread and words are identified
by their position in the document, rapid typing can get the document and
spellchecker out of sync. This pacth makes the markup keep track of rebasing
so that when the spellchecker adds markups the are postioned correctly.

Also, iIf a simple edit, we use the cursor position to determine where
the change occured. This makes it possible to handle cases
where formatting of a block has changed, eg. when dropcaps is used.
QTextDocument then reports the change as if the whole block has changed.
Ex: Having a 10 char line and you add a char at pos 7:
from = block->postion()
charsRemoved = 10
charsAdded = 11
m_cursorPosition = 7

Test Plan

Edit a words doc with dropcaps enabled and many misspelled words.
Rapidly type a lot of misspelled words early in the text.

Result:

  1. The markups should not be misplaced.
  2. The assert in KOTextBlockData::appendMarkup() should never trigger

Diff Detail

Repository
R8 Calligra
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
danders created this revision.Aug 21 2017, 8:45 AM
Restricted Application added a project: Calligra: 3.0. · View Herald TranscriptAug 21 2017, 8:45 AM
boemann accepted this revision.Aug 21 2017, 5:01 PM

I like what you have done

This revision is now accepted and ready to land.Aug 21 2017, 5:01 PM
This revision was automatically updated to reflect the committed changes.