Exemple #1
0
 public void AddToLine(Mono.TextEditor.Document doc)
 {
     if (Line != null)
     {
         doc.AddMarker(Line, marker);
     }
 }
		public override void Analyze (Document doc, LineSegment line, Chunk startChunk, int startOffset, int endOffset)
		{
			if (endOffset <= startOffset || startOffset >= doc.Length || inUpdate)
				return;
			inUpdate = true;
			try {
				string text = doc.GetTextAt (startOffset, endOffset - startOffset);
				int startColumn = startOffset - line.Offset;
				var markers = new List <UrlMarker> (line.Markers.Where (m => m is UrlMarker).Cast<UrlMarker> ());
				markers.ForEach (m => doc.RemoveMarker (m, false));
				foreach (System.Text.RegularExpressions.Match m in urlRegex.Matches (text)) {
					doc.AddMarker (line, new UrlMarker (doc, line, m.Value, UrlType.Url, syntax, startColumn + m.Index, startColumn + m.Index + m.Length), false);
				}
				foreach (System.Text.RegularExpressions.Match m in mailRegex.Matches (text)) {
					doc.AddMarker (line, new UrlMarker (doc, line, m.Value, UrlType.Email, syntax, startColumn + m.Index, startColumn + m.Index + m.Length), false);
				}
			} finally {
				inUpdate = false;
			}
		}
Exemple #3
0
        public void AddToLine(Mono.TextEditor.Document doc)
        {
            if (Line != null)
            {
                DocumentLocation dl = doc.OffsetToLocation(marker.StartCol);
                marker.StartCol = dl.Column;

                dl            = doc.OffsetToLocation(marker.EndCol);
                marker.EndCol = dl.Column;

                doc.AddMarker(Line, marker);
            }
        }
		void UnderLineError (Document doc, Error info)
		{
			LineSegment line = doc.GetLine (info.Region.Start.Line);
			// If the line is already underlined
			if (errors.Any (em => em.LineSegment == line))
				return;
			ErrorMarker error = new ErrorMarker (info, line);
			errors.Add (error);
			doc.AddMarker (line, error);
		}