Commit 2989ac1d authored by hjk's avatar hjk
Browse files

fakevim: make :q after :sp more vim-ish

parent edd3b213
......@@ -1600,6 +1600,11 @@ void EditorManager::updateActions()
m_d->m_openInExternalEditorAction->setEnabled(curEditor != 0);
}
bool EditorManager::hasSplitter() const
{
return m_d->m_splitter->isSplitter();
}
QList<IEditor*> EditorManager::openedEditors() const
{
return m_d->m_editorModel->editors();
......
......@@ -155,6 +155,7 @@ public:
QByteArray saveState() const;
bool restoreState(const QByteArray &state);
bool hasSplitter() const;
IEditor *restoreEditor(QString fileName, QString editorId, EditorGroup *group);
......
......@@ -1007,13 +1007,20 @@ void FakeVimPluginPrivate::handleExCommand(bool *handled, const ExCommand &cmd)
void FakeVimPluginPrivate::handleDelayedQuit(bool forced, Core::IEditor *editor)
{
QList<Core::IEditor *> editors;
editors.append(editor);
editorManager()->closeEditors(editors, !forced);
// This tries to simulate vim behaviour. But the models of vim and
// Qt Creator core do not match well...
if (editorManager()->hasSplitter()) {
triggerAction(Core::Constants::REMOVE_CURRENT_SPLIT);
} else {
QList<Core::IEditor *> editors;
editors.append(editor);
editorManager()->closeEditors(editors, !forced);
}
}
void FakeVimPluginPrivate::handleDelayedQuitAll(bool forced)
{
triggerAction(Core::Constants::REMOVE_ALL_SPLITS);
editorManager()->closeAllEditors(!forced);
}
......
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