{
MessageComponent{MessageComponentType::Text, QStringLiteral("https://kde.org"), {}}};
+ QTest::newRow("long start tag")
+ << QStringLiteral(
+ "Ah, you mean something like
# main.qml\nimport CustomQml\n...\nControls.TextField { id: "
+ "someField }\nCustomQml {\n someTextProperty: someField.text\n}\n
Sure you can, it's still local to the same file where you "
+ "defined the id")
+ << QList{
+ MessageComponent{MessageComponentType::Text, QStringLiteral("Ah, you mean something like"), {}},
+ MessageComponent{
+ MessageComponentType::Code,
+ QStringLiteral(
+ "# main.qml\nimport CustomQml\n...\nControls.TextField { id: someField }\nCustomQml {\n someTextProperty: someField.text\n}"),
+ QVariantMap{{QStringLiteral("class"), QStringLiteral("qml")}}},
+ MessageComponent{MessageComponentType::Text, QStringLiteral("Sure you can, it's still local to the same file where you defined the id"), {}}};
}
void TextHandlerTest::componentOutput()
diff --git a/src/texthandler.cpp b/src/texthandler.cpp
index 12e2535dc..0b6dd8e76 100644
--- a/src/texthandler.cpp
+++ b/src/texthandler.cpp
@@ -307,13 +307,14 @@ int TextHandler::nextBlockPos(const QString &string)
return string.size();
}
- int closeTagPos = string.indexOf(QStringLiteral("%1>").arg(tagType));
+ const auto closeTag = QStringLiteral("%1>").arg(tagType);
+ int closeTagPos = string.indexOf(closeTag);
// If the close tag can't be found assume malformed html and process as single block.
if (closeTagPos == -1) {
return string.size();
}
- return closeTagPos + tag.size() + 1;
+ return closeTagPos + closeTag.size();
}
MessageComponent TextHandler::nextBlock(const QString &string,