Browse Source

AutoSize->Auxo

Tig Kindel 1 year ago
parent
commit
b89c262b8c

+ 5 - 5
Terminal.Gui/View/Layout/PosDim.cs

@@ -467,7 +467,7 @@ public class Pos {
 ///	  </description>
 ///	</item>
 ///	<item>
-///	  <term><see cref="Dim.AutoSize(int)"/></term>
+///	  <term><see cref="Auto()"/></term>
 ///	  <description>
 ///	  Creates a <see cref="Dim"/> object that automatically sizes the view to fit all of the view's SubViews.
 ///	  </description>
@@ -611,13 +611,13 @@ public class Dim {
 	/// view.Add (button, textField);
 	/// </code>
 	/// </example>
-	public static Dim AutoSize ()
+	public static Dim Auto ()
 	{
-		return new DimAutoSize ();
+		return new DimAuto ();
 	}
 
-	internal class DimAutoSize : Dim {
-		public override string ToString () => $"AutoSize()";
+	internal class DimAuto : Dim {
+		public override string ToString () => $"Auto()";
 
 		internal override int Anchor (int width)
 		{

+ 2 - 2
Terminal.Gui/View/ViewLayout.cs

@@ -718,7 +718,7 @@ namespace Terminal.Gui {
 					newDimension = AutoSize && autosize > newDimension ? autosize : newDimension;
 					break;
 					
-				case Dim.DimAutoSize:
+				case Dim.DimAuto:
 					var thickness = GetFramesThickness ();
 					if (width) {
 						var furthestRight = Subviews.Max (v => v.Frame.X + v.Frame.Width);
@@ -979,7 +979,7 @@ namespace Terminal.Gui {
 			CollectAll (this, ref nodes, ref edges);
 			var ordered = View.TopologicalSort (SuperView, nodes, edges);
 			foreach (var v in ordered) {
-				if (v.Width is Dim.DimAutoSize || v.Height is Dim.DimAutoSize) {
+				if (v.Width is Dim.DimAuto || v.Height is Dim.DimAuto) {
 					// If the view is auto-sized...
 					var f = v.Frame;
 					LayoutSubview (v, new Rect (GetBoundsOffset (), Bounds.Size));

+ 191 - 202
Terminal.Gui/Views/Dialog.cs

@@ -1,243 +1,232 @@
-//
-// Dialog.cs: Dialog box
-//
-// Authors:
-//   Miguel de Icaza ([email protected])
-//
-using System;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text.Json.Serialization;
-using System.Text;
-using Terminal.Gui;
-using static Terminal.Gui.ConfigurationManager;
 
-namespace Terminal.Gui {
+namespace Terminal.Gui;
+
+/// <summary>
+/// The <see cref="Dialog"/> <see cref="View"/> is a <see cref="Window"/> that by default is centered and contains one 
+/// or more <see cref="Button"/>s. It defaults to the <see cref="Colors.Dialog"/> color scheme and has a 1 cell padding around the edges.
+/// </summary>
+/// <remarks>
+///  To run the <see cref="Dialog"/> modally, create the <see cref="Dialog"/>, and pass it to <see cref="Application.Run(Func{Exception, bool})"/>. 
+///  This will execute the dialog until it terminates via the [ESC] or [CTRL-Q] key, or when one of the views
+///  or buttons added to the dialog calls <see cref="Application.RequestStop"/>.
+/// </remarks>
+public class Dialog : Window {
 	/// <summary>
-	/// The <see cref="Dialog"/> <see cref="View"/> is a <see cref="Window"/> that by default is centered and contains one 
-	/// or more <see cref="Button"/>s. It defaults to the <see cref="Colors.Dialog"/> color scheme and has a 1 cell padding around the edges.
+	/// The default <see cref="ButtonAlignments"/> for <see cref="Dialog"/>. 
 	/// </summary>
 	/// <remarks>
-	///  To run the <see cref="Dialog"/> modally, create the <see cref="Dialog"/>, and pass it to <see cref="Application.Run(Func{Exception, bool})"/>. 
-	///  This will execute the dialog until it terminates via the [ESC] or [CTRL-Q] key, or when one of the views
-	///  or buttons added to the dialog calls <see cref="Application.RequestStop"/>.
+	/// This property can be set in a Theme.
 	/// </remarks>
-	public class Dialog : Window {
-		/// <summary>
-		/// The default <see cref="ButtonAlignments"/> for <see cref="Dialog"/>. 
-		/// </summary>
-		/// <remarks>
-		/// This property can be set in a Theme.
-		/// </remarks>
-		[SerializableConfigurationProperty (Scope = typeof (ThemeScope)), JsonConverter (typeof (JsonStringEnumConverter))]
-		public static ButtonAlignments DefaultButtonAlignment { get; set; } = ButtonAlignments.Center;
-
-		// TODO: Reenable once border/borderframe design is settled
-		/// <summary>
-		/// Defines the default border styling for <see cref="Dialog"/>. Can be configured via <see cref="ConfigurationManager"/>.
-		/// </summary>
-		//[SerializableConfigurationProperty (Scope = typeof (ThemeScope))]
-		//public static Border DefaultBorder { get; set; } = new Border () {
-		//	LineStyle = LineStyle.Single,
-		//};
+	[SerializableConfigurationProperty (Scope = typeof (ThemeScope))] [JsonConverter (typeof (JsonStringEnumConverter))]
+	public static ButtonAlignments DefaultButtonAlignment { get; set; } = ButtonAlignments.Center;
 
-		internal List<Button> buttons = new List<Button> ();
+	// TODO: Reenable once border/borderframe design is settled
+	/// <summary>
+	/// Defines the default border styling for <see cref="Dialog"/>. Can be configured via <see cref="ConfigurationManager"/>.
+	/// </summary>
+	//[SerializableConfigurationProperty (Scope = typeof (ThemeScope))]
+	//public static Border DefaultBorder { get; set; } = new Border () {
+	//	LineStyle = LineStyle.Single,
+	//};
+	internal List<Button> buttons = new ();
 
-		/// <summary>
-		/// Initializes a new instance of the <see cref="Dialog"/> class using <see cref="LayoutStyle.Computed"/> positioning 
-		/// with no <see cref="Button"/>s.
-		/// </summary>
-		/// <remarks>
-		/// By default, <see cref="View.X"/> and <see cref="View.Y"/> are set to <c>Pos.Center ()</c> and <see cref="View.Width"/> and <see cref="View.Height"/> are set 
-		/// to <c>Width = Dim.Percent (85)</c>, centering the Dialog vertically and horizontally. 
-		/// </remarks>
-		public Dialog () : this (null) { }
+	/// <summary>
+	/// Initializes a new instance of the <see cref="Dialog"/> class using <see cref="LayoutStyle.Computed"/> positioning 
+	/// with no <see cref="Button"/>s.
+	/// </summary>
+	/// <remarks>
+	/// By default, <see cref="View.X"/> and <see cref="View.Y"/> are set to <c>Pos.Center ()</c> and <see cref="View.Width"/> and <see cref="View.Height"/> are set 
+	/// to <c>Width = Dim.Percent (85)</c>, centering the Dialog vertically and horizontally. 
+	/// </remarks>
+	public Dialog () : this (null) { }
 
-		/// <summary>
-		/// Initializes a new instance of the <see cref="Dialog"/> class using <see cref="LayoutStyle.Computed"/> positioning 
-		/// and an optional set of <see cref="Button"/>s to display
-		/// </summary>
-		/// <param name="buttons">Optional buttons to lay out at the bottom of the dialog.</param>
-		/// <remarks>
-		/// By default, <see cref="View.X"/> and <see cref="View.Y"/> are set to <c>Pos.Center ()</c> and <see cref="View.Width"/> and <see cref="View.Height"/> are set 
-		/// to <c>Width = Dim.Percent (85)</c>, centering the Dialog vertically and horizontally. 
-		/// </remarks>
-		public Dialog (params Button [] buttons) : base ()
-		{
-			SetInitialProperties (buttons);
-		}
+	/// <summary>
+	/// Initializes a new instance of the <see cref="Dialog"/> class using <see cref="LayoutStyle.Computed"/> positioning 
+	/// and an optional set of <see cref="Button"/>s to display
+	/// </summary>
+	/// <param name="buttons">Optional buttons to lay out at the bottom of the dialog.</param>
+	/// <remarks>
+	/// By default, <see cref="View.X"/> and <see cref="View.Y"/> are set to <c>Pos.Center ()</c> and <see cref="View.Width"/> and <see cref="View.Height"/> are set 
+	/// to <c>Width = Dim.Percent (85)</c>, centering the Dialog vertically and horizontally. 
+	/// </remarks>
+	public Dialog (params Button [] buttons) : base () => SetInitialProperties (buttons);
 
-		private void SetInitialProperties (Button [] buttons)
-		{
-			X = Pos.Center ();
-			Y = Pos.Center ();
+	void SetInitialProperties (Button [] buttons)
+	{
+		//X = Pos.Center ();
+		//Y = Pos.Center ();
 
-			Width = Dim.Percent (85);
-			Height = Dim.Percent (85);
+		Width = Dim.Auto ();//Percent (85);
+		Height = Dim.Auto ();//Percent (85);
 
-			ColorScheme = Colors.Dialog;
+		ColorScheme = Colors.Dialog;
 
-			Modal = true;
-			ButtonAlignment = DefaultButtonAlignment;
+		Modal = true;
+		ButtonAlignment = DefaultButtonAlignment;
 
-			if (buttons != null) {
-				foreach (var b in buttons) {
-					AddButton (b);
-				}
+		if (buttons != null) {
+			foreach (var b in buttons) {
+				AddButton (b);
 			}
+		}
 
-			LayoutComplete += (s, args) => {
-				LayoutButtons ();
-			};
+		LayoutComplete += (s, args) => {
+			LayoutButtons ();
+		};
 
-		}
+	}
 
-		/// <summary>
-		/// Adds a <see cref="Button"/> to the <see cref="Dialog"/>, its layout will be controlled by the <see cref="Dialog"/>
-		/// </summary>
-		/// <param name="button">Button to add.</param>
-		public void AddButton (Button button)
-		{
-			if (button == null) {
-				return;
-			}
+	/// <summary>
+	/// Adds a <see cref="Button"/> to the <see cref="Dialog"/>, its layout will be controlled by the <see cref="Dialog"/>
+	/// </summary>
+	/// <param name="button">Button to add.</param>
+	public void AddButton (Button button)
+	{
+		if (button == null) {
+			return;
+		}
 
-			//button.AutoSize = false; // BUGBUG: v2 - Hack to get around autosize not accounting for Margin?
-			buttons.Add (button);
-			Add (button);
-			SetNeedsDisplay ();
-			if (IsInitialized) {
-				LayoutSubviews ();
-			}
+		//button.AutoSize = false; // BUGBUG: v2 - Hack to get around autosize not accounting for Margin?
+		buttons.Add (button);
+		Add (button);
+		SetNeedsDisplay ();
+		if (IsInitialized) {
+			LayoutSubviews ();
 		}
+	}
 
-		// Get the width of all buttons, not including any Margin.
-		internal int GetButtonsWidth ()
-		{
-			if (buttons.Count == 0) {
-				return 0;
-			}
-			//var widths = buttons.Select (b => b.TextFormatter.GetFormattedSize ().Width + b.BorderFrame.Thickness.Horizontal + b.Padding.Thickness.Horizontal);
-			var widths = buttons.Select (b => b.Frame.Width);
-			return widths.Sum ();
+	// Get the width of all buttons, not including any Margin.
+	internal int GetButtonsWidth ()
+	{
+		if (buttons.Count == 0) {
+			return 0;
 		}
+		//var widths = buttons.Select (b => b.TextFormatter.GetFormattedSize ().Width + b.BorderFrame.Thickness.Horizontal + b.Padding.Thickness.Horizontal);
+		var widths = buttons.Select (b => b.Frame.Width);
+		return widths.Sum ();
+	}
 
+	/// <summary>
+	/// Determines the horizontal alignment of the Dialog buttons.
+	/// </summary>
+	public enum ButtonAlignments {
 		/// <summary>
-		/// Determines the horizontal alignment of the Dialog buttons.
+		/// Center-aligns the buttons (the default).
 		/// </summary>
-		public enum ButtonAlignments {
-			/// <summary>
-			/// Center-aligns the buttons (the default).
-			/// </summary>
-			Center = 0,
-
-			/// <summary>
-			/// Justifies the buttons
-			/// </summary>
-			Justify,
-
-			/// <summary>
-			/// Left-aligns the buttons
-			/// </summary>
-			Left,
-
-			/// <summary>
-			/// Right-aligns the buttons
-			/// </summary>
-			Right
-		}
+		Center = 0,
 
 		/// <summary>
-		/// Determines how the <see cref="Dialog"/> <see cref="Button"/>s are aligned along the 
-		/// bottom of the dialog. 
+		/// Justifies the buttons
 		/// </summary>
-		public ButtonAlignments ButtonAlignment { get; set; }
-
-		void LayoutButtons ()
-		{
-			if (buttons.Count == 0 || !IsInitialized) return;
-
-			int shiftLeft = 0;
-
-			int buttonsWidth = GetButtonsWidth ();
-			switch (ButtonAlignment) {
-			case ButtonAlignments.Center:
-				// Center Buttons
-				shiftLeft = (Bounds.Width - buttonsWidth - buttons.Count - 1) / 2 + 1;
-				for (int i = buttons.Count - 1; i >= 0; i--) {
-					Button button = buttons [i];
-					shiftLeft += button.Frame.Width + (i == buttons.Count - 1 ? 0 : 1);
-					if (shiftLeft > -1) {
-						button.X = Pos.AnchorEnd (shiftLeft);
-					} else {
-						button.X = Bounds.Width - shiftLeft;
-					}
-					button.Y = Pos.AnchorEnd (1);
+		Justify,
+
+		/// <summary>
+		/// Left-aligns the buttons
+		/// </summary>
+		Left,
+
+		/// <summary>
+		/// Right-aligns the buttons
+		/// </summary>
+		Right
+	}
+
+	/// <summary>
+	/// Determines how the <see cref="Dialog"/> <see cref="Button"/>s are aligned along the 
+	/// bottom of the dialog. 
+	/// </summary>
+	public ButtonAlignments ButtonAlignment { get; set; }
+
+	void LayoutButtons ()
+	{
+		if (buttons.Count == 0 || !IsInitialized) {
+			return;
+		}
+
+		int shiftLeft = 0;
+
+		int buttonsWidth = GetButtonsWidth ();
+		switch (ButtonAlignment) {
+		case ButtonAlignments.Center:
+			// Center Buttons
+			shiftLeft = (Bounds.Width - buttonsWidth - buttons.Count - 1) / 2 + 1;
+			for (int i = buttons.Count - 1; i >= 0; i--) {
+				var button = buttons [i];
+				shiftLeft += button.Frame.Width + (i == buttons.Count - 1 ? 0 : 1);
+				if (shiftLeft > -1) {
+					button.X = Pos.AnchorEnd (shiftLeft);
+				} else {
+					button.X = Bounds.Width - shiftLeft;
 				}
-				break;
+				button.Y = Pos.AnchorEnd (1);
+			}
+			break;
 
-			case ButtonAlignments.Justify:
-				// Justify Buttons
-				// leftmost and rightmost buttons are hard against edges. The rest are evenly spaced.
+		case ButtonAlignments.Justify:
+			// Justify Buttons
+			// leftmost and rightmost buttons are hard against edges. The rest are evenly spaced.
 
-				var spacing = (int)Math.Ceiling ((double)(Bounds.Width - buttonsWidth) / (buttons.Count - 1));
-				for (int i = buttons.Count - 1; i >= 0; i--) {
-					Button button = buttons [i];
-					if (i == buttons.Count - 1) {
-						shiftLeft += button.Frame.Width;
-						button.X = Pos.AnchorEnd (shiftLeft);
+			int spacing = (int)Math.Ceiling ((double)(Bounds.Width - buttonsWidth) / (buttons.Count - 1));
+			for (int i = buttons.Count - 1; i >= 0; i--) {
+				var button = buttons [i];
+				if (i == buttons.Count - 1) {
+					shiftLeft += button.Frame.Width;
+					button.X = Pos.AnchorEnd (shiftLeft);
+				} else {
+					if (i == 0) {
+						// first (leftmost) button 
+						int left = Bounds.Width;
+						button.X = Pos.AnchorEnd (left);
 					} else {
-						if (i == 0) {
-							// first (leftmost) button 
-							var left = Bounds.Width;
-							button.X = Pos.AnchorEnd (left);
-						} else {
-							shiftLeft += button.Frame.Width + (spacing);
-							button.X = Pos.AnchorEnd (shiftLeft);
-						}
+						shiftLeft += button.Frame.Width + spacing;
+						button.X = Pos.AnchorEnd (shiftLeft);
 					}
-					button.Y = Pos.AnchorEnd (1);
-				}
-				break;
-
-			case ButtonAlignments.Left:
-				// Left Align Buttons
-				var prevButton = buttons [0];
-				prevButton.X = 0;
-				prevButton.Y = Pos.AnchorEnd (1);
-				for (int i = 1; i < buttons.Count; i++) {
-					Button button = buttons [i];
-					button.X = Pos.Right (prevButton) + 1;
-					button.Y = Pos.AnchorEnd (1);
-					prevButton = button;
-				}
-				break;
-
-			case ButtonAlignments.Right:
-				// Right align buttons
-				shiftLeft = buttons [buttons.Count - 1].Frame.Width;
-				buttons [buttons.Count - 1].X = Pos.AnchorEnd (shiftLeft);
-				buttons [buttons.Count - 1].Y = Pos.AnchorEnd (1);
-				for (int i = buttons.Count - 2; i >= 0; i--) {
-					Button button = buttons [i];
-					shiftLeft += button.Frame.Width + 1;
-					button.X = Pos.AnchorEnd (shiftLeft);
-					button.Y = Pos.AnchorEnd (1);
 				}
-				break;
+				button.Y = Pos.AnchorEnd (1);
 			}
+			break;
+
+		case ButtonAlignments.Left:
+			// Left Align Buttons
+			var prevButton = buttons [0];
+			prevButton.X = 0;
+			prevButton.Y = Pos.AnchorEnd (1);
+			for (int i = 1; i < buttons.Count; i++) {
+				var button = buttons [i];
+				button.X = Pos.Right (prevButton) + 1;
+				button.Y = Pos.AnchorEnd (1);
+				prevButton = button;
+			}
+			break;
+
+		case ButtonAlignments.Right:
+			// Right align buttons
+			shiftLeft = buttons [buttons.Count - 1].Frame.Width;
+			buttons [buttons.Count - 1].X = Pos.AnchorEnd (shiftLeft);
+			buttons [buttons.Count - 1].Y = Pos.AnchorEnd (1);
+			for (int i = buttons.Count - 2; i >= 0; i--) {
+				var button = buttons [i];
+				shiftLeft += button.Frame.Width + 1;
+				button.X = Pos.AnchorEnd (shiftLeft);
+				button.Y = Pos.AnchorEnd (1);
+			}
+			break;
 		}
+	}
 
-		// BUGBUG: Why is this not handled by a key binding???
-		///<inheritdoc/>
-		public override bool OnProcessKeyDown (Key a)
-		{
-			switch (a.KeyCode) {
-			case KeyCode.Esc:
-				Application.RequestStop (this);
-				return true;
-			}
-			return false;
+	// BUGBUG: Why is this not handled by a key binding???
+	///<inheritdoc/>
+	public override bool OnProcessKeyDown (Key a)
+	{
+		switch (a.KeyCode) {
+		case KeyCode.Esc:
+			Application.RequestStop (this);
+			return true;
 		}
+		return false;
 	}
-}
+}

+ 33 - 32
Terminal.Gui/Views/MessageBox.cs

@@ -265,17 +265,17 @@ namespace Terminal.Gui {
 			d = new Dialog (buttonList.ToArray ()) {
 				Title = title,
 				BorderStyle = DefaultBorderStyle,
-				Width = Dim.Percent (60),
-				Height = 5 // Border + one line of text + vspace + buttons
+				//Width = Dim.AutoSize (),//Percent (60),
+				//Height = Dim.AutoSize () //5 // Border + one line of text + vspace + buttons
 			};
 
-			if (width != 0) {
-				d.Width = width;
-			}
+			//if (width != 0) {
+			//	d.Width = width;
+			//}
 
-			if (height != 0) {
-				d.Height = height;
-			}
+			//if (height != 0) {
+			//	d.Height = height;
+			//}
 
 			if (useErrorColors) {
 				d.ColorScheme = Colors.Error;
@@ -284,41 +284,42 @@ namespace Terminal.Gui {
 			}
 
 			var messageLabel = new Label () {
-				AutoSize = wrapMessage ? false : true,
+				AutoSize = false,//wrapMessage ? false : true,
 				Text = message,
 				TextAlignment = TextAlignment.Centered,
 				X = 0,
 				Y = 0,
 				Width = Dim.Fill (0),
-				Height = Dim.Fill (1)
+				Height = Dim.Fill (1),
+				ColorScheme = Colors.Base
 			};
 			messageLabel.TextFormatter.WordWrap = wrapMessage;
 			messageLabel.TextFormatter.MultiLine = wrapMessage ? false : true;
 			d.Add (messageLabel);
 
-			d.Loaded += (s, e) => {
-				if (width != 0 || height != 0) {
-					return;
-				}
-				// TODO: replace with Dim.Fit when implemented
-				var maxBounds = d.SuperView?.Bounds ?? Application.Top.Bounds;
-				if (wrapMessage) {
-					messageLabel.TextFormatter.Size = new Size (maxBounds.Size.Width - d.GetFramesThickness ().Horizontal, maxBounds.Size.Height - d.GetFramesThickness ().Vertical);
-				} 
-				var msg = messageLabel.TextFormatter.Format ();
-				var messageSize = messageLabel.TextFormatter.GetFormattedSize ();
+			//d.Loaded += (s, e) => {
+			//	if (width != 0 || height != 0) {
+			//		return;
+			//	}
+			//	// TODO: replace with Dim.Fit when implemented
+			//	var maxBounds = d.SuperView?.Bounds ?? Application.Top.Bounds;
+			//	if (wrapMessage) {
+			//		messageLabel.TextFormatter.Size = new Size (maxBounds.Size.Width - d.GetFramesThickness ().Horizontal, maxBounds.Size.Height - d.GetFramesThickness ().Vertical);
+			//	} 
+			//	var msg = messageLabel.TextFormatter.Format ();
+			//	var messageSize = messageLabel.TextFormatter.GetFormattedSize ();
 
-				// Ensure the width fits the text + buttons
-				var newWidth = Math.Max (width, Math.Max (messageSize.Width + d.GetFramesThickness ().Horizontal,
-								d.GetButtonsWidth () + d.buttons.Count + d.GetFramesThickness ().Horizontal));
-				if (newWidth > d.Frame.Width) {
-					d.Width = newWidth;
-				}
-				// Ensure height fits the text + vspace + buttons
-				var lastLine = messageLabel.TextFormatter.Lines [^1];
-				d.Height = Math.Max (height, messageSize.Height + (lastLine.EndsWith ("\r\n") || lastLine.EndsWith ('\n') ? 1 : 2) + d.GetFramesThickness ().Vertical);
-				d.SetRelativeLayout (d.SuperView?.Frame ?? Application.Top.Frame);
-			};
+			//	// Ensure the width fits the text + buttons
+			//	var newWidth = Math.Max (width, Math.Max (messageSize.Width + d.GetFramesThickness ().Horizontal,
+			//					d.GetButtonsWidth () + d.buttons.Count + d.GetFramesThickness ().Horizontal));
+			//	if (newWidth > d.Frame.Width) {
+			//		d.Width = newWidth;
+			//	}
+			//	// Ensure height fits the text + vspace + buttons
+			//	var lastLine = messageLabel.TextFormatter.Lines [^1];
+			//	d.Height = Math.Max (height, messageSize.Height + (lastLine.EndsWith ("\r\n") || lastLine.EndsWith ('\n') ? 1 : 2) + d.GetFramesThickness ().Vertical);
+			//	d.SetRelativeLayout (d.SuperView?.Frame ?? Application.Top.Frame);
+			//};
 
 			// Setup actions
 			Clicked = -1;

+ 3 - 3
UICatalog/Scenarios/Dialogs.cs

@@ -15,7 +15,7 @@ namespace UICatalog.Scenarios {
 				X = Pos.Center (),
 				Y = 1,
 				Width = Dim.Percent (75),
-				Height = Dim.AutoSize ()
+				Height = Dim.Auto ()
 			};
 
 			var label = new Label ("Width:") {
@@ -204,7 +204,7 @@ namespace UICatalog.Scenarios {
 
 				var add = new Button ("Add a button") {
 					X = Pos.Center (),
-					Y = Pos.Center ()
+					Y = 10//Pos.Center ()
 				};
 				add.Clicked += (s, e) => {
 					var buttonId = buttons.Count;
@@ -231,7 +231,7 @@ namespace UICatalog.Scenarios {
 
 				var addChar = new Button ($"Add a {Char.ConvertFromUtf32 (CODE_POINT)} to each button") {
 					X = Pos.Center (),
-					Y = Pos.Center () + 1
+					Y = 11//Pos.Center () + 1
 				};
 				addChar.Clicked += (s, e) => {
 					foreach (var button in buttons) {

+ 2 - 2
UICatalog/Scenarios/DimAutoSize.cs

@@ -56,8 +56,8 @@ public class DimAutoSize : Scenario {
 			Title = "Type in the TextField to make it grow.",
 			X = 3,
 			Y = 3,
-			Width = Dim.AutoSize (),
-			Height = Dim.AutoSize ()
+			Width = Dim.Auto (),
+			Height = Dim.Auto ()
 		};
 
 		view.Add (textField, label, button);

+ 2 - 2
UICatalog/Scenarios/Frames.cs

@@ -52,8 +52,8 @@ namespace UICatalog.Scenarios {
 
 			public FrameEditor ()
 			{
-				Height = Dim.AutoSize ();
-				Width = Dim.AutoSize ();
+				Height = Dim.Auto ();
+				Width = Dim.Auto ();
 				Margin.Thickness = new Thickness (0);
 				BorderStyle = LineStyle.Double;
 				Initialized += FrameEditor_Initialized; ;

+ 1 - 1
UICatalog/Scenarios/MessageBoxes.cs

@@ -14,7 +14,7 @@ namespace UICatalog.Scenarios {
 				X = Pos.Center (),
 				Y = 1,
 				Width = Dim.Percent (75),
-				Height = Dim.AutoSize ()
+				Height = Dim.Auto ()
 			};
 			Win.Add (frame);