diff options
author | Lorenz Haas <lorenz.haas@histomatics.de> | 2017-02-23 19:36:35 +0100 |
---|---|---|
committer | Lorenz Haas <lorenz.haas@histomatics.de> | 2017-02-23 21:42:45 +0000 |
commit | f04c535ad2a1a2332c81ce69f24195d5271e1ebe (patch) | |
tree | 90a54e8e074b1265ee974e7dd824ffa908160a88 /src/plugins/beautifier/beautifierplugin.cpp | |
parent | 037a96aefdb99c9e4cc714038078df4a37af67d4 (diff) |
Beautifier: Get rid of QRegExp
Change-Id: If3f7e6d93ef1f0b6920f0958f1e2eb00c37462bf
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins/beautifier/beautifierplugin.cpp')
-rw-r--r-- | src/plugins/beautifier/beautifierplugin.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/beautifier/beautifierplugin.cpp b/src/plugins/beautifier/beautifierplugin.cpp index 7cd1a9162e..213b429049 100644 --- a/src/plugins/beautifier/beautifierplugin.cpp +++ b/src/plugins/beautifier/beautifierplugin.cpp @@ -152,8 +152,11 @@ FormatTask format(FormatTask task) const bool returnsCRLF = task.command.returnsCRLF(); if (addsNewline || returnsCRLF) { task.formattedData = QString::fromUtf8(process.readAllStandardOutput()); - if (addsNewline) - task.formattedData.remove(QRegExp("(\\r\\n|\\n)$")); + if (addsNewline && task.formattedData.endsWith('\n')) { + task.formattedData.chop(1); + if (task.formattedData.endsWith('\r')) + task.formattedData.chop(1); + } if (returnsCRLF) task.formattedData.replace("\r\n", "\n"); return task; |