summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Humpula <michal.humpula@seznam.cz>2014-01-18 21:34:08 (GMT)
committerMichal Humpula <michal.humpula@seznam.cz>2014-01-18 22:59:11 (GMT)
commit5562332777f35d0885c208a03c0c1086b656467f (patch)
treef2d27b6e458496ff541ae3fed4576004d4dc5798
parent50593e34dfa0330e3226c0b24ac709b29ef27a4f (diff)
vi-mode: enable numbered registers for "q" command
Reported-by: Jerome Leclanche
-rw-r--r--part/vimode/katevinormalmode.cpp8
-rw-r--r--tests/vimode_test.cpp3
2 files changed, 9 insertions, 2 deletions
diff --git a/part/vimode/katevinormalmode.cpp b/part/vimode/katevinormalmode.cpp
index bef5cc3..975e75f 100644
--- a/part/vimode/katevinormalmode.cpp
+++ b/part/vimode/katevinormalmode.cpp
@@ -3960,8 +3960,12 @@ QSet<KTextEditor::MovingRange *> &KateViNormalMode::highlightedYankForDocument()
bool KateViNormalMode::waitingForRegisterOrCharToSearch()
{
- const QChar lastChar = m_keys.isEmpty() ? QChar::Null : m_keys.at(m_keys.size() - 1);
- return m_keys.size() > 0 && (lastChar == 'f' || lastChar == 't' || lastChar == 'F' || lastChar == 'T' || lastChar == 'r');
+ if (m_keys.size() != 1) {
+ return false;
+ }
+
+ QChar lastChar = m_keys[0];
+ return (lastChar == 'f' || lastChar == 't' || lastChar == 'F' || lastChar == 'T' || lastChar == 'r' || lastChar == 'q' || lastChar == '@');
}
void KateViNormalMode::textInserted(KTextEditor::Document* document, Range range)
diff --git a/tests/vimode_test.cpp b/tests/vimode_test.cpp
index 70588ee..98226a4 100644
--- a/tests/vimode_test.cpp
+++ b/tests/vimode_test.cpp
@@ -6544,6 +6544,9 @@ void ViModeTest::MacroTests()
// Recording a macro in Visual Mode does not exit Visual Mode.
clearAllMacros();
DoTest("foo bar", "vqblql~", "FOO bar");
+ // Recognize correctly numbered registers
+ clearAllMacros();
+ DoTest("foo", "q1iX\\escq@1", "XXfoo");
{
// Ensure that we can call emulated command bar searches, and that we don't record