| 609 | } |
| 610 | |
| 611 | void 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" |
nothing calls this directly
no test coverage detected