mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 07:47:54 +01:00
* Fixes #4127. PopupAutocomplete visible not updating when there are no suggestions * Code cleanup for re-run git actions
This commit is contained in:
@@ -11,8 +11,8 @@ public abstract partial class PopupAutocomplete : AutocompleteBase
|
||||
private bool _closed;
|
||||
private Scheme _scheme;
|
||||
private View _hostControl;
|
||||
private View _top; // The _hostControl's SuperView
|
||||
private View _popup;
|
||||
private View _top; // The _hostControl's SuperView
|
||||
internal View _popup;
|
||||
private int _toRenderLength;
|
||||
|
||||
/// <summary>Creates a new instance of the <see cref="PopupAutocomplete"/> class.</summary>
|
||||
@@ -70,6 +70,7 @@ public abstract partial class PopupAutocomplete : AutocompleteBase
|
||||
{
|
||||
_top.Initialized += _top_Initialized;
|
||||
}
|
||||
|
||||
_top.Removed += _top_Removed;
|
||||
}
|
||||
}
|
||||
@@ -268,7 +269,11 @@ public abstract partial class PopupAutocomplete : AutocompleteBase
|
||||
else if (!Visible || HostControl?.HasFocus == false || Suggestions.Count == 0)
|
||||
{
|
||||
LastPopupPos = null;
|
||||
Visible = false;
|
||||
|
||||
if (Visible)
|
||||
{
|
||||
Close ();
|
||||
}
|
||||
|
||||
if (Suggestions.Count == 0)
|
||||
{
|
||||
@@ -372,16 +377,16 @@ public abstract partial class PopupAutocomplete : AutocompleteBase
|
||||
if (PopupInsideContainer)
|
||||
{
|
||||
_popup.Frame = new (
|
||||
new (HostControl.Frame.X + renderAt.X, HostControl.Frame.Y + renderAt.Y),
|
||||
new (width, height)
|
||||
);
|
||||
new (HostControl.Frame.X + renderAt.X, HostControl.Frame.Y + renderAt.Y),
|
||||
new (width, height)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
_popup.Frame = new (
|
||||
renderAt with { X = HostControl.Frame.X + renderAt.X },
|
||||
new (width, height)
|
||||
);
|
||||
renderAt with { X = HostControl.Frame.X + renderAt.X },
|
||||
new (width, height)
|
||||
);
|
||||
}
|
||||
|
||||
_popup.Move (0, 0);
|
||||
@@ -419,6 +424,7 @@ public abstract partial class PopupAutocomplete : AutocompleteBase
|
||||
ClearSuggestions ();
|
||||
Visible = false;
|
||||
_closed = true;
|
||||
|
||||
//RemovePopupFromTop ();
|
||||
_popup.Visible = false;
|
||||
HostControl?.SetNeedsDraw ();
|
||||
@@ -561,7 +567,6 @@ public abstract partial class PopupAutocomplete : AutocompleteBase
|
||||
_top?.Remove (_popup);
|
||||
_popup.Dispose ();
|
||||
_popup = null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -571,6 +576,7 @@ public abstract partial class PopupAutocomplete : AutocompleteBase
|
||||
{
|
||||
_top = sender as View;
|
||||
}
|
||||
|
||||
AddPopupToTop ();
|
||||
}
|
||||
|
||||
|
||||
@@ -153,6 +153,9 @@ This an long line and against TextView.
|
||||
This an long line and against TextView.",
|
||||
output
|
||||
);
|
||||
Assert.Empty (tv.Autocomplete.Suggestions);
|
||||
Assert.False (((PopupAutocomplete)tv.Autocomplete)._popup.Visible);
|
||||
|
||||
top.Dispose ();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user