Commit e8f0822f authored by Christoph Cullmann's avatar Christoph Cullmann

Merge branch 'close-doc-switch' into 'master'

tabswitcher: switch to next-in-line doc when top document is closed

See merge request kde/kate!18
parents 48da2411 08bc9c22
......@@ -547,9 +547,10 @@ KTextEditor::View *KateViewManager::activeView()
return vs->currentView();
}
// last attempt: just pick first
if (!m_views.isEmpty()) {
KTextEditor::View *v = m_views.begin().key();
// last attempt: pick MRU view
auto views = sortedViews();
if (!views.isEmpty()) {
KTextEditor::View *v = views.front();
activateView(v);
m_activeViewRunning = false;
return v;
......
......@@ -249,6 +249,15 @@ void KateViewSpace::removeView(KTextEditor::View *v)
// ...and now: remove from view space
stack->removeWidget(v);
// switch to most recently used rather than letting stack choose one
// (last element could well be v->document() being removed here)
for (auto it = m_lruDocList.rbegin(); it != m_lruDocList.rend(); ++it) {
if (m_docToView.contains(*it)) {
showView(*it);
break;
}
}
}
bool KateViewSpace::showView(KTextEditor::Document *document)
......
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