Commit 67a88a4d authored by Eugene Popov's avatar Eugene Popov 🇺🇦
Browse files

Handle an increase in tab limit

Currently, increasing the tab limit has no effect. This MR makes it open the N most recently used documents, that are hidden, instead.

BUG: 458198
parent f05eebc1
Pipeline #223100 canceled with stage
......@@ -84,6 +84,23 @@ void KateTabBar::readConfig()
}
removeTab(documentIdx(doc));
}
} else if (m_docToLruCounterAndHasTab.size() > (size_t)docList.size()) {
// populate N recently user documents
std::map<quint64, KTextEditor::Document*, std::greater<quint64>> mruDocs;
for (const auto &i : m_docToLruCounterAndHasTab) {
KTextEditor::Document *doc = i.first;
if (!docList.contains(doc)) {
mruDocs[i.second.first] = doc;
}
}
int toAdd = m_tabCountLimit - docList.count();
for (const auto &i : mruDocs) {
if (toAdd-- == 0) {
break;
}
KTextEditor::Document *doc = i.second;
setTabDocument(addTab(doc->documentName()), doc);
}
}
}
......
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