forked from qt-creator/qt-creator
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:
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user