Spellcheck: Improve markup of missspelled words when dropcaps is used

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

Description

Spellcheck: Improve markup of missspelled words when dropcaps is used

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

Reviewers: boemann

Reviewed By: boemann

Tags: #calligra:_3.0

Differential Revision: https://phabricator.kde.org/D7449