|
|
@ -269,6 +269,9 @@ namespace ICSharpCode.AvalonEdit.Gui |
|
|
|
|
|
|
|
|
|
|
|
void DisposeVisualLine(VisualLine visualLine) |
|
|
|
void DisposeVisualLine(VisualLine visualLine) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if (newVisualLines != null && newVisualLines.Contains(visualLine)) { |
|
|
|
|
|
|
|
throw new ArgumentException("Cannot dispose visual line because it is in construction!"); |
|
|
|
|
|
|
|
} |
|
|
|
visualLine.IsDisposed = true; |
|
|
|
visualLine.IsDisposed = true; |
|
|
|
foreach (TextLine textLine in visualLine.TextLines) { |
|
|
|
foreach (TextLine textLine in visualLine.TextLines) { |
|
|
|
textLine.Dispose(); |
|
|
|
textLine.Dispose(); |
|
|
@ -284,6 +287,7 @@ namespace ICSharpCode.AvalonEdit.Gui |
|
|
|
{ |
|
|
|
{ |
|
|
|
VerifyAccess(); |
|
|
|
VerifyAccess(); |
|
|
|
foreach (VisualLine visualLine in allVisualLines) { |
|
|
|
foreach (VisualLine visualLine in allVisualLines) { |
|
|
|
|
|
|
|
Debug.Assert(visualLine.IsDisposed == false); |
|
|
|
int start = visualLine.FirstDocumentLine.LineNumber; |
|
|
|
int start = visualLine.FirstDocumentLine.LineNumber; |
|
|
|
int end = visualLine.LastDocumentLine.LineNumber; |
|
|
|
int end = visualLine.LastDocumentLine.LineNumber; |
|
|
|
if (documentLineNumber >= start && documentLineNumber <= end) |
|
|
|
if (documentLineNumber >= start && documentLineNumber <= end) |
|
|
@ -385,6 +389,7 @@ namespace ICSharpCode.AvalonEdit.Gui |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Size lastAvailableSize; |
|
|
|
Size lastAvailableSize; |
|
|
|
|
|
|
|
List<VisualLine> newVisualLines; |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Measure implementation.
|
|
|
|
/// Measure implementation.
|
|
|
@ -411,7 +416,7 @@ namespace ICSharpCode.AvalonEdit.Gui |
|
|
|
clippedPixelsOnTop = scrollOffset.Y - heightTree.GetVisualPosition(firstLineInView); |
|
|
|
clippedPixelsOnTop = scrollOffset.Y - heightTree.GetVisualPosition(firstLineInView); |
|
|
|
Debug.Assert(clippedPixelsOnTop >= 0); |
|
|
|
Debug.Assert(clippedPixelsOnTop >= 0); |
|
|
|
|
|
|
|
|
|
|
|
List<VisualLine> newVisualLines = new List<VisualLine>(); |
|
|
|
newVisualLines = new List<VisualLine>(); |
|
|
|
|
|
|
|
|
|
|
|
var elementGeneratorsArray = elementGenerators.ToArray(); |
|
|
|
var elementGeneratorsArray = elementGenerators.ToArray(); |
|
|
|
var lineTransformersArray = lineTransformers.ToArray(); |
|
|
|
var lineTransformersArray = lineTransformers.ToArray(); |
|
|
@ -446,13 +451,16 @@ namespace ICSharpCode.AvalonEdit.Gui |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
foreach (VisualLine line in allVisualLines) { |
|
|
|
foreach (VisualLine line in allVisualLines) { |
|
|
|
|
|
|
|
Debug.Assert(line.IsDisposed == false); |
|
|
|
if (!newVisualLines.Contains(line)) |
|
|
|
if (!newVisualLines.Contains(line)) |
|
|
|
DisposeVisualLine(line); |
|
|
|
DisposeVisualLine(line); |
|
|
|
} |
|
|
|
} |
|
|
|
RemoveInlineObjectsNow(); |
|
|
|
RemoveInlineObjectsNow(); |
|
|
|
|
|
|
|
|
|
|
|
allVisualLines = newVisualLines; |
|
|
|
allVisualLines = newVisualLines; |
|
|
|
// visibleVisualLines = readonly copy of visual lines
|
|
|
|
// visibleVisualLines = readonly copy of visual lines
|
|
|
|
visibleVisualLines = new ReadOnlyCollection<VisualLine>(newVisualLines.ToArray()); |
|
|
|
visibleVisualLines = new ReadOnlyCollection<VisualLine>(newVisualLines.ToArray()); |
|
|
|
|
|
|
|
newVisualLines = null; |
|
|
|
|
|
|
|
|
|
|
|
if (allVisualLines.Any(line => line.IsDisposed)) { |
|
|
|
if (allVisualLines.Any(line => line.IsDisposed)) { |
|
|
|
throw new InvalidOperationException("A visual line was disposed even though it is still in use.\n" + |
|
|
|
throw new InvalidOperationException("A visual line was disposed even though it is still in use.\n" + |
|
|
|