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
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());
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");
}
} 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) {
void command_dollar();
void command_down();
void command_dfx_down();
+ void command_Cxx_down_dot();
void command_e();
void command_i();
void command_left();
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();