TextFieldAutoComplete demo works cross-platform. Fix list clearing issue.

This commit is contained in:
Ross Ferguson
2020-05-18 06:42:23 +01:00
parent 282cf64500
commit 360e0256b8
2 changed files with 23 additions and 4 deletions

View File

@@ -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 (); };