Skip to content

Commit

Permalink
Merge pull request dotnet#32725 from JoeRobich/fix-duplication-in-FAR
Browse files Browse the repository at this point in the history
Remove additive classifications when generating ClassifiedText from ClassifiedSpans
  • Loading branch information
JoeRobich committed Jan 25, 2019
2 parents 2792546 + 03f35a7 commit 2e8b9e2
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ protected override IList<System.Windows.Documents.Inline> CreateLineTextInlines(
.GetProperties(propertyId);
var highlightBrush = properties["Background"] as Brush;

var classifiedSpans = _excerptResult.ClassifiedSpans;
// Remove additive classified spans before creating classified text.
// Otherwise the text will be repeated since there are two classifications
// for the same span. Additive classifications should not change the foreground
// color, so the resulting classified text will retain the proper look.
var classifiedSpans = _excerptResult.ClassifiedSpans.WhereAsArray(
cs => !ClassificationTypeNames.AdditiveTypeNames.Contains(cs.ClassificationType));
var classifiedTexts = classifiedSpans.SelectAsArray(
cs => new ClassifiedText(cs.ClassificationType, _excerptResult.Content.ToString(cs.TextSpan)));

Expand Down

0 comments on commit 2e8b9e2

Please sign in to comment.