QString text = removeSelectedText();
//qDebug() << "CHANGING TO INSERT MODE" << text;
m_registers[m_register] = text;
- m_mode = InsertMode;
+ enterInsertMode();
m_submode = NoSubMode;
} else if (m_submode == DeleteSubMode) {
if (m_moveType == MoveInclusive)
moveToMatchingParanthesis();
finishMovement();
} else if (key == 'a') {
- m_mode = InsertMode;
+ enterInsertMode();
m_lastInsertion.clear();
if (!atEndOfLine())
moveRight();
updateMiniBuffer();
} else if (key == 'A') {
- m_mode = InsertMode;
+ enterInsertMode();
moveToEndOfLine();
m_lastInsertion.clear();
} else if (key == control('a')) {
setAnchor();
moveToEndOfLine();
m_registers[m_register] = removeSelectedText();
- m_mode = InsertMode;
+ enterInsertMode();
finishMovement();
} else if (key == control('c')) {
showBlackMessage("Type Alt-v,Alt-v to quit FakeVim mode");
// FIXME: right now we repeat the insertion count() times,
// but not the deletion
m_lastInsertion.clear();
- m_mode = InsertMode;
+ enterInsertMode();
m_submode = ReplaceSubMode;
setDotCommand("R");
} else if (key == control('r')) {
void command_up();
void command_w();
+ // special tests
+ void test_i_cw_i();
+
private:
void setup();
void send(const QString &command) { sendEx("normal " + command); }
const QString tst_FakeVim::escape = QChar(27);
+QString control(int c)
+{
+ return QChar(c + 256);
+}
+
tst_FakeVim::tst_FakeVim(bool usePlainTextEdit)
{
// small insertion at start of document
check("ix" + escape, "@x" + lines);
check("u", "@" + lines);
+// FIXME redo broken
+ //check(control('r'), "@x" + lines);
+ //check("u", "@" + lines);
// small insertion at start of document
check("ixxx" + escape, "xx@x" + lines);
// FIXME undo broken
// checkEx("redo", "b@xa" + lines);
// check("u", "@a" + lines);
- check("u", "@" + lines);
}
void tst_FakeVim::command_left()
move("4j", "@int main");
move("h", "@int main"); // no move over left border
move("$", "argv[])@");
- //move("h", "argv[]@)");
- check("h", lmid(0, 4) + "\nint main(int argc, char *argv[]@)\n" + lmid(5));
+ move("h", "argv[]@)");
move("3h", "arg@v[])");
move("50h", "@int main");
}
*/
+void tst_FakeVim::test_i_cw_i()
+{
+ setup();
+ move("j", "@" + l[1]);
+ check("ixx" + escape, l[0] + "\nx@x" + lmid(1));
+return; // FIXME: not in sync with Gui behaviour?
+ check("cwyy" + escape, l[0] + "\nxy@y" + lmid(1));
+ check("iaa" + escape, l[0] + "\nxya@ay" + lmid(1));
+}
+
//////////////////////////////////////////////////////////////////////////
//