qmljsrewriter: fix rewriting issue

We have to keep the line ending in case the removed
property is not the only thning in that line
This commit is contained in:
Thomas Hartmann
2010-07-09 18:08:00 +02:00
parent 0761e89016
commit cb296f49b0

View File

@@ -419,8 +419,6 @@ bool Rewriter::includeSurroundingWhitespace(int &start, int &end) const
while (c.isSpace()) {
++end;
if (c.unicode() == 10) {
paragraphFound = true;
break;
@@ -434,18 +432,23 @@ bool Rewriter::includeSurroundingWhitespace(int &start, int &end) const
includeStartingWhitespace = paragraphFound;
}
paragraphFound = false;
if (includeStartingWhitespace) {
while (start > 0) {
const QChar c = m_originalText.at(start - 1);
if (!c.isSpace())
if (c.unicode() == 10) {
paragraphFound = true;
break;
else if (c.unicode() == 10)
}
if (!c.isSpace())
break;
--start;
}
}
if (!paragraphFound) //keep the line ending
--end;
return paragraphFound;
}