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++

Ensure empty text properties are return when the selection only contains paragraph props.

Wolthera van Hövell tot Westerflierd52c58e5c876
diff --git a/libs/flake/text/KoSvgTextShape.cpp b/libs/flake/text/KoSvgTextShape.cpp
index 225d0ec384..5e13059bf2 100644
--- a/libs/flake/text/KoSvgTextShape.cpp
+++ b/libs/flake/text/KoSvgTextShape.cpp
@@ -878,7 +878,12 @@ QList<KoSvgTextProperties> KoSvgTextShape::propertiesForRange(const int startPos
while(sought < endIndex) {
int currentIndex = 0;
auto it = d->findTextContentElementForIndex(d->textData, currentIndex, sought);
- if (it != d->textData.depthFirstTailEnd()) {
+ if (KisForestDetail::siblingCurrent(it) == d->textData.childBegin()) {
+ // If there's a selection and the search algorithm only returns the root, return empty.
+ // The root text properties should be retrieved explicitely (either by using -1 as pos, or by calling textProperties()).
+ props = {KoSvgTextProperties()};
+ return props;
+ } else if (it != d->textData.depthFirstTailEnd()) {
if (inherited) {
props.append(inheritProperties(it));
} else {