From cb296f49b06ec2d6f584c509126cb9f59264909e Mon Sep 17 00:00:00 2001 From: Thomas Hartmann <Thomas.Hartmann@nokia.com> Date: Fri, 9 Jul 2010 18:08:00 +0200 Subject: [PATCH] qmljsrewriter: fix rewriting issue We have to keep the line ending in case the removed property is not the only thning in that line --- src/libs/qmljs/qmljsrewriter.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/libs/qmljs/qmljsrewriter.cpp b/src/libs/qmljs/qmljsrewriter.cpp index 22e14212710..093f671c66f 100644 --- a/src/libs/qmljs/qmljsrewriter.cpp +++ b/src/libs/qmljs/qmljsrewriter.cpp @@ -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; } -- GitLab