private Inline NewRun(RichTextBlockDiffContext richTextBlockData, string text, ref int pointer, Color?background = null, Color?foreground = null) { var run = new Run { Text = text, Foreground = foreground.HasValue ? BrushFactory.GetSolidColorBrush(foreground.Value) : _defaultForeground }; if (background != null) { richTextBlockData.AddTextHighlighter(new TextRange() { StartIndex = pointer, Length = text.Length }, background.Value); } pointer += text.Length; return(run); }