@@ -432,8 +432,8 @@ static QString vimPatternToQtPattern_QString(const QString &needle, bool &initIg
432
432
if (range) {
433
433
QChar c2 = pattern[pattern.size () - 2 ];
434
434
pattern.remove (pattern.size () - 2 , 2 );
435
- pattern.append (c2.toUpper () + ' -' + c.toUpper ());
436
- pattern.append (c2.toLower () + ' -' + c.toLower ());
435
+ pattern.append (QString ( c2.toUpper ()) + QString ( ' -' ) + QString ( c.toUpper () ));
436
+ pattern.append (QString ( c2.toLower ()) + QString ( ' -' ) + QString ( c.toLower () ));
437
437
range = false ;
438
438
} else if (escape) {
439
439
escape = false ;
@@ -3732,7 +3732,8 @@ bool FakeVimHandler::Private::handleCommandSubSubMode(const Input &input) {
3732
3732
pushUndoState (false );
3733
3733
beginEditBlock ();
3734
3734
3735
- const QString dotCommand = " ys" + g.dotCommand + " f" + g.surroundFunction + " <CR>" ;
3735
+ const QString dotCommand =
3736
+ QString (" ys" ) + g.dotCommand + QString (" f" ) + g.surroundFunction + QString (" <CR>" );
3736
3737
3737
3738
surroundCurrentRange (Input (' )' ), g.surroundFunction );
3738
3739
@@ -4201,7 +4202,7 @@ bool FakeVimHandler::Private::handleNoSubMode(const Input &input) {
4201
4202
}
4202
4203
} else if ((!isVisualMode () && input.is (' a' )) || (isVisualMode () && input.is (' A' ))) {
4203
4204
if (isVisualMode ()) {
4204
- if (!isVisualBlockMode ()) dotCommand = QString::number (count ()) + " a" ;
4205
+ if (!isVisualBlockMode ()) dotCommand = QString::number (count ()) + QString ( " a" ) ;
4205
4206
enterVisualInsertMode (' A' );
4206
4207
} else {
4207
4208
moveRight (qMin<int >(rightDist (), 1 ));
@@ -4244,7 +4245,7 @@ bool FakeVimHandler::Private::handleNoSubMode(const Input &input) {
4244
4245
} else if (g.gflag && input.is (' r' ) && s.emulateReplaceWithRegister .value ()) {
4245
4246
g.submode = ReplaceWithRegisterSubMode;
4246
4247
if (isVisualMode ()) {
4247
- dotCommand = visualDotCommand () + QString::number (count ()) + " gr" ;
4248
+ dotCommand = visualDotCommand () + QString::number (count ()) + QString ( " gr" ) ;
4248
4249
pasteText (true );
4249
4250
} else {
4250
4251
setAnchor ();
@@ -4300,7 +4301,7 @@ bool FakeVimHandler::Private::handleNoSubMode(const Input &input) {
4300
4301
if (atEndOfLine ()) moveLeft ();
4301
4302
} else if (input.is (' I' )) {
4302
4303
if (isVisualMode ()) {
4303
- if (!isVisualBlockMode ()) dotCommand = QString::number (count ()) + " i" ;
4304
+ if (!isVisualBlockMode ()) dotCommand = QString::number (count ()) + QString ( " i" ) ;
4304
4305
enterVisualInsertMode (' I' );
4305
4306
} else {
4306
4307
if (g.gflag )
@@ -4478,7 +4479,7 @@ bool FakeVimHandler::Private::handleNoSubMode(const Input &input) {
4478
4479
setAnchor ();
4479
4480
} else {
4480
4481
const QString movementCommand = QStringLiteral (" %1l%1l" ).arg (count ());
4481
- handleAs (" g" + input.toString () + movementCommand);
4482
+ handleAs (QString ( " g" ) + input.toString () + movementCommand);
4482
4483
}
4483
4484
} else if (input.is (' @' )) {
4484
4485
g.submode = MacroExecuteSubMode;
@@ -4534,7 +4535,7 @@ bool FakeVimHandler::Private::handleReplaceSubMode(const Input &input) {
4534
4535
bool handled = true ;
4535
4536
4536
4537
const QChar c = input.asChar ();
4537
- setDotCommand (visualDotCommand () + ' r' + c);
4538
+ setDotCommand (visualDotCommand () + QString ( ' r' ) + c);
4538
4539
if (isVisualMode ()) {
4539
4540
pushUndoState ();
4540
4541
leaveVisualMode ();
@@ -4559,7 +4560,7 @@ bool FakeVimHandler::Private::handleReplaceSubMode(const Input &input) {
4559
4560
moveRight (count () - 1 );
4560
4561
}
4561
4562
setTargetColumn ();
4562
- setDotCommand (" %1r" + input.text (), count ());
4563
+ setDotCommand (QString ( " %1r" ) + input.text (), count ());
4563
4564
} else {
4564
4565
handled = false ;
4565
4566
}
@@ -4594,9 +4595,10 @@ bool FakeVimHandler::Private::handleReplaceWithRegisterSubMode(const Input &inpu
4594
4595
pushUndoState (false );
4595
4596
beginEditBlock ();
4596
4597
4597
- const QString movement = (count () == 1 ) ? QString () : (QString::number (count () - 1 ) + " j" );
4598
+ const QString movement =
4599
+ (count () == 1 ) ? QString () : (QString::number (count () - 1 ) + QString (" j" ));
4598
4600
4599
- g.dotCommand = " V" + movement + " gr" ;
4601
+ g.dotCommand = QString ( " V" ). append ( movement). append ( " gr" ) ;
4600
4602
replay (g.dotCommand );
4601
4603
4602
4604
endEditBlock ();
@@ -4841,7 +4843,7 @@ void FakeVimHandler::Private::handleReplaceMode(const Input &input) {
4841
4843
commitInsertState ();
4842
4844
moveLeft (qMin<int >(1 , leftDist ()));
4843
4845
enterCommandMode ();
4844
- g.dotCommand .append (m_buffer->lastInsertion + " <ESC>" );
4846
+ g.dotCommand .append (m_buffer->lastInsertion + QString ( " <ESC>" ) );
4845
4847
} else if (input.isKey (Key_Left)) {
4846
4848
moveLeft ();
4847
4849
} else if (input.isKey (Key_Right)) {
@@ -4944,7 +4946,7 @@ void FakeVimHandler::Private::finishInsertMode() {
4944
4946
4945
4947
if (newLineBefore || newLineAfter)
4946
4948
m_buffer->lastInsertion .remove (0 , m_buffer->lastInsertion .indexOf (' \n ' ) + 1 );
4947
- g.dotCommand .append (m_buffer->lastInsertion + " <ESC>" );
4949
+ g.dotCommand .append (m_buffer->lastInsertion + QString ( " <ESC>" ) );
4948
4950
4949
4951
setTargetColumn ();
4950
4952
enterCommandMode ();
@@ -5295,7 +5297,7 @@ EventResult FakeVimHandler::Private::handleSearchSubSubMode(const Input &input)
5295
5297
5296
5298
if (finishSearch ()) {
5297
5299
if (g.submode != NoSubMode)
5298
- finishMovement (g.searchBuffer .prompt () + g.lastSearch + ' \n ' );
5300
+ finishMovement (g.searchBuffer .prompt () + g.lastSearch + QString ( ' \n ' ) );
5299
5301
if (g.currentMessage .isEmpty ()) showMessage (MessageCommand, g.searchBuffer .display ());
5300
5302
} else {
5301
5303
handled = EventCancelled; // Not found so cancel mapping if any.
@@ -5817,7 +5819,7 @@ bool FakeVimHandler::Private::handleExSetCommand(const ExCommand &cmd) {
5817
5819
5818
5820
FvBaseAspect *act = s.item (optionName);
5819
5821
if (!act) {
5820
- showMessage (MessageError, Tr::tr (" Unknown option:" ) + ' ' + cmd.args );
5822
+ showMessage (MessageError, Tr::tr (" Unknown option:" ) + QString ( ' ' ) + cmd.args );
5821
5823
} else if (act->defaultValue ().type () == QVariant::Bool) {
5822
5824
bool oldValue = act->value ().toBool ();
5823
5825
if (printOption) {
@@ -5827,11 +5829,12 @@ bool FakeVimHandler::Private::handleExSetCommand(const ExCommand &cmd) {
5827
5829
act->setValue (!oldValue);
5828
5830
}
5829
5831
} else if (negateOption && !printOption) {
5830
- showMessage (MessageError, Tr::tr (" Invalid argument:" ) + ' ' + cmd.args );
5832
+ showMessage (MessageError, Tr::tr (" Invalid argument:" ) + QString ( ' ' ) + cmd.args );
5831
5833
} else if (toggleOption) {
5832
- showMessage (MessageError, Tr::tr (" Trailing characters:" ) + ' ' + cmd.args );
5834
+ showMessage (MessageError, Tr::tr (" Trailing characters:" ) + QString ( ' ' ) + cmd.args );
5833
5835
} else {
5834
- showMessage (MessageInfo, act->settingsKey ().toLower () + " =" + act->value ().toString ());
5836
+ showMessage (MessageInfo,
5837
+ act->settingsKey ().toLower () + QString (" =" ) + act->value ().toString ());
5835
5838
}
5836
5839
}
5837
5840
updateEditor ();
@@ -6059,7 +6062,7 @@ bool FakeVimHandler::Private::handleExBangCommand(const ExCommand &cmd) // :!
6059
6062
if (!cmd.cmd .isEmpty () || !cmd.hasBang ) return false ;
6060
6063
6061
6064
bool replaceText = cmd.range .isValid ();
6062
- const QString command = QString (cmd.cmd .mid (1 ) + ' ' + cmd.args ).trimmed ();
6065
+ const QString command = QString (cmd.cmd .mid (1 ) + QString ( ' ' ) + cmd.args ).trimmed ();
6063
6066
const QString input = replaceText ? selectText (cmd.range ) : QString ();
6064
6067
6065
6068
const QString result = getProcessOutput (command, input);
@@ -7114,22 +7117,22 @@ void FakeVimHandler::Private::toggleComment(const Range &range) {
7114
7117
transformText (range, [&commentString](const QString &text) -> QString {
7115
7118
QStringList lines = text.split (' \n ' );
7116
7119
7117
- const QRegularExpression checkForComment (" ^\\ s*" +
7120
+ const QRegularExpression checkForComment (QString ( " ^\\ s*" ) +
7118
7121
QRegularExpression::escape (commentString));
7119
7122
7120
7123
const bool firstLineIsComment = !lines.empty () && lines.front ().contains (checkForComment);
7121
7124
7122
7125
for (auto &line : lines) {
7123
7126
if (!line.isEmpty ()) {
7124
7127
if (firstLineIsComment) {
7125
- const bool hasSpaceAfterCommentString =
7126
- line. contains ( QRegularExpression (checkForComment.pattern () + " \\ s" ));
7128
+ const bool hasSpaceAfterCommentString = line. contains (
7129
+ QRegularExpression (checkForComment.pattern () + QString ( " \\ s" ) ));
7127
7130
const int sizeToReplace = hasSpaceAfterCommentString ? commentString.size () + 1
7128
7131
: commentString.size ();
7129
7132
line.replace (line.indexOf (commentString), sizeToReplace, " " );
7130
7133
} else {
7131
7134
const int indexOfFirstNonSpace = line.indexOf (QRegularExpression (" [^\\ s]" ));
7132
- line = line.left (indexOfFirstNonSpace) + commentString + " " +
7135
+ line = line.left (indexOfFirstNonSpace) + commentString + QString ( " " ) +
7133
7136
line.right (line.size () - indexOfFirstNonSpace);
7134
7137
}
7135
7138
}
@@ -7169,7 +7172,7 @@ void FakeVimHandler::Private::replaceWithRegister(const Range &range) {
7169
7172
7170
7173
void FakeVimHandler::Private::surroundCurrentRange (const Input &input, const QString &prefix) {
7171
7174
QString dotCommand;
7172
- if (isVisualMode ()) dotCommand = visualDotCommand () + " S" + input.asChar ();
7175
+ if (isVisualMode ()) dotCommand = visualDotCommand () + QString ( " S" ) + input.asChar ();
7173
7176
7174
7177
const bool wasVisualCharMode = isVisualCharMode ();
7175
7178
const bool wasVisualLineMode = isVisualLineMode ();
@@ -7207,11 +7210,11 @@ void FakeVimHandler::Private::surroundCurrentRange(const Input &input, const QSt
7207
7210
if (wasVisualLineMode)
7208
7211
newBack += " \n " ;
7209
7212
else
7210
- newBack = " \n " + newBack;
7213
+ newBack = QString ( " \n " ) + newBack;
7211
7214
} else if (input.is (' (' ) || input.is (' {' ) || input.is (' [' ) || input.is (' [' )) {
7212
7215
// Opening characters add an extra space
7213
- newFront = newFront + " " ;
7214
- newBack = " " + newBack;
7216
+ newFront = newFront + QString ( " " ) ;
7217
+ newBack = QString ( " " ) + newBack;
7215
7218
}
7216
7219
7217
7220
if (!newFront.isEmpty ()) {
@@ -8558,8 +8561,8 @@ void FakeVimHandler::Private::getRegisterType(int *reg, bool *isClipboard, bool
8558
8561
8559
8562
if (c == ' "' ) {
8560
8563
QStringList list = s.clipboard .value ().split (' ,' );
8561
- clipboard = list.contains (" unnamedplus" );
8562
- selection = list.contains (" unnamed" );
8564
+ clipboard = list.contains (QString ( " unnamedplus" ) );
8565
+ selection = list.contains (QString ( " unnamed" ) );
8563
8566
} else if (c == ' +' ) {
8564
8567
clipboard = true ;
8565
8568
} else if (c == ' *' ) {
0 commit comments