Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2355,7 +2355,23 @@ private void IncrementalMeasureLinesAfterInsert(double constraintWidth, LineProp
// and mergeable with its predecessor.
if (lineIndex > 0) // we can skip this if line wrap is disabled.
{
int origEndOffset = _lineMetrics[lineIndex - 1].EndOffset;

FormatFirstIncrementalLine(lineIndex - 1, constraintWidth, lineProperties, line, out lineOffset, out endOfParagraph);

// If the predecessor's metrics changed and it is part of a soft-wrapped
// paragraph (has soft-wrap predecessors), the entire paragraph's earlier
// lines may be stale. Fall back to a full reformat to avoid leaving
// inconsistent metrics that crash on later hit-test/render (issue #11481).
if (!endOfParagraph && lineOffset != origEndOffset
&& lineIndex >= 2
&& _lineMetrics[lineIndex - 2].Length == _lineMetrics[lineIndex - 2].ContentLength)
{
_lineMetrics.Clear();
_viewportLineVisuals = null;
desiredSize = FullMeasureTick(constraintWidth, lineProperties);
return;
}
}
else
{
Expand Down