Skip to content

Instantly share code, notes, and snippets.

@gitexperience
Last active August 21, 2017 19:06
Show Gist options
  • Save gitexperience/b8282d0967a2888fb4bcc8cc20d657d2 to your computer and use it in GitHub Desktop.
Save gitexperience/b8282d0967a2888fb4bcc8cc20d657d2 to your computer and use it in GitHub Desktop.
Added some properties to TextChangeEventArgs.cs (MD Source Tree) in order to access them here :- https://github.com/mhutch/cbinding/blob/master/CBinding/Project/UnsavedFilesManager.cs#L61
141c141,179
< public IReadOnlyList<TextChange> TextChanges { get; }
---
> readonly ITextSource removedText;
> readonly ITextSource insertedText;
> int newOffset;
> readonly int offset;
>
> /// <summary>
> /// The offset at which the change occurs.
> /// </summary>
> public int Offset {
> get { return offset; }
> }
>
> /// <summary>
> /// The offset at which the change occurs relative to the new buffer.
> /// </summary>
> public int NewOffset {
> get { return newOffset; }
> }
>
> /// <summary>
> /// The text that was removed.
> /// </summary>
> public ITextSource RemovedText {
> get { return removedText; }
> }
>
> /// <summary>
> /// The number of characters removed.
> /// </summary>
> public int RemovalLength {
> get { return removedText.Length; }
> }
>
> /// <summary>
> /// The text that was inserted.
> /// </summary>
> public ITextSource InsertedText {
> get { return insertedText; }
> }
143a182,188
> /// The number of characters inserted.
> /// </summary>
> public int InsertionLength {
> get { return insertedText.Length; }
> }
> public IReadOnlyList<TextChange> TextChanges { get; }
> /// <summary>
147c192
< public TextChangeEventArgs (int offset, string removedText, string insertedText) : this(offset, offset, removedText, insertedText) {}
---
> public TextChangeEventArgs (int offset, string removedText, string insertedText) : this (offset, offset, removedText, insertedText) {}
168c213
< new TextChange (offset, newOffset, removedText, insertedText)
---
> new TextChange (this.offset, this.newOffset, this.removedText, this.insertedText)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment