diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionWindowBase.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionWindowBase.cs
index 94fc38f566..124bf6876c 100644
--- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionWindowBase.cs
+++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionWindowBase.cs
@@ -47,6 +47,11 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion
///
public int EndOffset { get; set; }
+ ///
+ /// Gets whether the window was opened above the current line.
+ ///
+ protected bool IsUp { get; private set; }
+
///
/// Creates a new CompletionWindowBase.
///
@@ -307,6 +312,9 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion
}
if (bounds.Bottom > workingScreen.Bottom) {
bounds.Y = locationTop.Y - bounds.Height;
+ IsUp = true;
+ } else {
+ IsUp = false;
}
if (bounds.Y < workingScreen.Top) {
bounds.Y = workingScreen.Top;
@@ -318,6 +326,15 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion
this.Top = bounds.Y;
}
+ ///
+ protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
+ {
+ base.OnRenderSizeChanged(sizeInfo);
+ if (sizeInfo.HeightChanged && IsUp) {
+ this.Top += sizeInfo.PreviousSize.Height - sizeInfo.NewSize.Height;
+ }
+ }
+
///
/// Gets/sets whether the completion window should expect text insertion at the start offset,
/// which not go into the completion region, but before it.