FakeVim: Replace foreach with ranged for loop

Change-Id: I0de9620ebf837be25e153bfd282b6564d4d2b115
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-10-05 13:59:53 +02:00
parent f0834e8725
commit 392585f76d
2 changed files with 16 additions and 15 deletions

View File

@@ -1002,7 +1002,7 @@ QDebug operator<<(QDebug ts, const ExCommand &cmd)
QDebug operator<<(QDebug ts, const QList<QTextEdit::ExtraSelection> &sels)
{
foreach (const QTextEdit::ExtraSelection &sel, sels)
for (const QTextEdit::ExtraSelection &sel : sels)
ts << "SEL: " << sel.cursor.anchor() << sel.cursor.position();
return ts;
}
@@ -3049,7 +3049,7 @@ void FakeVimHandler::Private::clearPendingInput()
void FakeVimHandler::Private::waitForMapping()
{
g.currentCommand.clear();
foreach (const Input &input, g.currentMap.currentInputs())
for (const Input &input : g.currentMap.currentInputs())
g.currentCommand.append(input.toString());
// wait for user to press any key or trigger complete mapping after interval
@@ -6070,13 +6070,13 @@ bool FakeVimHandler::Private::handleExMapCommand(const ExCommand &cmd0) // :map
//qDebug() << "MAPPING: " << modes << lhs << rhs;
switch (type) {
case Unmap:
foreach (char c, modes)
for (char c : qAsConst(modes))
MappingsIterator(&g.mappings, c, key).remove();
break;
case Map: Q_FALLTHROUGH();
case Noremap: {
Inputs inputs(rhs, type == Noremap, silent);
foreach (char c, modes)
const Inputs inputs(rhs, type == Noremap, silent);
for (char c : qAsConst(modes))
MappingsIterator(&g.mappings, c).setInputs(key, inputs, unique);
break;
}
@@ -6094,7 +6094,7 @@ bool FakeVimHandler::Private::handleExHistoryCommand(const ExCommand &cmd)
QString info;
info += "# command history\n";
int i = 0;
foreach (const QString &item, g.commandBuffer.historyItems()) {
for (const QString &item : g.commandBuffer.historyItems()) {
++i;
info += QString("%1 %2\n").arg(i, -8).arg(item);
}