diff --git a/src/render/katerenderer.cpp b/src/render/katerenderer.cpp --- a/src/render/katerenderer.cpp +++ b/src/render/katerenderer.cpp @@ -384,19 +384,26 @@ { QVector newHighlight; + if (textLine->length() > 1024 && !selectionsOnly) { + return newHighlight; + } + // Don't compute the highlighting if there isn't going to be any highlighting QList rangesWithAttributes = m_doc->buffer().rangesForLine(line, m_printerFriendly ? nullptr : m_view, true); if (selectionsOnly || !textLine->attributesList().isEmpty() || !rangesWithAttributes.isEmpty()) { RenderRangeList renderRanges; - // Add the inbuilt highlighting to the list - NormalRenderRange *inbuiltHighlight = new NormalRenderRange(); - const QVector &al = textLine->attributesList(); - for (int i = 0; i < al.count(); ++i) - if (al[i].length > 0 && al[i].attributeValue > 0) { - inbuiltHighlight->addRange(new KTextEditor::Range(KTextEditor::Cursor(line, al[i].offset), al[i].length), specificAttribute(al[i].attributeValue)); + if (textLine->length() <= 1024) { + // Add the inbuilt highlighting to the list + NormalRenderRange *inbuiltHighlight = new NormalRenderRange(); + const QVector &al = textLine->attributesList(); + for (int i = 0; i < al.count(); ++i) { + if (al[i].length > 0 && al[i].attributeValue > 0) { + inbuiltHighlight->addRange(new KTextEditor::Range(KTextEditor::Cursor(line, al[i].offset), al[i].length), specificAttribute(al[i].attributeValue)); + } } - renderRanges.append(inbuiltHighlight); + renderRanges.append(inbuiltHighlight); + } if (!completionHighlight) { // check for dynamic hl stuff