public IEnumerable<TextChangeEventArgs> GetChangesTo(ITextBufferVersion other)
			{
				SnapshotVersion otherVersion = other as SnapshotVersion;
				if (otherVersion == null)
					throw new ArgumentException("Does not belong to same document");
				return checkpoint.GetChangesTo(otherVersion.checkpoint).Select(c => new TextChangeEventArgs(c.Offset, c.RemovedText, c.InsertedText));
			}
			public int CompareAge(ITextBufferVersion other)
			{
				SnapshotVersion otherVersion = other as SnapshotVersion;
				if (otherVersion == null)
					throw new ArgumentException("Does not belong to same document");
				return checkpoint.CompareAge(otherVersion.checkpoint);
			}
			public int MoveOffsetTo(ITextBufferVersion other, int oldOffset, AnchorMovementType movement)
			{
				SnapshotVersion otherVersion = other as SnapshotVersion;
				if (otherVersion == null)
					throw new ArgumentException("Does not belong to same document");
				switch (movement) {
					case AnchorMovementType.AfterInsertion:
						return checkpoint.MoveOffsetTo(otherVersion.checkpoint, oldOffset, ICSharpCode.AvalonEdit.Document.AnchorMovementType.AfterInsertion);
					case AnchorMovementType.BeforeInsertion:
						return checkpoint.MoveOffsetTo(otherVersion.checkpoint, oldOffset, ICSharpCode.AvalonEdit.Document.AnchorMovementType.BeforeInsertion);
					default:
						throw new NotSupportedException();
				}
			}
예제 #4
0
            public bool BelongsToSameDocumentAs(ITextBufferVersion other)
            {
                SnapshotVersion otherVersion = other as SnapshotVersion;

                return(otherVersion != null && checkpoint.BelongsToSameDocumentAs(otherVersion.checkpoint));
            }