diff options
author | hjk <hjk@qt.io> | 2016-12-09 10:10:31 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2016-12-13 08:54:12 +0000 |
commit | 4721888fa7f37e7fc19d6cb721ca6af7c05a97c8 (patch) | |
tree | 5bd2ab3699c3a28fefe85a746f2db4b41e94a6b1 /src/plugins/fakevim | |
parent | 52803f168b9b83d1c00e3ba0e3741723b6a2637b (diff) | |
download | qt-creator-4721888fa7f37e7fc19d6cb721ca6af7c05a97c8.tar.gz |
FakeVim: Force leaving input mode when switching editors
Change-Id: I9c871cf7b0cba027b8a0ec201dd57f1039c9f4a5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/fakevim')
-rw-r--r-- | src/plugins/fakevim/fakevimhandler.cpp | 5 | ||||
-rw-r--r-- | src/plugins/fakevim/fakevimhandler.h | 1 | ||||
-rw-r--r-- | src/plugins/fakevim/fakevimplugin.cpp | 9 |
3 files changed, 15 insertions, 0 deletions
diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 3b60bfad40..118cbc18b4 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -8680,6 +8680,11 @@ void FakeVimHandler::handleInput(const QString &keys) d->leaveFakeVim(); } +void FakeVimHandler::enterCommandMode() +{ + d->enterCommandMode(); +} + void FakeVimHandler::setCurrentFileName(const QString &fileName) { d->m_currentFileName = fileName; diff --git a/src/plugins/fakevim/fakevimhandler.h b/src/plugins/fakevim/fakevimhandler.h index 6f218421e0..92b9249735 100644 --- a/src/plugins/fakevim/fakevimhandler.h +++ b/src/plugins/fakevim/fakevimhandler.h @@ -106,6 +106,7 @@ public: void handleCommand(const QString &cmd); void handleReplay(const QString &keys); void handleInput(const QString &keys); + void enterCommandMode(); void installEventFilter(); diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index b049aa2d96..847d3ca0c2 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -1035,6 +1035,7 @@ private: void onCoreAboutToClose(); void editorOpened(Core::IEditor *); void editorAboutToClose(Core::IEditor *); + void currentEditorAboutToChange(Core::IEditor *); void allDocumentsRenamed(const QString &oldName, const QString &newName); void documentRenamed(Core::IDocument *document, const QString &oldName, const QString &newName); @@ -1246,6 +1247,8 @@ bool FakeVimPluginPrivate::initialize() this, &FakeVimPluginPrivate::editorAboutToClose); connect(EditorManager::instance(), &EditorManager::editorOpened, this, &FakeVimPluginPrivate::editorOpened); + connect(EditorManager::instance(), &EditorManager::currentEditorAboutToChange, + this, &FakeVimPluginPrivate::currentEditorAboutToChange); connect(DocumentManager::instance(), &DocumentManager::allDocumentsRenamed, this, &FakeVimPluginPrivate::allDocumentsRenamed); @@ -1841,6 +1844,12 @@ void FakeVimPluginPrivate::editorAboutToClose(IEditor *editor) m_editorToHandler.remove(editor); } +void FakeVimPluginPrivate::currentEditorAboutToChange(IEditor *editor) +{ + if (FakeVimHandler *handler = m_editorToHandler.value(editor, 0)) + handler->enterCommandMode(); +} + void FakeVimPluginPrivate::allDocumentsRenamed(const QString &oldName, const QString &newName) { renameFileNameInEditors(oldName, newName); |