Skip to content
Snippets Groups Projects
Commit fe8f2c2b authored by con's avatar con
Browse files

Insert tabs for \t when doing regexp replace.

Task-number: QTCREATORBUG-1544
parent 2d509250
No related branches found
No related tags found
No related merge requests found
...@@ -295,6 +295,7 @@ QFuture<FileSearchResultList> Utils::findInFilesRegExp(const QString &searchTerm ...@@ -295,6 +295,7 @@ QFuture<FileSearchResultList> Utils::findInFilesRegExp(const QString &searchTerm
QString Utils::expandRegExpReplacement(const QString &replaceText, const QStringList &capturedTexts) QString Utils::expandRegExpReplacement(const QString &replaceText, const QStringList &capturedTexts)
{ {
// handles \1 \\ \& & \t
QString result; QString result;
int numCaptures = capturedTexts.size() - 1; int numCaptures = capturedTexts.size() - 1;
for (int i = 0; i < replaceText.length(); ++i) { for (int i = 0; i < replaceText.length(); ++i) {
...@@ -305,6 +306,8 @@ QString Utils::expandRegExpReplacement(const QString &replaceText, const QString ...@@ -305,6 +306,8 @@ QString Utils::expandRegExpReplacement(const QString &replaceText, const QString
result += QLatin1Char('\\'); result += QLatin1Char('\\');
} else if (c == QLatin1Char('&')) { } else if (c == QLatin1Char('&')) {
result += QLatin1Char('&'); result += QLatin1Char('&');
} else if (c == QLatin1Char('t')) {
result += QLatin1Char('\t');
} else if (c.isDigit()) { } else if (c.isDigit()) {
int index = c.unicode()-'1'; int index = c.unicode()-'1';
if (index < numCaptures) { if (index < numCaptures) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment