public SnapshotPoint?GetInsertionPoint(Predicate <ITextBuffer> match) { if (match == null) { throw new ArgumentNullException(nameof(match)); } if (_unmappable) { return(null); } return(MappingHelper.MapDownToFirstMatchNoTrack(_anchor, match)); }
public NormalizedSnapshotSpanCollection GetSpans(Predicate <ITextBuffer> match) { if (_unmappable) { return(NormalizedSnapshotSpanCollection.Empty); } //Try mapping down first. FrugalList <SnapshotSpan> mappedSpans = new FrugalList <SnapshotSpan>(); MappingHelper.MapDownToFirstMatchNoTrack(_anchor, match, mappedSpans); if (mappedSpans.Count == 0) { //Unable to map down ... try mapping up. this.MapUpToBufferNoTrack(match, mappedSpans); } return(new NormalizedSnapshotSpanCollection(mappedSpans)); }
public SnapshotPoint?GetPoint(Predicate <ITextBuffer> match, PositionAffinity affinity) { if (match == null) { throw new ArgumentNullException(nameof(match)); } if (_unmappable) { return(null); } //Try mapping down first. SnapshotPoint?mappedPoint = MappingHelper.MapDownToFirstMatchNoTrack(_anchor, match, affinity); if (!mappedPoint.HasValue) { //Unable to map down ... try mapping up. return(this.MapUpToFirstMatchNoTrack(match, affinity)); } return(mappedPoint); }