diff options
author | hjk <hjk@qt.io> | 2017-07-05 15:16:52 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2017-07-07 15:31:18 +0000 |
commit | e829ca8e319489b4ec5d3a5bcba102be0e110e69 (patch) | |
tree | bda2ac71d390b42a34a5e55297e679d8a390c9a4 /src/plugins/fakevim | |
parent | eb0aa0b76fabcff044d3ee9e4abe253b5484cdca (diff) |
FakeVim: Fix gt/gT/:tabnext/:tabprevious
The mapping was there, but not connected to the core actions.
Change-Id: I9faa1c47afe409caaa0462740a6865d99d959b44
Reviewed-by: Lukas Holecek <hluk@email.cz>
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/fakevim')
-rw-r--r-- | src/plugins/fakevim/fakevimhandler.cpp | 22 | ||||
-rw-r--r-- | src/plugins/fakevim/fakevimhandler.h | 2 | ||||
-rw-r--r-- | src/plugins/fakevim/fakevimplugin.cpp | 5 |
3 files changed, 29 insertions, 0 deletions
diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index b56107d9dd4..21f218e03f5 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -2141,6 +2141,8 @@ public: bool handleExShiftCommand(const ExCommand &cmd); bool handleExSourceCommand(const ExCommand &cmd); bool handleExSubstituteCommand(const ExCommand &cmd); + bool handleExTabNextCommand(const ExCommand &cmd); + bool handleExTabPreviousCommand(const ExCommand &cmd); bool handleExWriteCommand(const ExCommand &cmd); bool handleExEchoCommand(const ExCommand &cmd); @@ -5561,6 +5563,24 @@ bool FakeVimHandler::Private::handleExSubstituteCommand(const ExCommand &cmd) return true; } +bool FakeVimHandler::Private::handleExTabNextCommand(const ExCommand &cmd) +{ + if (cmd.cmd != "tabnext" && cmd.cmd != "tabn") + return false; + + emit q->tabNextRequested(q); + return true; +} + +bool FakeVimHandler::Private::handleExTabPreviousCommand(const ExCommand &cmd) +{ + if (cmd.cmd != "tabprevious" && cmd.cmd != "tabp") + return false; + + emit q->tabPreviousRequested(q); + return true; +} + bool FakeVimHandler::Private::handleExMapCommand(const ExCommand &cmd0) // :map { QByteArray modes; @@ -6212,6 +6232,8 @@ bool FakeVimHandler::Private::handleExCommandHelper(ExCommand &cmd) || handleExShiftCommand(cmd) || handleExSourceCommand(cmd) || handleExSubstituteCommand(cmd) + || handleExTabNextCommand(cmd) + || handleExTabPreviousCommand(cmd) || handleExWriteCommand(cmd) || handleExEchoCommand(cmd); } diff --git a/src/plugins/fakevim/fakevimhandler.h b/src/plugins/fakevim/fakevimhandler.h index 38597b33ae7..4cb22d9df1c 100644 --- a/src/plugins/fakevim/fakevimhandler.h +++ b/src/plugins/fakevim/fakevimhandler.h @@ -157,6 +157,8 @@ signals: void fold(FakeVimHandler *self, int depth, bool fold); void foldGoTo(FakeVimHandler *self, int count, bool current); void jumpToGlobalMark(FakeVimHandler *handler, QChar mark, bool backTickMode, const QString &fileName); + void tabNextRequested(FakeVimHandler *self); + void tabPreviousRequested(FakeVimHandler *self); public: class Private; diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index a7f87c7ee43..5a914075a6d 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -1802,6 +1802,11 @@ void FakeVimPluginPrivate::editorOpened(IEditor *editor) connect(ICore::instance(), &ICore::saveSettingsRequested, this, &FakeVimPluginPrivate::writeSettings); + connect(handler, &FakeVimHandler::tabNextRequested, + this, [this] { triggerAction(Core::Constants::GOTONEXTINHISTORY); }); + connect(handler, &FakeVimHandler::tabPreviousRequested, + this, [this] { triggerAction(Core::Constants::GOTOPREVINHISTORY); }); + handler->setCurrentFileName(editor->document()->filePath().toString()); handler->installEventFilter(); |