Commit 641add25 authored by Christoph Cullmann's avatar Christoph Cullmann 🐮
Browse files

Make closeView consistent with "close tab"

It will close the document if the doc only has 1 view and close just
the view + remove from tab bar if the doc has more than one views. This
ensures that vi mode users will get the same behaviour as normal mode
parent c1392726
Pipeline #152905 passed with stage
in 2 minutes and 28 seconds
......@@ -764,32 +764,16 @@ void KateViewManager::documentWillBeDeleted(KTextEditor::Document *doc)
void KateViewManager::closeView(KTextEditor::View *view)
* kill view we want to kill
* try to have active view around!
if (!activeView() && !KateApp::self()->documentManager()->documentList().empty()) {
// we can only close views that are in our viewspaces
if (!view || !view->parentWidget() || !view->parentWidget()->parentWidget()) {
* if we have one now, show them in all viewspaces that got empty!
if (KTextEditor::View *const newActiveView = activeView()) {
* check if we have any empty viewspaces and give them a view
for (KateViewSpace *vs : m_viewSpaceList) {
if (!vs->currentView()) {
createView(newActiveView->document(), vs);
Q_EMIT viewChanged(newActiveView);
// get the viewspace if possible and close the document there => should close the passed view
// will close the full document, too, if last
auto viewSpace = qobject_cast<KateViewSpace *>(view->parentWidget()->parentWidget());
if (viewSpace) {
Supports Markdown
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