Skip to content

Commit

Permalink
Merge pull request #450 from AvaloniaUI/do-not-run-generatos-for-long…
Browse files Browse the repository at this point in the history
…-lines

Do not run the element generators for performance reasons
  • Loading branch information
Gillibald authored Aug 28, 2024
2 parents f35f37a + db888cb commit a9b6b20
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/AvaloniaEdit/Rendering/VisualLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@ void PerformVisualElementConstruction(IReadOnlyList<VisualLineElementGenerator>
LastDocumentLine = FirstDocumentLine;
var askInterestOffset = 0; // 0 or 1

// for long lines, do not run the element generators for performance reasons
if (lineLength > LENGTH_LIMIT)
{
_elements.Add(new VisualLineText(this, lineLength));
return;
}

while (offset + askInterestOffset <= currentLineEnd)
{
var textPieceEndOffset = currentLineEnd;
Expand Down

0 comments on commit a9b6b20

Please sign in to comment.