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>
This commit is contained in:
hjk
2016-12-09 10:10:31 +01:00
committed by Eike Ziller
parent 52803f168b
commit 4721888fa7
5 changed files with 19 additions and 0 deletions

View File

@@ -1488,6 +1488,9 @@ void EditorManagerPrivate::setCurrentEditor(IEditor *editor, bool ignoreNavigati
if (d->m_currentEditor == editor)
return;
emit m_instance->currentEditorAboutToChange(d->m_currentEditor);
if (d->m_currentEditor && !ignoreNavigationHistory)
EditorManager::addCurrentPositionToNavigationHistory();

View File

@@ -189,6 +189,7 @@ signals:
void findOnFileSystemRequest(const QString &path);
void aboutToSave(IDocument *document);
void autoSaved();
void currentEditorAboutToChange(Core::IEditor *editor);
public slots:
static void saveDocument();

View File

@@ -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;

View File

@@ -106,6 +106,7 @@ public:
void handleCommand(const QString &cmd);
void handleReplay(const QString &keys);
void handleInput(const QString &keys);
void enterCommandMode();
void installEventFilter();

View File

@@ -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);