Browse Source

Fixed forum-10197: InvalidOperationException in Code Completion ("Cannot set Visibility or call Show, ShowDialog, or WindowInteropHelper.EnsureHandle after a Window has closed.").

Fixed expanding interactive snippets within a code completion dropdown.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5074 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 16 years ago
parent
commit
f4902e70d7
  1. 4
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionWindow.cs
  2. 9
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionWindowBase.cs

4
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionWindow.cs

@ -76,10 +76,12 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion @@ -76,10 +76,12 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion
void completionList_InsertionRequested(object sender, EventArgs e)
{
Close();
// The window must close before Complete() is called.
// If the Complete callback pushes stacked input handlers, we don't want to pop those when the CC window closes.
var item = completionList.SelectedItem;
if (item != null)
item.Complete(this.TextArea, new AnchorSegment(this.TextArea.Document, this.StartOffset, this.EndOffset - this.StartOffset), e);
Close();
}
/// <inheritdoc/>

9
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionWindowBase.cs

@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
// </file>
using System;
using System.Linq;
using System.Diagnostics;
using System.Windows;
using System.Windows.Input;
@ -71,6 +72,12 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion @@ -71,6 +72,12 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion
parentWindow.LocationChanged += parentWindow_LocationChanged;
}
// close previous completion windows of same type
foreach (InputHandler x in this.TextArea.StackedInputHandlers.OfType<InputHandler>()) {
if (x.window.GetType() == this.GetType())
this.TextArea.PopStackedInputHandler(x);
}
myInputHandler = new InputHandler(this);
this.TextArea.PushStackedInputHandler(myInputHandler);
}
@ -102,7 +109,7 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion @@ -102,7 +109,7 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion
/// </summary>
sealed class InputHandler : TextAreaStackedInputHandler
{
readonly CompletionWindowBase window;
internal readonly CompletionWindowBase window;
public InputHandler(CompletionWindowBase window)
: base(window.TextArea)

Loading…
Cancel
Save