Commit 86c4e341 authored by Lukas Holecek's avatar Lukas Holecek Committed by hjk
Browse files

FakeVim: Fix indentation commands

Partially reverts commit dfae7365

. Handling indentation commands in
visual mode cannot be trivially handled by alias.

Change-Id: If9189c41a4e585efef00c774e24382f1de3356e4
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 72c5253a
......@@ -4168,10 +4168,19 @@ bool FakeVimHandler::Private::handleNoSubMode(const Input &input)
} else if (input.is('<') || input.is('>') || input.is('=')) {
g.submode = indentModeFromInput(input);
if (isVisualMode()) {
leaveVisualMode();
const int lines = qAbs(lineForPosition(position()) - lineForPosition(anchor())) + 1;
const QString movementCommand =
(lines > 1) ? QString::fromLatin1("%1j").arg(lines - 1) : QString();
handleAs(_("%1") + input.toString() + movementCommand);
const int repeat = count();
if (g.submode == ShiftLeftSubMode)
shiftRegionLeft(repeat);
else if (g.submode == ShiftRightSubMode)
shiftRegionRight(repeat);
else
indentSelectedText();
g.submode = NoSubMode;
const QString selectDotCommand =
(lines > 1) ? QString::fromLatin1("V%1j").arg(lines - 1): QString();
setDotCommand(selectDotCommand + QString::fromLatin1("%1%2%2").arg(repeat).arg(input.raw()));
} else {
setAnchor();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment