diff --git a/libs/kotext/KoTextRange.cpp b/libs/kotext/KoTextRange.cpp index ac33906a690c5248d6c65f2ece26356fb3bfb988..40cb7375319ea2f1d22e6ca495085aa7a6096d94 100644 --- a/libs/kotext/KoTextRange.cpp +++ b/libs/kotext/KoTextRange.cpp @@ -43,8 +43,8 @@ public: QTextCursor cursor; KoTextInlineRdf *rdf; //< A textrange might have RDF, we own it. bool positionOnlyMode; - int snapStart; - int snapEnd; + int snapAnchor; + int snapPos; }; KoTextRange::KoTextRange(const QTextCursor &cursor) @@ -159,13 +159,13 @@ KoTextInlineRdf* KoTextRange::inlineRdf() const void KoTextRange::snapshot() { Q_D(KoTextRange); - d->snapStart = d->cursor.selectionStart(); - d->snapEnd = d->cursor.selectionEnd(); + d->snapAnchor = d->cursor.anchor(); + d->snapPos = d->cursor.position(); } void KoTextRange::restore() { Q_D(KoTextRange); - d->cursor.setPosition(d->snapStart); - d->cursor.setPosition(d->snapEnd, QTextCursor::KeepAnchor); + d->cursor.setPosition(d->snapAnchor); + d->cursor.setPosition(d->snapPos, QTextCursor::KeepAnchor); } diff --git a/libs/kotext/commands/DeleteAnchorsCommand.cpp b/libs/kotext/commands/DeleteAnchorsCommand.cpp index 02033b08f81864671fed5bfa98a8943ee3cd0fd7..123c2a62c6b849e44bf127d0f728c5ed674c2bd8 100644 --- a/libs/kotext/commands/DeleteAnchorsCommand.cpp +++ b/libs/kotext/commands/DeleteAnchorsCommand.cpp @@ -81,6 +81,7 @@ void DeleteAnchorsCommand::redo() if (rangeManager) { foreach (KoAnchorTextRange *anchorRange, m_anchorRanges) { rangeManager->remove(anchorRange); + m_document->markContentsDirty(anchorRange->position(), 0); } } } @@ -99,6 +100,7 @@ void DeleteAnchorsCommand::undo() if (rangeManager) { foreach (KoAnchorTextRange *anchorRange, m_anchorRanges) { rangeManager->insert(anchorRange); + m_document->markContentsDirty(anchorRange->position(), 0); } } m_deleteAnchors = false;