FakeVim: Tilde command moves text cursor to the right

Change-Id: Ieff36ffa06b39dd7ff55551dd0fec627b8561939
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
hluk
2013-03-13 18:53:11 +01:00
committed by hjk
parent 15f58b16fd
commit 0a86efb8a0
2 changed files with 24 additions and 12 deletions

View File

@@ -1607,6 +1607,14 @@ void FakeVimPlugin::test_vim_letter_case()
// upper- and lower-case // upper- and lower-case
data.setText("abc DEF"); data.setText("abc DEF");
KEYS("~", "A" X "bc DEF"); KEYS("~", "A" X "bc DEF");
INTEGRITY(false);
KEYS("4~", "ABC d" X "EF");
INTEGRITY(false);
data.setText("abc DEF" N "ghi");
KEYS("l9~", "aBC de" X "f" N "ghi");
KEYS(".", "aBC de" X "F" N "ghi");
KEYS("h.", "aBC dE" X "f" N "ghi");
data.setText("abc DEF"); data.setText("abc DEF");
KEYS("lv3l~", "a" X "BC dEF"); KEYS("lv3l~", "a" X "BC dEF");

View File

@@ -3838,19 +3838,22 @@ bool FakeVimHandler::Private::handleNoSubMode(const Input &input)
else if (input.is('U')) else if (input.is('U'))
m_submode = UpCaseSubMode; m_submode = UpCaseSubMode;
} else { } else {
if (!atEndOfLine()) { beginEditBlock();
beginEditBlock(); if (atEndOfLine())
setAnchor(); moveLeft();
moveRight(qMin(count(), rightDist())); setAnchor();
if (input.is('~')) moveRight(qMin(count(), rightDist()));
invertCase(currentRange()); if (input.is('~')) {
else if (input.is('u')) const int pos = position();
downCase(currentRange()); invertCase(currentRange());
else if (input.is('U')) setPosition(pos);
upCase(currentRange()); } else if (input.is('u')) {
setDotCommand(QString::fromLatin1("%1%2").arg(count()).arg(input.raw())); downCase(currentRange());
endEditBlock(); } else if (input.is('U')) {
upCase(currentRange());
} }
setDotCommand(QString::fromLatin1("%1%2").arg(count()).arg(input.raw()));
endEditBlock();
} }
} else if (input.isKey(Key_Delete)) { } else if (input.isKey(Key_Delete)) {
setAnchor(); setAnchor();
@@ -7533,6 +7536,7 @@ void FakeVimHandler::setTextCursorPosition(int position)
d->setPosition(pos); d->setPosition(pos);
else else
d->setAnchorAndPosition(pos, pos); d->setAnchorAndPosition(pos, pos);
d->m_fakeEnd = false;
d->setTargetColumn(); d->setTargetColumn();
} }