forked from qt-creator/qt-creator
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:
@@ -173,8 +173,11 @@ protected:
|
|||||||
QStringList lines = str.split(QLatin1Char('\n'));
|
QStringList lines = str.split(QLatin1Char('\n'));
|
||||||
bool multiline = lines.length() > 1;
|
bool multiline = lines.length() > 1;
|
||||||
for (int i = 0; i < lines.size(); ++i) {
|
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
|
_line = lines.at(i); // multiline comments don't keep track of previos lines
|
||||||
|
}
|
||||||
else
|
else
|
||||||
_line += lines.at(i);
|
_line += lines.at(i);
|
||||||
if (i != lines.size() - 1)
|
if (i != lines.size() - 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user