Commit 4350baee authored by Rhys Weatherley's avatar Rhys Weatherley

Map n and N in FakeVim to the FIND_NEXT and FIND_PREVIOUS actions.

parent 6d4d0f04
......@@ -944,9 +944,9 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
// Recognize ZZ and ZQ as aliases for ":x" and ":q!".
m_submode = NoSubMode;
if (key == 'Z')
handleExCommand("x");
handleCommand("x");
else if (key == 'Q')
handleExCommand("q!");
handleCommand("q!");
} else if (m_subsubmode == FtSubSubMode) {
m_semicolonType = m_subsubdata;
m_semicolonKey = key;
......@@ -1291,10 +1291,10 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
handleStartOfLine();
finishMovement();
} else if (key == 'n') {
search(lastSearchString(), m_lastSearchForward);
emit q->findNextRequested(false);
recordJump();
} else if (key == 'N') {
search(lastSearchString(), !m_lastSearchForward);
emit q->findNextRequested(true);
recordJump();
} else if (key == 'o' || key == 'O') {
setDotCommand("%1o", count());
......
......@@ -75,6 +75,7 @@ signals:
void completionRequested();
void windowCommandRequested(int key);
void findRequested(bool reverse);
void findNextRequested(bool reverse);
public:
class Private;
......
......@@ -235,6 +235,7 @@ private slots:
void triggerCompletions();
void windowCommand(int key);
void find(bool reverse);
void findNext(bool reverse);
void showSettingsDialog();
void showCommandBuffer(const QString &contents);
......@@ -367,6 +368,14 @@ void FakeVimPluginPrivate::find(bool reverse)
triggerAction(Find::Constants::FIND_IN_DOCUMENT);
}
void FakeVimPluginPrivate::findNext(bool reverse)
{
if (reverse)
triggerAction(Find::Constants::FIND_PREVIOUS);
else
triggerAction(Find::Constants::FIND_NEXT);
}
void FakeVimPluginPrivate::editorOpened(Core::IEditor *editor)
{
if (!editor)
......@@ -408,6 +417,8 @@ void FakeVimPluginPrivate::editorOpened(Core::IEditor *editor)
this, SLOT(windowCommand(int)));
connect(handler, SIGNAL(findRequested(bool)),
this, SLOT(find(bool)));
connect(handler, SIGNAL(findNextRequested(bool)),
this, SLOT(findNext(bool)));
handler->setCurrentFileName(editor->file()->fileName());
handler->installEventFilter();
......
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