Browse Source

2008-02-29 Ivan N. Zlatev <[email protected]>

        * StringCollectionEditor.cs: 
         - Split the lines not based on Environment.NewLine as this is 
         not what is used by MWF on Windows.
         - Ignore last empty line.
        [Fixes bug #365948]


svn path=/trunk/mcs/; revision=97014
Ivan Zlatev 18 years ago
parent
commit
23227c0a0e

+ 8 - 0
mcs/class/System.Design/System.Windows.Forms.Design/ChangeLog

@@ -1,3 +1,11 @@
+2008-02-29  Ivan N. Zlatev  <[email protected]>
+
+	* StringCollectionEditor.cs: 
+	 - Split the lines not based on Environment.NewLine as this is 
+	 not what is used by MWF on Windows.
+	 - Ignore last empty line.
+	[Fixes bug #365948]
+
 2008-02-11  Ivan N. Zlatev  <[email protected]>
 
 	* AnchorEditor.cs: More sensible default width.

+ 4 - 3
mcs/class/System.Design/System.Windows.Forms.Design/StringCollectionEditor.cs

@@ -140,9 +140,10 @@ namespace System.Windows.Forms.Design
 			private void butOk_Click (object sender, EventArgs e)
 			{
 				if (this.txtItems.Text != String.Empty) {
-					string[] items = txtItems.Text.Split (Environment.NewLine.ToCharArray ());
-					object[] objects = new object[items.Length];
-					for (int i=0; i < items.Length; i++)
+					string[] items = txtItems.Lines;
+					bool lastLineEmpty = items[items.Length-1].Trim ().Length == 0;
+					object[] objects = new object[lastLineEmpty ? items.Length-1 : items.Length];
+					for (int i=0; i < objects.Length; i++)
 						objects[i] = (object)items[i];
 					base.Items = objects;
 				}