Commit 6077d20b authored by hjk's avatar hjk

fakevim: fix . after C in command mode

parent f17a81c9
......@@ -179,10 +179,17 @@ QDebug &operator<<(QDebug &ts, const QList<QTextEdit::ExtraSelection> &sels)
return ts;
}
int lineCount(const QString &text)
QString quoteUnprintable(const QString &ba)
{
//return text.count(QChar(ParagraphSeparator));
return text.count(QChar('\n'));
QString res;
for (int i = 0, n = ba.size(); i != n; ++i) {
QChar c = ba.at(i);
if (c.isPrint())
res += c;
else
res += QString("\\x%1").arg(c.unicode(), 2, 16);
}
return res;
}
enum EventResult
......@@ -1075,7 +1082,7 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
m_passing = !m_passing;
updateMiniBuffer();
} else if (key == '.') {
qDebug() << "REPEATING" << m_dotCommand;
qDebug() << "REPEATING" << quoteUnprintable(m_dotCommand);
QString savedCommand = m_dotCommand;
m_dotCommand.clear();
replay(savedCommand, count());
......@@ -1132,6 +1139,7 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
moveToEndOfLine();
m_registers[m_register] = removeSelectedText();
enterInsertMode();
setDotCommand("C");
finishMovement();
} else if (key == control('c')) {
showBlackMessage("Type Alt-v,Alt-v to quit FakeVim mode");
......@@ -1318,7 +1326,7 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
}
} else if (key == 'p' || key == 'P') {
QString text = m_registers[m_register];
int n = lineCount(text);
int n = text.count(QChar('\n'));
//qDebug() << "REGISTERS: " << m_registers << "MOVE: " << m_moveType;
//qDebug() << "LINES: " << n << text << m_register;
if (n > 0) {
......
......@@ -61,6 +61,7 @@ private slots:
void command_dollar();
void command_down();
void command_dfx_down();
void command_Cxx_down_dot();
void command_e();
void command_i();
void command_left();
......@@ -309,6 +310,15 @@ return;
check("u", l[0] + "\n#inc@lude <QtCore>\n" + lmid(2));
}
void tst_FakeVim::command_Cxx_down_dot()
{
setup();
check("j4l", l[0] + "\n#inc@lude <QtCore>\n" + lmid(2));
check("Cxx" + escape, l[0] + "\n#incx@x\n" + lmid(2));
check("j", l[0] + "\n#incxx\n#incl@ude <QtGui>\n" + lmid(3));
check(".", l[0] + "\n#incxx\n#inclx@x\n" + lmid(3));
}
void tst_FakeVim::command_e()
{
setup();
......
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