FakeVim: Replace QRegExp use in handleExSubstituteCommand()

Task-number: QTCREATORBUG-24098
Change-Id: I4176b614a7de73a675d5252344b68ce61dc340c2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2020-06-11 09:34:00 +02:00
parent 1c81a3b3e8
commit c5a64bd4de

View File

@@ -5512,10 +5512,10 @@ bool FakeVimHandler::Private::handleExSubstituteCommand(const ExCommand &cmd)
int count = 1;
QString line = cmd.args;
const int countIndex = line.lastIndexOf(QRegExp("\\d+$"));
if (countIndex != -1) {
count = line.midRef(countIndex).toInt();
line = line.mid(0, countIndex).trimmed();
const QRegularExpressionMatch match = QRegularExpression("\\d+$").match(line);
if (match.hasMatch()) {
count = match.captured().toInt();
line = line.left(match.capturedStart()).trimmed();
}
if (cmd.cmd.isEmpty()) {