fakevim: implement :<x>%

Change-Id: I85d91429767519d7e2925e89feee6f3f83ddd3a9
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
hjk
2011-10-28 14:16:01 +02:00
committed by hjk
parent 25c983a448
commit 2ec51f5b2c

View File

@@ -3720,6 +3720,15 @@ bool FakeVimHandler::Private::handleExEchoCommand(const ExCommand &cmd)
void FakeVimHandler::Private::handleExCommand(const QString &line0)
{
QString line = line0; // Make sure we have a copy to prevent aliasing.
if (line.endsWith(QLatin1Char('%'))) {
line.chop(1);
int percent = line.toInt();
setPosition(firstPositionInLine(percent * linesInDocument() / 100));
showBlackMessage(QString());
return;
}
// FIXME: that seems to be different for %w and %s
if (line.startsWith(QLatin1Char('%')))
line = "1,$" + line.mid(1);