public static bool RangeContains(DocumentRange range, DocumentRange range2) { #if OLD_MSBUILD return(range.Contains(ref range2)); #else return(range.Contains(range2)); #endif }
public static bool RangeContains(DocumentRange range, DocumentOffset offset) { #if OLD_MSBUILD return(range.Contains(ref offset)); #else return(range.Contains(offset)); #endif }
void richEditControl1_SelectionChanged(object sender, EventArgs e) { if (isLocked) { return; } SyncronizeFilesCollection(); DocumentPosition pos = richEditControl1.Document.CaretPosition; foreach (KeyValuePair <string, FileFieldInfo> item in filesCollection) { DocumentRange fieldRange = item.Value.DocField.ResultRange; if (fieldRange.Contains(pos) && fieldRange.Start.ToInt() != pos.ToInt() && fieldRange.End.ToInt() != pos.ToInt()) { isLocked = true; int deltaFromStart = pos.ToInt() - fieldRange.Start.ToInt(); int deltaFromEnd = fieldRange.End.ToInt() - pos.ToInt(); if (deltaFromEnd > deltaFromStart) { richEditControl1.Document.CaretPosition = item.Value.DocField.Range.End; } else { richEditControl1.Document.CaretPosition = item.Value.DocField.Range.Start; } isLocked = false; break; } } }
private bool RangeHasHyperlink(DocumentRange documentRange) { foreach (Hyperlink h in richEditControl1.Document.Hyperlinks) { if (documentRange.Contains(h.Range.Start)) { return(true); } } return(false); }
private void richEditControl1_SelectionChanged(object sender, EventArgs e) { if (isSelectionLocked) { return; } if (!lineRange.Contains(richEditControl1.Document.CaretPosition)) { SetLineRangeFormatting(lineRange, System.Drawing.Color.Transparent); lineRange = GetNewLineRange(richEditControl1.Document.CaretPosition); SetLineRangeFormatting(lineRange, System.Drawing.Color.LightGray); } }
private static void RemoveFromTextualOccurrences(IRenameRefactoring executer, DocumentRange handledRange) { if (!(executer.Workflow is RenameWorkflow workflow)) { return; } foreach (var occurrence in workflow.DataModel.ActualOccurrences ?? EmptyList <TextOccurrenceRenameMarker> .InstanceList) { if (!occurrence.Included) { continue; } var occurrenceRange = occurrence.Marker.DocumentRange; if (handledRange.Contains(occurrenceRange)) { occurrence.Included = false; break; } } }