Skip to content

Commit 161fdc9

Browse files
author
danwalmsley
authored
Merge pull request #40 from danwalmsley/snippet-returns-context
Snippet returns context
2 parents 6f2b994 + 150c077 commit 161fdc9

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

src/AvaloniaEdit/Snippets/Snippet.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class Snippet : SnippetContainerElement
3030
/// <summary>
3131
/// Inserts the snippet into the text area.
3232
/// </summary>
33-
public void Insert(TextArea textArea)
33+
public InsertionContext Insert(TextArea textArea)
3434
{
3535
if (textArea == null)
3636
throw new ArgumentNullException(nameof(textArea));
@@ -53,6 +53,8 @@ public void Insert(TextArea textArea)
5353
Insert(context);
5454
context.RaiseInsertionCompleted(EventArgs.Empty);
5555
}
56+
57+
return context;
5658
}
5759
}
5860
}

src/AvaloniaEdit/Snippets/SnippetBoundElement.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ private void targetElement_TextChanged(object sender, EventArgs e)
123123

124124
public void Deactivate(SnippetEventArgs e)
125125
{
126+
TargetElement.TextChanged -= targetElement_TextChanged;
126127
}
127128

128129
public bool IsEditable => false;

0 commit comments

Comments
 (0)