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

Method aboutToRemoveText

kdevplatform/language/highlighting/codehighlighting.cpp:611–636  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

609}
610
611void CodeHighlighting::aboutToRemoveText(const KTextEditor::Range& range)
612{
613 if (range.onSingleLine()) // don't try to optimize this
614 return;
615
616 VERIFY_FOREGROUND_LOCKED
617 QMutexLocker lock(&m_dataMutex);
618 Q_ASSERT(qobject_cast<KTextEditor::Document*>(sender()));
619 auto* doc = static_cast<KTextEditor::Document*>(sender());
620
621 DocumentChangeTracker* tracker = ICore::self()->languageController()->backgroundParser()
622 ->trackerForUrl(IndexedString(doc->url()));
623 const auto highlightingIt = m_highlights.constFind(tracker);
624 if (highlightingIt != m_highlights.constEnd()) {
625 QVector<MovingRange*>& ranges = (*highlightingIt)->m_highlightedRanges;
626 QVector<MovingRange*>::iterator it = ranges.begin();
627 while (it != ranges.end()) {
628 if (range.contains((*it)->toRange())) {
629 delete (*it);
630 it = ranges.erase(it);
631 } else {
632 ++it;
633 }
634 }
635 }
636}
637}
638
639#include "moc_codehighlighting.cpp"

Callers

nothing calls this directly

Calls 11

trackerForUrlMethod · 0.80
backgroundParserMethod · 0.80
languageControllerMethod · 0.80
constEndMethod · 0.80
toRangeMethod · 0.80
IndexedStringClass · 0.50
urlMethod · 0.45
constFindMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected