private void DrawErrors() { TextBox.Range.ClearStyle(ColorScheme.Colors["error"]); if (_errors != null && _errors.Any()) { foreach (var errorRange in _errors.Select(x => new { x.Line, x.Column, x.Length })) { var startLine = errorRange.Line - 1; var startChar = errorRange.Column == 0? errorRange.Column: errorRange.Column - 1; var endChar = errorRange.Column + errorRange.Length == 0? 1 : errorRange.Length; var range = new Range(TextBox, startChar, startLine, endChar, startLine); ColorScheme.Colors.Values.ToList().ForEach(x => range.ClearStyle(x)); range.SetStyle(ColorScheme.Colors["error"]); } } }