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

Method updateMovingCursor

kdevplatform/debugger/breakpoint/breakpoint.cpp:500–540  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

498}
499
500void Breakpoint::updateMovingCursor(const QUrl& url, int line)
501{
502 // Can a moving cursor even be enabled?
503 if (!m_model || line < 0 || url.isEmpty()) {
504 stopDocumentLineTracking();
505 return;
506 }
507
508 if (m_movingCursor) {
509 // Cursor is attached already, is it possible to retain it?
510 auto* const document = m_movingCursor->document();
511 if (document && document->url() == url) {
512 if (line >= document->lines()) {
513 stopDocumentLineTracking();
514 } else if (m_movingCursor->line() != line) {
515 {
516 const auto guard = m_model->markChangeGuard();
517 document->removeMark(m_movingCursor->line(), BreakpointModel::AllBreakpointMarks);
518 document->addMark(line, markType());
519 }
520 m_movingCursor->setLine(line);
521 }
522 return;
523 }
524 }
525
526 // Find the document:
527 const auto* const documentController = ICore::self()->documentController();
528 const auto* const document = documentController ? documentController->documentForUrl(url) : nullptr;
529 if (document) {
530 // Either document changed or the breakpoint has no moving cursor yet.
531 const auto textDocument = document->textDocument();
532 if (textDocument && line < textDocument->lines()) {
533 restartDocumentLineTrackingAt(*textDocument, line);
534 return;
535 }
536 }
537
538 // No document was found, or the location is after the last line of the new document.
539 stopDocumentLineTracking();
540}

Callers

nothing calls this directly

Calls 10

markChangeGuardMethod · 0.80
documentControllerMethod · 0.80
documentForUrlMethod · 0.80
isEmptyMethod · 0.45
documentMethod · 0.45
urlMethod · 0.45
linesMethod · 0.45
lineMethod · 0.45
setLineMethod · 0.45
textDocumentMethod · 0.45

Tested by

no test coverage detected