fakevim: fix 'yj', 'dj', 'cj' and 'yk', 'dk', 'ck'

Merge-request: 96
Reviewed-by: hjk <qtc-committer@nokia.com>
This commit is contained in:
Martin Aumüller
2010-01-05 18:42:25 +01:00
committed by hjk
parent 489a21a143
commit 159e3f613d

View File

@@ -795,6 +795,8 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
//qDebug() << "CHANGING TO INSERT MODE" << text; //qDebug() << "CHANGING TO INSERT MODE" << text;
//m_registers[m_register] = text; //m_registers[m_register] = text;
yankSelectedText(); yankSelectedText();
if (m_movetype == MoveLineWise)
m_registers[m_register].rangemode = RangeLineMode;
removeSelectedText(); removeSelectedText();
enterInsertMode(); enterInsertMode();
m_beginEditBlock = false; m_beginEditBlock = false;
@@ -805,12 +807,15 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
if (m_rangemode == RangeCharMode) { if (m_rangemode == RangeCharMode) {
if (m_movetype == MoveInclusive) if (m_movetype == MoveInclusive)
moveRight(); // correction moveRight(); // correction
if (anchor() >= position()) if (m_movetype != MoveLineWise)
m_anchor--; if (anchor() >= position())
m_anchor--;
} }
if (!dotCommand.isEmpty()) if (!dotCommand.isEmpty())
setDotCommand("d" + dotCommand); setDotCommand("d" + dotCommand);
yankSelectedText(); yankSelectedText();
if (m_movetype == MoveLineWise)
m_registers[m_register].rangemode = RangeLineMode;
removeSelectedText(); removeSelectedText();
m_submode = NoSubMode; m_submode = NoSubMode;
if (atEndOfLine()) if (atEndOfLine())
@@ -819,6 +824,8 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
setTargetColumn(); setTargetColumn();
} else if (m_submode == YankSubMode) { } else if (m_submode == YankSubMode) {
yankSelectedText(); yankSelectedText();
if (m_movetype == MoveLineWise)
m_registers[m_register].rangemode = RangeLineMode;
m_submode = NoSubMode; m_submode = NoSubMode;
if (m_register != '"') { if (m_register != '"') {
setPosition(m_marks[m_register]); setPosition(m_marks[m_register]);
@@ -1429,6 +1436,7 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
m_movetype = MoveLineWise; m_movetype = MoveLineWise;
moveToStartOfLine(); moveToStartOfLine();
setAnchor(); setAnchor();
m_targetColumn = 0;
moveDown(count() + 1); moveDown(count() + 1);
} }
finishMovement("j"); finishMovement("j");
@@ -1462,6 +1470,7 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
} else { } else {
m_movetype = MoveLineWise; m_movetype = MoveLineWise;
moveToStartOfLine(); moveToStartOfLine();
m_targetColumn = 0;
moveDown(); moveDown();
setAnchor(); setAnchor();
moveUp(count() + 1); moveUp(count() + 1);