Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Make text bulkactions also take into account undo-mementos.

Wolthera van Hövell tot Westerflier0c53e8510249
diff --git a/libs/flake/text/KoSvgTextShape.cpp b/libs/flake/text/KoSvgTextShape.cpp
index c579350b44..302589cbcf 100644
--- a/libs/flake/text/KoSvgTextShape.cpp
+++ b/libs/flake/text/KoSvgTextShape.cpp
@@ -1913,6 +1913,9 @@ void KoSvgTextShape::setMementoImpl(const KoSvgTextShapeMementoSP memento)
void KoSvgTextShape::setMemento(const KoSvgTextShapeMementoSP memento)
{
setMementoImpl(memento);
+ if (d->bulkActionState) {
+ d->bulkActionState->layoutSetFromMemento = true;
+ }
notifyCursorPosChanged(0, 0);
notifyMarkupChanged();
}
@@ -1925,7 +1928,15 @@ void KoSvgTextShape::setMemento(const KoSvgTextShapeMementoSP memento, int pos,
const bool shapeOffsetAfter = (textProperties().hasProperty(KoSvgTextProperties::ShapeMarginId)
|| textProperties().hasProperty(KoSvgTextProperties::ShapePaddingId));
if (shapeOffsetBefore || shapeOffsetAfter) {
- d->updateTextWrappingAreas();
+ if (d->bulkActionState) {
+ d->bulkActionState->contourHasChanged = true;
+ } else {
+ d->updateTextWrappingAreas();
+ }
+ } else {
+ if (d->bulkActionState) {
+ d->bulkActionState->layoutSetFromMemento = true;
+ }
}
notifyCursorPosChanged(pos, anchor);
notifyMarkupChanged();
@@ -2001,6 +2012,7 @@ QRectF KoSvgTextShape::endBulkAction()
// updateTextWrappingAreas() already includes a call to relayout()
relayout();
}
+ // otherwise, it's an update from a memento.
updateRect = d->bulkActionState->originalBoundingRect | boundingRect();
}
diff --git a/libs/flake/text/KoSvgTextShape_p.h b/libs/flake/text/KoSvgTextShape_p.h
index 1b73d752f0..4974059d94 100644
--- a/libs/flake/text/KoSvgTextShape_p.h
+++ b/libs/flake/text/KoSvgTextShape_p.h
@@ -546,9 +546,10 @@ public:
QRectF originalBoundingRect;
bool contourHasChanged = false;
bool layoutHasChanged = false;
+ bool layoutSetFromMemento = false;
bool changed() const {
- return contourHasChanged || layoutHasChanged;
+ return contourHasChanged || layoutHasChanged || layoutSetFromMemento;
}
};