public static ErrorMarker Create(EditorDocument EditorDoc, GenericError Error) { var em = new ErrorMarker(EditorDoc, Error); em.ForegroundColor = Error.ForegroundColor; em.BackgroundColor = Error.BackgroundColor; if (Error.MarkerColor.HasValue) { em.MarkerColor = Error.MarkerColor.Value; } // Init offsets manually try { if (Error.Line >= EditorDoc.Editor.Document.LineCount) { return(null); } if (Error.Line == EditorDoc.Editor.Document.LineCount - 1 && EditorDoc.Editor.Document.Lines[Error.Line].Length > Error.Column) { return(null); } em.StartOffset = EditorDoc.Editor.Document.GetOffset(Error.Line, Error.Column); } catch { return(null); } if (Error.Length > 0) { em.Length = Error.Length; } else { em.CalculateWordOffset(em.StartOffset, false); } return(em); }
ErrorMarker(EditorDocument EditorDoc, GenericError Error) : base(EditorDoc.MarkerStrategy) { this.EditorDocument = EditorDoc; this.Error = Error; }