qmljs: fix bug in reformatting

Reformatting multi-line comments caused, in some cases, the deletion
of the preceding line.

Task-number: QTCREATORBUG-21036
Change-Id: I9bf9627e5992e9821c0dd62a13601a3ca6367e65
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Marco Benelli
2018-09-11 10:33:02 +02:00
parent 28ab852e53
commit c1a761a225

View File

@@ -173,8 +173,11 @@ protected:
QStringList lines = str.split(QLatin1Char('\n'));
bool multiline = lines.length() > 1;
for (int i = 0; i < lines.size(); ++i) {
if (multiline)
if (multiline) {
if (i == 0)
newLine();
_line = lines.at(i); // multiline comments don't keep track of previos lines
}
else
_line += lines.at(i);
if (i != lines.size() - 1)