Hide TypeCompleter on suggestion chosen

This commit is contained in:
Sinai 2021-05-11 02:38:39 +10:00
parent 34c8ad3646
commit 4019af5936

View File

@ -29,6 +29,8 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
private HashSet<Type> allowedTypes;
private string chosenSuggestion;
public TypeCompleter(Type baseType, InputFieldRef inputField)
{
BaseType = baseType;
@ -52,14 +54,14 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
suggestions.Clear();
AutoCompleter.Instance.SetSuggestions(suggestions);
chosenSuggestion = suggestion.UnderlyingValue;
}
private void OnInputFieldChanged(string value)
{
value = value ?? "";
if (string.IsNullOrEmpty(value))
if (string.IsNullOrEmpty(value) || value == chosenSuggestion)
{
chosenSuggestion = null;
AutoCompleter.Instance.ReleaseOwnership(this);
}
else