| 1396 | } |
| 1397 | |
| 1398 | void 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 | |
| 1429 | void ContextBrowserPlugin::updateDeclarationListBox(DUContext* context) |
| 1430 | { |
nothing calls this directly
no test coverage detected