public void Write(string text, Color?foreground, Color?background) { int begin = WpfTextView.TextSnapshot.Length; Write(text); int end = WpfTextView.TextSnapshot.Length; if (foreground != null || background != null) { SnapshotSpan span = new SnapshotSpan(WpfTextView.TextSnapshot, begin, end - begin); NewColorSpan.Raise(this, Tuple.Create(span, foreground, background)); } }
public void Write(string text, Color?foreground, Color?background) { if (!_startedWritingOutput) { _outputCache.Add(Tuple.Create(text, foreground, background)); return; } int begin = WpfTextView.TextSnapshot.Length; Write(text); int end = WpfTextView.TextSnapshot.Length; if (foreground != null || background != null) { var span = new SnapshotSpan(WpfTextView.TextSnapshot, begin, end - begin); NewColorSpan.Raise(this, Tuple.Create(span, foreground, background)); } }