Commit 3b48da93 authored by Kai Koehne's avatar Kai Koehne
Browse files

QmlJs: Fix corner case in Rewriter (whitespace handling)

Done by erikv
parent 17431b40
......@@ -413,6 +413,7 @@ bool Rewriter::includeSurroundingWhitespace(const QString &source, int &start, i
{
bool includeStartingWhitespace = true;
bool paragraphFound = false;
bool paragraphSkipped = false;
if (end >= 0) {
QChar c = source.at(end);
......@@ -421,6 +422,7 @@ bool Rewriter::includeSurroundingWhitespace(const QString &source, int &start, i
++end;
if (c.unicode() == 10) {
paragraphFound = true;
paragraphSkipped = true;
break;
} else if (end == source.length()) {
break;
......@@ -447,7 +449,7 @@ bool Rewriter::includeSurroundingWhitespace(const QString &source, int &start, i
--start;
}
}
if (!paragraphFound) //keep the line ending
if (!paragraphFound && paragraphSkipped) //keep the line ending
--end;
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