mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-31 02:08:03 +01:00
Code cleanup
This commit is contained in:
@@ -39,10 +39,7 @@ namespace Terminal.Gui {
|
||||
|
||||
private void Initialize (ComboBox container, bool hideDropdownListOnClick)
|
||||
{
|
||||
if (container == null)
|
||||
throw new ArgumentNullException ("ComboBox container cannot be null.", nameof (container));
|
||||
|
||||
this.container = container;
|
||||
this.container = container ?? throw new ArgumentNullException ("ComboBox container cannot be null.", nameof (container));
|
||||
HideDropdownListOnClick = hideDropdownListOnClick;
|
||||
}
|
||||
|
||||
@@ -236,7 +233,7 @@ namespace Terminal.Gui {
|
||||
readonly TextField search;
|
||||
readonly ComboListView listview;
|
||||
bool autoHide = true;
|
||||
int minimumHeight = 2;
|
||||
readonly int minimumHeight = 2;
|
||||
|
||||
/// <summary>
|
||||
/// Public constructor
|
||||
@@ -721,7 +718,7 @@ namespace Terminal.Gui {
|
||||
return text;
|
||||
}
|
||||
set {
|
||||
search.Text = text = value;
|
||||
SetSearchText (value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -733,7 +730,7 @@ namespace Terminal.Gui {
|
||||
return search.Text;
|
||||
}
|
||||
set {
|
||||
search.Text = text = value;
|
||||
SetSearchText (value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -787,7 +784,7 @@ namespace Terminal.Gui {
|
||||
private void Reset (bool keepSearchText = false)
|
||||
{
|
||||
if (!keepSearchText) {
|
||||
search.Text = text = "";
|
||||
SetSearchText (string.Empty);
|
||||
}
|
||||
|
||||
ResetSearchSet ();
|
||||
@@ -800,6 +797,11 @@ namespace Terminal.Gui {
|
||||
}
|
||||
}
|
||||
|
||||
private void SetSearchText (ustring value)
|
||||
{
|
||||
search.Text = text = value;
|
||||
}
|
||||
|
||||
private void ResetSearchSet (bool noCopy = false)
|
||||
{
|
||||
searchset.Clear ();
|
||||
@@ -855,7 +857,7 @@ namespace Terminal.Gui {
|
||||
listview.SetSource (searchset);
|
||||
listview.Clear (); // Ensure list shrinks in Dialog as you type
|
||||
listview.Height = CalculatetHeight ();
|
||||
this.SuperView?.BringSubviewToFront (this);
|
||||
SuperView?.BringSubviewToFront (this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user