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
Reviewed By: boemann
Differential Revision: https://phabricator.kde.org/D7449
302adb7 Spellcheck: Improve markup of missspelled words when dropcaps is used
libs/text/KoTextBlockData.cpp | 24 +++++++++++---------
libs/text/KoTextBlockData.h | 2 ++
plugins/textediting/spellcheck/SpellCheck.cpp | 32 +++++++++++++++++++--------
3 files changed, 38 insertions(+), 20 deletions(-)