mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +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 bool _closed;
|
||||||
private Scheme _scheme;
|
private Scheme _scheme;
|
||||||
private View _hostControl;
|
private View _hostControl;
|
||||||
private View _top; // The _hostControl's SuperView
|
private View _top; // The _hostControl's SuperView
|
||||||
private View _popup;
|
internal View _popup;
|
||||||
private int _toRenderLength;
|
private int _toRenderLength;
|
||||||
|
|
||||||
/// <summary>Creates a new instance of the <see cref="PopupAutocomplete"/> class.</summary>
|
/// <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.Initialized += _top_Initialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
_top.Removed += _top_Removed;
|
_top.Removed += _top_Removed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -268,7 +269,11 @@ public abstract partial class PopupAutocomplete : AutocompleteBase
|
|||||||
else if (!Visible || HostControl?.HasFocus == false || Suggestions.Count == 0)
|
else if (!Visible || HostControl?.HasFocus == false || Suggestions.Count == 0)
|
||||||
{
|
{
|
||||||
LastPopupPos = null;
|
LastPopupPos = null;
|
||||||
Visible = false;
|
|
||||||
|
if (Visible)
|
||||||
|
{
|
||||||
|
Close ();
|
||||||
|
}
|
||||||
|
|
||||||
if (Suggestions.Count == 0)
|
if (Suggestions.Count == 0)
|
||||||
{
|
{
|
||||||
@@ -372,16 +377,16 @@ public abstract partial class PopupAutocomplete : AutocompleteBase
|
|||||||
if (PopupInsideContainer)
|
if (PopupInsideContainer)
|
||||||
{
|
{
|
||||||
_popup.Frame = new (
|
_popup.Frame = new (
|
||||||
new (HostControl.Frame.X + renderAt.X, HostControl.Frame.Y + renderAt.Y),
|
new (HostControl.Frame.X + renderAt.X, HostControl.Frame.Y + renderAt.Y),
|
||||||
new (width, height)
|
new (width, height)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_popup.Frame = new (
|
_popup.Frame = new (
|
||||||
renderAt with { X = HostControl.Frame.X + renderAt.X },
|
renderAt with { X = HostControl.Frame.X + renderAt.X },
|
||||||
new (width, height)
|
new (width, height)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_popup.Move (0, 0);
|
_popup.Move (0, 0);
|
||||||
@@ -419,6 +424,7 @@ public abstract partial class PopupAutocomplete : AutocompleteBase
|
|||||||
ClearSuggestions ();
|
ClearSuggestions ();
|
||||||
Visible = false;
|
Visible = false;
|
||||||
_closed = true;
|
_closed = true;
|
||||||
|
|
||||||
//RemovePopupFromTop ();
|
//RemovePopupFromTop ();
|
||||||
_popup.Visible = false;
|
_popup.Visible = false;
|
||||||
HostControl?.SetNeedsDraw ();
|
HostControl?.SetNeedsDraw ();
|
||||||
@@ -561,7 +567,6 @@ public abstract partial class PopupAutocomplete : AutocompleteBase
|
|||||||
_top?.Remove (_popup);
|
_top?.Remove (_popup);
|
||||||
_popup.Dispose ();
|
_popup.Dispose ();
|
||||||
_popup = null;
|
_popup = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -571,6 +576,7 @@ public abstract partial class PopupAutocomplete : AutocompleteBase
|
|||||||
{
|
{
|
||||||
_top = sender as View;
|
_top = sender as View;
|
||||||
}
|
}
|
||||||
|
|
||||||
AddPopupToTop ();
|
AddPopupToTop ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -153,6 +153,9 @@ This an long line and against TextView.
|
|||||||
This an long line and against TextView.",
|
This an long line and against TextView.",
|
||||||
output
|
output
|
||||||
);
|
);
|
||||||
|
Assert.Empty (tv.Autocomplete.Suggestions);
|
||||||
|
Assert.False (((PopupAutocomplete)tv.Autocomplete)._popup.Visible);
|
||||||
|
|
||||||
top.Dispose ();
|
top.Dispose ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user