Explorar o código

Accomodate upstream changes

Ross Ferguson %!s(int64=5) %!d(string=hai) anos
pai
achega
acacd0c9e7
Modificáronse 3 ficheiros con 10 adicións e 10 borrados
  1. 2 2
      Example/demo.cs
  2. 4 4
      Terminal.Gui/Views/ComboBox.cs
  3. 4 4
      UICatalog/Scenarios/ListsAndCombos.cs

+ 2 - 2
Example/demo.cs

@@ -450,13 +450,13 @@ static class Demo {
 
 	static void ComboBoxDemo ()
 	{
-		IList<string> items = new List<string> ();
+		List<ustring> items = new List<ustring> ();
 		foreach (var dir in new [] { "/etc", @"\windows\System32" }) {
 			if (Directory.Exists (dir)) {
 				items = Directory.GetFiles (dir).Union (Directory.GetDirectories (dir))
 					.Select (Path.GetFileName)
 					.Where (x => char.IsLetterOrDigit (x [0]))
-					.OrderBy (x => x).ToList ();
+					.OrderBy (x => x).Select (x => ustring.Make (x)).ToList ();
 			}
 		}
 		var list = new ComboBox () { Width = Dim.Fill(), Height = Dim.Fill() };

+ 4 - 4
Terminal.Gui/Views/ComboBox.cs

@@ -131,7 +131,7 @@ namespace Terminal.Gui {
 			listview.SelectedItemChanged += (ListViewItemEventArgs e) => {
 
 				if(searchset.Count > 0)
-					SetValue ((string)searchset [listview.SelectedItem]);
+					SetValue ((ustring)searchset [listview.SelectedItem]);
 			};
 
 			Application.Loaded += (Application.ResizedEventArgs a) => {
@@ -224,7 +224,7 @@ namespace Terminal.Gui {
 
 			if (e.Key == Key.CursorDown && search.HasFocus && listview.SelectedItem == 0 && searchset.Count > 0) { // jump to list
 				this.SetFocus (listview);
-				SetValue ((string)searchset [listview.SelectedItem]);
+				SetValue ((ustring)searchset [listview.SelectedItem]);
 				return true;
 			}
 
@@ -284,7 +284,7 @@ namespace Terminal.Gui {
 				return;
 			}
 
-			SetValue ((string)searchset [listview.SelectedItem]);
+			SetValue ((ustring)searchset [listview.SelectedItem]);
 			search.CursorPosition = search.Text.Length;
 			Search_Changed (search.Text);
 			Reset (keepSearchText: true);
@@ -326,7 +326,7 @@ namespace Terminal.Gui {
 			if (string.IsNullOrEmpty (search.Text.ToString ()))
 				ResetSearchSet ();
 			else
-				searchset = source.ToList().Cast<string>().Where (x => x.StartsWith (search.Text.ToString (), StringComparison.CurrentCultureIgnoreCase)).ToList();
+				searchset = source.ToList().Cast<ustring>().Where (x => x.ToString().StartsWith (search.Text.ToString (), StringComparison.CurrentCultureIgnoreCase)).ToList();
 
 			listview.SetSource (searchset);
 			listview.Height = CalculatetHeight ();

+ 4 - 4
UICatalog/Scenarios/ListsAndCombos.cs

@@ -12,13 +12,13 @@ namespace UICatalog.Scenarios {
 
 		public override void Setup ()
 		{
-			List<string> items = new List<string> ();
+			List<ustring> items = new List<ustring> ();
 			foreach (var dir in new [] { "/etc", @"\windows\System32" }) {
 				if (Directory.Exists (dir)) {
 					items = Directory.GetFiles (dir).Union(Directory.GetDirectories(dir))
-					.Select (Path.GetFileName)
-					.Where (x => char.IsLetterOrDigit (x [0]))
-					.OrderBy (x => x).ToList ();
+						.Select (Path.GetFileName)
+						.Where (x => char.IsLetterOrDigit (x [0]))
+						.OrderBy (x => x).Select(x => ustring.Make(x)).ToList() ;
 				}
 			}