mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-02 01:03:29 +01:00
TextFieldAutoComplete demo works cross-platform. Fix list clearing issue.
This commit is contained in:
@@ -415,9 +415,16 @@ static class Demo {
|
||||
|
||||
static void TextFieldAutoCompleteDemo ()
|
||||
{
|
||||
var items = Directory.GetFiles (@"..\..\..\Terminal.Gui", "*.cs", SearchOption.AllDirectories)
|
||||
.Select (x => Path.GetFileName (x)).Where(x => !x.StartsWith(".")).Distinct().OrderBy(x => x).ToList ();
|
||||
|
||||
IList<string> items = new List<string> ();
|
||||
foreach (var dir in new [] { "/etc", @"\windows\System32" }) {
|
||||
if (Directory.Exists (dir)) {
|
||||
items = Directory.GetFiles (dir)
|
||||
.Select (Path.GetFileName)
|
||||
.Where (x => char.IsLetterOrDigit (x [0]))
|
||||
.Distinct ()
|
||||
.OrderBy (x => x).ToList ();
|
||||
}
|
||||
}
|
||||
var list = new TextFieldAutoComplete (0, 0, 36, 7, items);
|
||||
list.Changed += (object sender, ustring text) => { Application.RequestStop (); };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user