MCPcopy Create free account
hub / github.com/KDE/kdevelop / updateHistory

Method updateHistory

plugins/contextbrowser/contextbrowser.cpp:1398–1427  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1396}
1397
1398void ContextBrowserPlugin::updateHistory(KDevelop::DUContext* context, const KTextEditor::Cursor& position, bool force)
1399{
1400 qCDebug(PLUGIN_CONTEXTBROWSER) << "updating history";
1401
1402 if (m_outlineLine && m_outlineLine->isVisible())
1403 updateDeclarationListBox(context);
1404
1405 if (!context || (!context->owner() && !force)) {
1406 return; //Only add history-entries for contexts that have owners, which in practice should be functions and classes
1407 //This keeps the history cleaner
1408 }
1409
1410 if (isPreviousEntry(context, position)) {
1411 if (m_nextHistoryIndex) {
1412 HistoryEntry& he = m_history[m_nextHistoryIndex - 1];
1413 he.setCursorPosition(position);
1414 }
1415 return;
1416 } else { // Append new history entry
1417 m_history.resize(m_nextHistoryIndex); // discard forward history
1418 m_history.append(HistoryEntry(IndexedDUContext(context), position));
1419 ++m_nextHistoryIndex;
1420
1421 updateButtonState();
1422 if (m_history.size() > (maxHistoryLength + 5)) {
1423 m_history.remove(0, m_history.size() - maxHistoryLength);
1424 m_nextHistoryIndex = m_history.size();
1425 }
1426 }
1427}
1428
1429void ContextBrowserPlugin::updateDeclarationListBox(DUContext* context)
1430{

Callers

nothing calls this directly

Calls 7

HistoryEntryClass · 0.70
IndexedDUContextClass · 0.50
ownerMethod · 0.45
setCursorPositionMethod · 0.45
appendMethod · 0.45
sizeMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected