Commit aa3b274a authored by hjk's avatar hjk

fakevim: fix undo of 'J'

parent bfb01f41
......@@ -1178,7 +1178,7 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
m_passing = !m_passing;
updateMiniBuffer();
} else if (key == '.') {
//qDebug() << "REPEATING" << quoteUnprintable(m_dotCommand);
//qDebug() << "REPEATING" << quoteUnprintable(m_dotCommand) << count();
QString savedCommand = m_dotCommand;
m_dotCommand.clear();
replay(savedCommand, count());
......@@ -1366,6 +1366,8 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
}
finishMovement("j");
} else if (key == 'J') {
setDotCommand("%1J", count());
beginEditBlock();
if (m_submode == NoSubMode) {
for (int i = qMax(count(), 2) - 1; --i >= 0; ) {
moveToEndOfLine();
......@@ -1380,6 +1382,8 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
if (!m_gflag)
moveLeft();
}
endEditBlock();
finishMovement();
} else if (key == 'k' || key == Key_Up) {
if (m_submode == NoSubMode || m_submode == ZSubMode
|| m_submode == CapitalZSubMode || m_submode == RegisterSubMode) {
......
......@@ -56,26 +56,27 @@ public slots:
private slots:
// command mode
void command_Cxx_down_dot();
void command_Gyyp();
void command_J();
void command_Yp();
void command_cc();
void command_cw();
void command_dw();
void command_dd();
void command_dd_2();
void command_dfx_down();
void command_dollar();
void command_down();
void command_dfx_down();
void command_Cxx_down_dot();
void command_dw();
void command_e();
void command_i();
void command_left();
void command_ma_yank();
void command_r();
void command_right();
void command_up();
void command_w();
void command_yyp();
void command_Yp();
void command_Gyyp();
void command_ma_yank();
// special tests
void test_i_cw_i();
......@@ -525,6 +526,21 @@ return; // FIXME: not in sync with Gui behaviour?
check("iaa" + escape, l[0] + "\nxya@ay" + lmid(1));
}
void tst_FakeVim::command_J()
{
setup();
move("4j4l", "int @main");
check("J", lmid(0, 5) + "@ " + lmid(5));
check("u", lmid(0, 4) + "\nint @main(int argc, char *argv[])\n" + lmid(5));
checkEx("redo", lmid(0, 5) + "@ " + lmid(5));
return; // FIXME: not in sync with Gui behaviour?
check("3J", lmid(0, 5) + " " + lmid(5, 1) + "@" + lmid(6).mid(3));
check("u", lmid(0, 4) + "\nint @main(int argc, char *argv[])\n" + lmid(5));
checkEx("redo", lmid(0, 5) + "@ " + lmid(5));
}
/*
......
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