Ver código fonte

merged upstream master

Charlie Kindel 5 anos atrás
pai
commit
2e1132f484

+ 2 - 0
Terminal.Gui/Views/Label.cs

@@ -99,6 +99,8 @@ namespace Terminal.Gui {
 
 		static ustring ClipAndJustify (ustring str, int width, TextAlignment talign)
 		{
+			// Get rid of any '\r' added by Windows
+			str = str.Replace ("\r", ustring.Empty);
 			int slen = str.RuneCount;
 			if (slen > width){
 				var uints = str.ToRunes (width);

+ 7 - 11
Terminal.Gui/Windows/MessageBox.cs

@@ -91,12 +91,11 @@ namespace Terminal.Gui {
 			return QueryFull (true, 0, 0, title, message, buttons);
 		}
 
-
 		static int QueryFull (bool useErrorColors, int width, int height, ustring title, ustring message, params ustring [] buttons)
 		{
 			const int defaultWidth = 30;
 			int textWidth = Label.MaxWidth (message, width);
-			int textHeight = message.Count(ustring.Make('\n')) + 1;
+			int textHeight = message.Count (ustring.Make ('\n')) + 1;
 			int msgboxHeight = Math.Max (1, textHeight) + 4; // textHeight + (top + top padding + buttons + bottom)
 
 			// Create button array for Dialog
@@ -126,15 +125,12 @@ namespace Terminal.Gui {
 
 			if (message != null) {
 				var l = new Label (textWidth > width ? 0 : (width - 4 - textWidth) / 2, 1, message);
-				//l.ColorScheme = Colors.Menu;
-				if (true) { //width == 0 & height == 0) {
-					l.LayoutStyle = LayoutStyle.Computed;
-					l.TextAlignment = TextAlignment.Centered;
-					l.X = Pos.Center ();
-					l.Y = Pos.Center ();
-					l.Width = Dim.Fill (2);
-					l.Height = Dim.Fill (2);
-				}
+				l.LayoutStyle = LayoutStyle.Computed;
+				l.TextAlignment = TextAlignment.Centered;
+				l.X = Pos.Center ();
+				l.Y = Pos.Center ();
+				l.Width = Dim.Fill (2);
+				l.Height = Dim.Fill (2);
 				d.Add (l);
 			}
 

+ 4 - 2
UICatalog/UICatalog.cs

@@ -95,9 +95,11 @@ namespace UICatalog {
 		private static void Setup ()
 		{
 			StringBuilder aboutMessage = new StringBuilder ();
-			aboutMessage.AppendLine ("UI Catalog is a comprehensive sample library for Terminal.Gui\n");
+			aboutMessage.AppendLine ("UI Catalog is a comprehensive sample library for Terminal.Gui");
+			aboutMessage.AppendLine ("");
 			aboutMessage.AppendLine ($"Version: {typeof(UICatalogApp).Assembly.GetName ().Version}");
-			aboutMessage.Append ($"Using Terminal.Gui Version: {typeof (Terminal.Gui.Application).Assembly.GetName ().Version}\n");
+			aboutMessage.AppendLine ($"Using Terminal.Gui Version: {typeof (Terminal.Gui.Application).Assembly.GetName ().Version}");
+			aboutMessage.AppendLine ("");
 
 			_menu = new MenuBar (new MenuBarItem [] {
 				new MenuBarItem ("_File", new MenuItem [] {