Commit cb296f49 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

qmljsrewriter: fix rewriting issue

We have to keep the line ending in case the removed
property is not the only thning in that line
parent 0761e890
...@@ -419,8 +419,6 @@ bool Rewriter::includeSurroundingWhitespace(int &start, int &end) const ...@@ -419,8 +419,6 @@ bool Rewriter::includeSurroundingWhitespace(int &start, int &end) const
while (c.isSpace()) { while (c.isSpace()) {
++end; ++end;
if (c.unicode() == 10) { if (c.unicode() == 10) {
paragraphFound = true; paragraphFound = true;
break; break;
...@@ -434,18 +432,23 @@ bool Rewriter::includeSurroundingWhitespace(int &start, int &end) const ...@@ -434,18 +432,23 @@ bool Rewriter::includeSurroundingWhitespace(int &start, int &end) const
includeStartingWhitespace = paragraphFound; includeStartingWhitespace = paragraphFound;
} }
paragraphFound = false;
if (includeStartingWhitespace) { if (includeStartingWhitespace) {
while (start > 0) { while (start > 0) {
const QChar c = m_originalText.at(start - 1); const QChar c = m_originalText.at(start - 1);
if (!c.isSpace()) if (c.unicode() == 10) {
paragraphFound = true;
break; break;
else if (c.unicode() == 10) }
if (!c.isSpace())
break; break;
--start; --start;
} }
} }
if (!paragraphFound) //keep the line ending
--end;
return paragraphFound; return paragraphFound;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment