Skip to content

Commit

Permalink
Only check altered lines on view layout changed
Browse files Browse the repository at this point in the history
  • Loading branch information
mrlacey committed Jan 25, 2019
1 parent 4afb9bf commit 7257d2e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/ResourceAdornmentManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ internal class ResourceAdornmentManager : IDisposable
{
private readonly IAdornmentLayer layer;
private readonly IWpfTextView view;
private bool hasDoneInitialCreateVisualsPass = false;

public ResourceAdornmentManager(IWpfTextView view)
{
Expand Down Expand Up @@ -193,7 +194,9 @@ private async void LayoutChangedHandler(object sender, TextViewLayoutChangedEven
{
if (ResourcesLoaded)
{
foreach (ITextViewLine line in this.view.TextViewLines)
var collection = hasDoneInitialCreateVisualsPass ? (IEnumerable<ITextViewLine>)e.NewOrReformattedLines : this.view.TextViewLines;

foreach (ITextViewLine line in collection)
{
int lineNumber = line.Snapshot.GetLineFromPosition(line.Start.Position).LineNumber;

Expand All @@ -208,6 +211,8 @@ private async void LayoutChangedHandler(object sender, TextViewLayoutChangedEven
await OutputPane.Instance.WriteAsync(ex.Source);
await OutputPane.Instance.WriteAsync(ex.StackTrace);
}

this.hasDoneInitialCreateVisualsPass = true;
}
}
}
Expand Down

0 comments on commit 7257d2e

Please sign in to comment.