Browse Source

Fixes #3186. HotKeys must be explicitly set (Makes `TextFormatter.FindHotKey` `firstUpperCase` default to `false`) (#3187)

* Removed resharper settings from editorconfig

* Fixed FileDialog, Button, and Checkbox

* Fixed RadioGroup

* code cleanup

* Fixed Unicode Scenario

* Fixed nonBMP bug in DrawHotString

* Fixed nonBMP bug in DrawHotString

* Fixed AllViewsTester and Buttons

* Fixed Dialogs & MessageBoxes

* API docs
Tig 1 year ago
parent
commit
1df8ae15bb

+ 7 - 7
Terminal.Gui/Resources/Strings.Designer.cs

@@ -61,7 +61,7 @@ namespace Terminal.Gui.Resources {
         }
         }
         
         
         /// <summary>
         /// <summary>
-        ///   Looks up a localized string similar to Cancel.
+        ///   Looks up a localized string similar to _Cancel.
         /// </summary>
         /// </summary>
         internal static string btnCancel {
         internal static string btnCancel {
             get {
             get {
@@ -70,7 +70,7 @@ namespace Terminal.Gui.Resources {
         }
         }
         
         
         /// <summary>
         /// <summary>
-        ///   Looks up a localized string similar to No.
+        ///   Looks up a localized string similar to _No.
         /// </summary>
         /// </summary>
         internal static string btnNo {
         internal static string btnNo {
             get {
             get {
@@ -79,7 +79,7 @@ namespace Terminal.Gui.Resources {
         }
         }
         
         
         /// <summary>
         /// <summary>
-        ///   Looks up a localized string similar to OK.
+        ///   Looks up a localized string similar to _OK.
         /// </summary>
         /// </summary>
         internal static string btnOk {
         internal static string btnOk {
             get {
             get {
@@ -88,7 +88,7 @@ namespace Terminal.Gui.Resources {
         }
         }
         
         
         /// <summary>
         /// <summary>
-        ///   Looks up a localized string similar to Open.
+        ///   Looks up a localized string similar to O_pen.
         /// </summary>
         /// </summary>
         internal static string btnOpen {
         internal static string btnOpen {
             get {
             get {
@@ -97,7 +97,7 @@ namespace Terminal.Gui.Resources {
         }
         }
         
         
         /// <summary>
         /// <summary>
-        ///   Looks up a localized string similar to Save.
+        ///   Looks up a localized string similar to _Save.
         /// </summary>
         /// </summary>
         internal static string btnSave {
         internal static string btnSave {
             get {
             get {
@@ -106,7 +106,7 @@ namespace Terminal.Gui.Resources {
         }
         }
         
         
         /// <summary>
         /// <summary>
-        ///   Looks up a localized string similar to Save as.
+        ///   Looks up a localized string similar to Save _as.
         /// </summary>
         /// </summary>
         internal static string btnSaveAs {
         internal static string btnSaveAs {
             get {
             get {
@@ -115,7 +115,7 @@ namespace Terminal.Gui.Resources {
         }
         }
         
         
         /// <summary>
         /// <summary>
-        ///   Looks up a localized string similar to Yes.
+        ///   Looks up a localized string similar to _Yes.
         /// </summary>
         /// </summary>
         internal static string btnYes {
         internal static string btnYes {
             get {
             get {

+ 7 - 7
Terminal.Gui/Resources/Strings.resx

@@ -227,7 +227,7 @@
     <value>New Folder</value>
     <value>New Folder</value>
   </data>
   </data>
   <data name="btnNo" xml:space="preserve">
   <data name="btnNo" xml:space="preserve">
-    <value>No</value>
+    <value>_No</value>
   </data>
   </data>
   <data name="fdRenameFailedTitle" xml:space="preserve">
   <data name="fdRenameFailedTitle" xml:space="preserve">
     <value>Rename Failed</value>
     <value>Rename Failed</value>
@@ -239,25 +239,25 @@
     <value>Rename</value>
     <value>Rename</value>
   </data>
   </data>
   <data name="btnYes" xml:space="preserve">
   <data name="btnYes" xml:space="preserve">
-    <value>Yes</value>
+    <value>_Yes</value>
   </data>
   </data>
   <data name="fdExisting" xml:space="preserve">
   <data name="fdExisting" xml:space="preserve">
     <value>Existing</value>
     <value>Existing</value>
   </data>
   </data>
   <data name="btnOpen" xml:space="preserve">
   <data name="btnOpen" xml:space="preserve">
-    <value>Open</value>
+    <value>O_pen</value>
   </data>
   </data>
   <data name="btnSave" xml:space="preserve">
   <data name="btnSave" xml:space="preserve">
-    <value>Save</value>
+    <value>_Save</value>
   </data>
   </data>
   <data name="btnSaveAs" xml:space="preserve">
   <data name="btnSaveAs" xml:space="preserve">
-    <value>Save as</value>
+    <value>Save _as</value>
   </data>
   </data>
   <data name="btnOk" xml:space="preserve">
   <data name="btnOk" xml:space="preserve">
-    <value>OK</value>
+    <value>_OK</value>
   </data>
   </data>
   <data name="btnCancel" xml:space="preserve">
   <data name="btnCancel" xml:space="preserve">
-    <value>Cancel</value>
+    <value>_Cancel</value>
   </data>
   </data>
   <data name="fdCtxDelete" xml:space="preserve">
   <data name="fdCtxDelete" xml:space="preserve">
     <value>_Delete</value>
     <value>_Delete</value>

+ 7 - 5
Terminal.Gui/Text/TextFormatter.cs

@@ -960,12 +960,14 @@ namespace Terminal.Gui {
 		/// </summary>
 		/// </summary>
 		/// <param name="text">The text to look in.</param>
 		/// <param name="text">The text to look in.</param>
 		/// <param name="hotKeySpecifier">The HotKey specifier (e.g. '_') to look for.</param>
 		/// <param name="hotKeySpecifier">The HotKey specifier (e.g. '_') to look for.</param>
-		/// <param name="firstUpperCase">If <c>true</c> the legacy behavior of identifying the first upper case character as the HotKey will be enabled.
-		/// Regardless of the value of this parameter, <c>hotKeySpecifier</c> takes precedence.</param>
 		/// <param name="hotPos">Outputs the Rune index into <c>text</c>.</param>
 		/// <param name="hotPos">Outputs the Rune index into <c>text</c>.</param>
 		/// <param name="hotKey">Outputs the hotKey. <see cref="Key.Empty"/> if not found.</param>
 		/// <param name="hotKey">Outputs the hotKey. <see cref="Key.Empty"/> if not found.</param>
+		/// <param name="firstUpperCase">If <c>true</c> the legacy behavior of identifying the
+		/// first upper case character as the HotKey will be enabled.
+		/// Regardless of the value of this parameter, <c>hotKeySpecifier</c> takes precedence.
+		/// Defaults to <see langword="false"/>.</param>
 		/// <returns><c>true</c> if a HotKey was found; <c>false</c> otherwise.</returns>
 		/// <returns><c>true</c> if a HotKey was found; <c>false</c> otherwise.</returns>
-		public static bool FindHotKey (string text, Rune hotKeySpecifier, bool firstUpperCase, out int hotPos, out Key hotKey)
+		public static bool FindHotKey (string text, Rune hotKeySpecifier, out int hotPos, out Key hotKey, bool firstUpperCase = false)
 		{
 		{
 			if (string.IsNullOrEmpty (text) || hotKeySpecifier == (Rune)0xFFFF) {
 			if (string.IsNullOrEmpty (text) || hotKeySpecifier == (Rune)0xFFFF) {
 				hotPos = -1;
 				hotPos = -1;
@@ -1328,7 +1330,7 @@ namespace Terminal.Gui {
 
 
 				if (NeedsFormat) {
 				if (NeedsFormat) {
 					var shown_text = _text;
 					var shown_text = _text;
-					if (FindHotKey (_text, HotKeySpecifier, true, out _hotKeyPos, out var newHotKey)) {
+					if (FindHotKey (_text, HotKeySpecifier, out _hotKeyPos, out var newHotKey)) {
 						HotKey = newHotKey;
 						HotKey = newHotKey;
 						shown_text = RemoveHotKeySpecifier (Text, _hotKeyPos, HotKeySpecifier);
 						shown_text = RemoveHotKeySpecifier (Text, _hotKeyPos, HotKeySpecifier);
 						shown_text = ReplaceHotKeyWithTag (shown_text, _hotKeyPos);
 						shown_text = ReplaceHotKeyWithTag (shown_text, _hotKeyPos);
@@ -1412,7 +1414,7 @@ namespace Terminal.Gui {
 			foreach (var line in Lines) {
 			foreach (var line in Lines) {
 				sb.AppendLine (line);
 				sb.AppendLine (line);
 			}
 			}
-			return sb.ToString ();
+			return sb.ToString ().TrimEnd (Environment.NewLine.ToCharArray ());
 		}
 		}
 
 
 		/// <summary>
 		/// <summary>

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

@@ -299,8 +299,8 @@ public partial class View {
 	{
 	{
 		var hotkeySpec = HotKeySpecifier == (Rune)0xffff ? (Rune)'_' : HotKeySpecifier;
 		var hotkeySpec = HotKeySpecifier == (Rune)0xffff ? (Rune)'_' : HotKeySpecifier;
 		Application.Driver.SetAttribute (normalColor);
 		Application.Driver.SetAttribute (normalColor);
-		foreach (var rune in text) {
-			if (rune == hotkeySpec.Value) {
+		foreach (var rune in text.EnumerateRunes ()) {
+			if (rune == new Rune(hotkeySpec.Value)) {
 				Application.Driver.SetAttribute (hotColor);
 				Application.Driver.SetAttribute (hotColor);
 				continue;
 				continue;
 			}
 			}

+ 1 - 1
Terminal.Gui/View/ViewKeyboard.cs

@@ -194,7 +194,7 @@ public partial class View {
 		if (TextFormatter == null || HotKeySpecifier == new Rune ('\xFFFF')) {
 		if (TextFormatter == null || HotKeySpecifier == new Rune ('\xFFFF')) {
 			return; // throw new InvalidOperationException ("Can't set HotKey unless a TextFormatter has been created");
 			return; // throw new InvalidOperationException ("Can't set HotKey unless a TextFormatter has been created");
 		}
 		}
-		if (TextFormatter.FindHotKey (_text, HotKeySpecifier, true, out _, out var hk)) {
+		if (TextFormatter.FindHotKey (_text, HotKeySpecifier, out _, out var hk)) {
 			if (_hotKey.KeyCode != hk) {
 			if (_hotKey.KeyCode != hk) {
 				HotKey = hk;
 				HotKey = hk;
 			}
 			}

+ 0 - 3
Terminal.Gui/Views/Button.cs

@@ -23,9 +23,6 @@ namespace Terminal.Gui;
 ///         Use <see cref="View.HotKeySpecifier"/> to change the hot key specifier from the default of ('_').
 ///         Use <see cref="View.HotKeySpecifier"/> to change the hot key specifier from the default of ('_').
 ///         </para>
 ///         </para>
 ///         <para>
 ///         <para>
-///         If no hot key specifier is found, the first uppercase letter encountered will be used as the hot key.
-///         </para>
-///         <para>
 ///         When the button is configured as the default (<see cref="IsDefault"/>) and the user presses
 ///         When the button is configured as the default (<see cref="IsDefault"/>) and the user presses
 ///         the ENTER key, if no other <see cref="View"/> processes the key, the <see cref="Button"/>'s
 ///         the ENTER key, if no other <see cref="View"/> processes the key, the <see cref="Button"/>'s
 ///         <see cref="Clicked"/> event will will be fired.
 ///         <see cref="Clicked"/> event will will be fired.

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

@@ -170,14 +170,14 @@ public class RadioGroup : View {
 		set {
 		set {
 			// Remove old hot key bindings
 			// Remove old hot key bindings
 			foreach (var label in _radioLabels) {
 			foreach (var label in _radioLabels) {
-				if (TextFormatter.FindHotKey (label, HotKeySpecifier, true, out _, out var hotKey)) {
+				if (TextFormatter.FindHotKey (label, HotKeySpecifier, out _, out var hotKey)) {
 					AddKeyBindingsForHotKey (hotKey, KeyCode.Null);
 					AddKeyBindingsForHotKey (hotKey, KeyCode.Null);
 				}
 				}
 			}
 			}
 			var prevCount = _radioLabels.Count;
 			var prevCount = _radioLabels.Count;
 			_radioLabels = value.ToList ();
 			_radioLabels = value.ToList ();
 			foreach (var label in _radioLabels) {
 			foreach (var label in _radioLabels) {
-				if (TextFormatter.FindHotKey (label, HotKeySpecifier, true, out _, out var hotKey)) {
+				if (TextFormatter.FindHotKey (label, HotKeySpecifier, out _, out var hotKey)) {
 					AddKeyBindingsForHotKey (KeyCode.Null, hotKey);
 					AddKeyBindingsForHotKey (KeyCode.Null, hotKey);
 				}
 				}
 			}
 			}
@@ -202,7 +202,7 @@ public class RadioGroup : View {
 		if (KeyBindings.TryGet (key, out _)) {
 		if (KeyBindings.TryGet (key, out _)) {
 			// Search RadioLabels 
 			// Search RadioLabels 
 			for (int i = 0; i < _radioLabels.Count; i++) {
 			for (int i = 0; i < _radioLabels.Count; i++) {
-				if (TextFormatter.FindHotKey (_radioLabels [i], HotKeySpecifier, true, out _, out var hotKey)
+				if (TextFormatter.FindHotKey (_radioLabels [i], HotKeySpecifier, out _, out var hotKey, true)
 					&& (key.NoAlt.NoCtrl.NoShift) == hotKey) {
 					&& (key.NoAlt.NoCtrl.NoShift) == hotKey) {
 					SelectedItem = i;
 					SelectedItem = i;
 					keyEvent.Scope = KeyBindingScope.HotKey;
 					keyEvent.Scope = KeyBindingScope.HotKey;
@@ -246,7 +246,7 @@ public class RadioGroup : View {
 			var rl = _radioLabels [i];
 			var rl = _radioLabels [i];
 			Driver.SetAttribute (GetNormalColor ());
 			Driver.SetAttribute (GetNormalColor ());
 			Driver.AddStr ($"{(i == _selected ? CM.Glyphs.Selected : CM.Glyphs.UnSelected)} ");
 			Driver.AddStr ($"{(i == _selected ? CM.Glyphs.Selected : CM.Glyphs.UnSelected)} ");
-			TextFormatter.FindHotKey (rl, HotKeySpecifier, true, out int hotPos, out var hotKey);
+			TextFormatter.FindHotKey (rl, HotKeySpecifier, out int hotPos, out var hotKey);
 			if (hotPos != -1 && (hotKey != KeyCode.Null)) {
 			if (hotPos != -1 && (hotKey != KeyCode.Null)) {
 				var rlRunes = rl.ToRunes ();
 				var rlRunes = rl.ToRunes ();
 				for (int j = 0; j < rlRunes.Length; j++) {
 				for (int j = 0; j < rlRunes.Length; j++) {

+ 3 - 4
UICatalog/Scenarios/Adornments.cs

@@ -5,8 +5,7 @@ using Terminal.Gui;
 namespace UICatalog.Scenarios;
 namespace UICatalog.Scenarios;
 
 
 [ScenarioMetadata ("Adornments Demo", "Demonstrates Margin, Border, and Padding on Views.")]
 [ScenarioMetadata ("Adornments Demo", "Demonstrates Margin, Border, and Padding on Views.")]
-[ScenarioCategory ("Layout")]
-[ScenarioCategory ("Borders")]
+[ScenarioCategory ("Layout"), ScenarioCategory ("Borders")]
 public class Adornments : Scenario {
 public class Adornments : Scenario {
 
 
 	public override void Init ()
 	public override void Init ()
@@ -193,7 +192,7 @@ public class Adornments : Scenario {
 			_bottomEdit.TextChanging += Edit_TextChanging;
 			_bottomEdit.TextChanging += Edit_TextChanging;
 			Add (_bottomEdit);
 			Add (_bottomEdit);
 
 
-			var copyTop = new Button ("Copy Top") {
+			var copyTop = new Button ("Cop_y Top") {
 				X = Pos.Center () + 1,
 				X = Pos.Center () + 1,
 				Y = Pos.Bottom (_bottomEdit)
 				Y = Pos.Bottom (_bottomEdit)
 			};
 			};
@@ -370,7 +369,7 @@ public class Adornments : Scenario {
 				Add (_paddingEditor);
 				Add (_paddingEditor);
 
 
 				_diagCheckBox = new CheckBox {
 				_diagCheckBox = new CheckBox {
-					Text = "Diagnostics",
+					Text = "_Diagnostics",
 					Y = Pos.Bottom (_paddingEditor)
 					Y = Pos.Bottom (_paddingEditor)
 				};
 				};
 				_diagCheckBox.Toggled += (s, e) => {
 				_diagCheckBox.Toggled += (s, e) => {

+ 39 - 44
UICatalog/Scenarios/AllViewsTester.cs

@@ -7,35 +7,36 @@ using Terminal.Gui;
 namespace UICatalog.Scenarios;
 namespace UICatalog.Scenarios;
 
 
 [ScenarioMetadata ("All Views Tester", "Provides a test UI for all classes derived from View.")]
 [ScenarioMetadata ("All Views Tester", "Provides a test UI for all classes derived from View.")]
-[ScenarioCategory ("Layout")]
-[ScenarioCategory ("Tests")]
-[ScenarioCategory ("Top Level Windows")]
+[ScenarioCategory ("Layout")] [ScenarioCategory ("Tests")] [ScenarioCategory ("Top Level Windows")]
 public class AllViewsTester : Scenario {
 public class AllViewsTester : Scenario {
-	FrameView _leftPane;
 	ListView _classListView;
 	ListView _classListView;
+	CheckBox _computedCheckBox;
+	View _curView;
+	readonly List<string> _dimNames = new () { "Factor", "Fill", "Absolute" };
 	FrameView _hostPane;
 	FrameView _hostPane;
+	RadioGroup _hRadioGroup;
+	TextField _hText;
+	int _hVal;
+	FrameView _leftPane;
+	FrameView _locationFrame;
 
 
-	Dictionary<string, Type> _viewClasses;
-	View _curView = null;
+	// TODO: This is missing some
+	readonly List<string> _posNames = new () { "Factor", "AnchorEnd", "Center", "Absolute" };
 
 
 	// Settings
 	// Settings
 	FrameView _settingsPane;
 	FrameView _settingsPane;
-	CheckBox _computedCheckBox;
-	FrameView _locationFrame;
+	FrameView _sizeFrame;
+
+	Dictionary<string, Type> _viewClasses;
+	RadioGroup _wRadioGroup;
+	TextField _wText;
+	int _wVal;
 	RadioGroup _xRadioGroup;
 	RadioGroup _xRadioGroup;
 	TextField _xText;
 	TextField _xText;
-	int _xVal = 0;
+	int _xVal;
 	RadioGroup _yRadioGroup;
 	RadioGroup _yRadioGroup;
 	TextField _yText;
 	TextField _yText;
-	int _yVal = 0;
-
-	FrameView _sizeFrame;
-	RadioGroup _wRadioGroup;
-	TextField _wText;
-	int _wVal = 0;
-	RadioGroup _hRadioGroup;
-	TextField _hText;
-	int _hVal = 0;
+	int _yVal;
 
 
 	public override void Init ()
 	public override void Init ()
 	{
 	{
@@ -62,9 +63,9 @@ public class AllViewsTester : Scenario {
 		Application.Top.Add (statusBar);
 		Application.Top.Add (statusBar);
 
 
 		_viewClasses = GetAllViewClassesCollection ()
 		_viewClasses = GetAllViewClassesCollection ()
-				.OrderBy (t => t.Name)
-				.Select (t => new KeyValuePair<string, Type> (t.Name, t))
-				.ToDictionary (t => t.Key, t => t.Value);
+			.OrderBy (t => t.Name)
+			.Select (t => new KeyValuePair<string, Type> (t.Name, t))
+			.ToDictionary (t => t.Key, t => t.Value);
 
 
 		_leftPane = new FrameView ("Classes") {
 		_leftPane = new FrameView ("Classes") {
 			X = 0,
 			X = 0,
@@ -78,8 +79,8 @@ public class AllViewsTester : Scenario {
 		_classListView = new ListView (_viewClasses.Keys.ToList ()) {
 		_classListView = new ListView (_viewClasses.Keys.ToList ()) {
 			X = 0,
 			X = 0,
 			Y = 0,
 			Y = 0,
-			Width = Dim.Fill (0),
-			Height = Dim.Fill (0),
+			Width = Dim.Fill (),
+			Height = Dim.Fill (),
 			AllowsMarking = false,
 			AllowsMarking = false,
 			ColorScheme = Colors.ColorSchemes ["TopLevel"],
 			ColorScheme = Colors.ColorSchemes ["TopLevel"],
 			SelectedItem = 0
 			SelectedItem = 0
@@ -108,7 +109,7 @@ public class AllViewsTester : Scenario {
 			CanFocus = false,
 			CanFocus = false,
 			ColorScheme = Colors.ColorSchemes ["TopLevel"]
 			ColorScheme = Colors.ColorSchemes ["TopLevel"]
 		};
 		};
-		_computedCheckBox = new CheckBox ("Computed Layout", true) { X = 0, Y = 0 };
+		_computedCheckBox = new CheckBox ("_Computed Layout", true) { X = 0, Y = 0 };
 		_computedCheckBox.Toggled += (s, e) => {
 		_computedCheckBox.Toggled += (s, e) => {
 			if (_curView != null) {
 			if (_curView != null) {
 				_hostPane.LayoutSubviews ();
 				_hostPane.LayoutSubviews ();
@@ -116,7 +117,7 @@ public class AllViewsTester : Scenario {
 		};
 		};
 		_settingsPane.Add (_computedCheckBox);
 		_settingsPane.Add (_computedCheckBox);
 
 
-		string [] radioItems = new string [] { "Percent(x)", "AnchorEnd(x)", "Center", "At(x)" };
+		string [] radioItems = { "_Percent(x)", "_AnchorEnd(x)", "_Center", "A_t(x)" };
 		_locationFrame = new FrameView ("Location (Pos)") {
 		_locationFrame = new FrameView ("Location (Pos)") {
 			X = Pos.Left (_computedCheckBox),
 			X = Pos.Left (_computedCheckBox),
 			Y = Pos.Bottom (_computedCheckBox),
 			Y = Pos.Bottom (_computedCheckBox),
@@ -125,7 +126,7 @@ public class AllViewsTester : Scenario {
 		};
 		};
 		_settingsPane.Add (_locationFrame);
 		_settingsPane.Add (_locationFrame);
 
 
-		var label = new Label ("x:") { X = 0, Y = 0 };
+		var label = new Label ("X:") { X = 0, Y = 0 };
 		_locationFrame.Add (label);
 		_locationFrame.Add (label);
 		_xRadioGroup = new RadioGroup (radioItems) {
 		_xRadioGroup = new RadioGroup (radioItems) {
 			X = 0,
 			X = 0,
@@ -143,8 +144,8 @@ public class AllViewsTester : Scenario {
 
 
 		_locationFrame.Add (_xRadioGroup);
 		_locationFrame.Add (_xRadioGroup);
 
 
-		radioItems = new string [] { "Percent(y)", "AnchorEnd(y)", "Center", "At(y)" };
-		label = new Label ("y:") { X = Pos.Right (_xRadioGroup) + 1, Y = 0 };
+		radioItems = new [] { "P_ercent(y)", "A_nchorEnd(y)", "C_enter", "At(_y)" };
+		label = new Label ("Y:") { X = Pos.Right (_xRadioGroup) + 1, Y = 0 };
 		_locationFrame.Add (label);
 		_locationFrame.Add (label);
 		_yText = new TextField ($"{_yVal}") { X = Pos.Right (label) + 1, Y = 0, Width = 4 };
 		_yText = new TextField ($"{_yVal}") { X = Pos.Right (label) + 1, Y = 0, Width = 4 };
 		_yText.TextChanged += (s, args) => {
 		_yText.TextChanged += (s, args) => {
@@ -168,8 +169,8 @@ public class AllViewsTester : Scenario {
 			Width = 40
 			Width = 40
 		};
 		};
 
 
-		radioItems = new string [] { "Percent(width)", "Fill(width)", "Sized(width)" };
-		label = new Label ("width:") { X = 0, Y = 0 };
+		radioItems = new [] { "_Percent(width)", "_Fill(width)", "_Sized(width)" };
+		label = new Label ("Width:") { X = 0, Y = 0 };
 		_sizeFrame.Add (label);
 		_sizeFrame.Add (label);
 		_wRadioGroup = new RadioGroup (radioItems) {
 		_wRadioGroup = new RadioGroup (radioItems) {
 			X = 0,
 			X = 0,
@@ -194,8 +195,8 @@ public class AllViewsTester : Scenario {
 		_sizeFrame.Add (_wText);
 		_sizeFrame.Add (_wText);
 		_sizeFrame.Add (_wRadioGroup);
 		_sizeFrame.Add (_wRadioGroup);
 
 
-		radioItems = new string [] { "Percent(height)", "Fill(height)", "Sized(height)" };
-		label = new Label ("height:") { X = Pos.Right (_wRadioGroup) + 1, Y = 0 };
+		radioItems = new [] { "P_ercent(height)", "F_ill(height)", "Si_zed(height)" };
+		label = new Label ("Height:") { X = Pos.Right (_wRadioGroup) + 1, Y = 0 };
 		_sizeFrame.Add (label);
 		_sizeFrame.Add (label);
 		_hText = new TextField ($"{_hVal}") { X = Pos.Right (label) + 1, Y = 0, Width = 4 };
 		_hText = new TextField ($"{_hVal}") { X = Pos.Right (label) + 1, Y = 0, Width = 4 };
 		_hText.TextChanged += (s, args) => {
 		_hText.TextChanged += (s, args) => {
@@ -278,27 +279,21 @@ public class AllViewsTester : Scenario {
 			};
 			};
 		} catch (Exception e) {
 		} catch (Exception e) {
 			MessageBox.ErrorQuery ("Exception", e.Message, "Ok");
 			MessageBox.ErrorQuery ("Exception", e.Message, "Ok");
-		} finally {
-			//view.LayoutStyle = layout;
 		}
 		}
 		UpdateTitle (view);
 		UpdateTitle (view);
 	}
 	}
 
 
-	// TODO: This is missing some
-	List<string> _posNames = new () { "Factor", "AnchorEnd", "Center", "Absolute" };
-	List<string> _dimNames = new () { "Factor", "Fill", "Absolute" };
-
 	void UpdateSettings (View view)
 	void UpdateSettings (View view)
 	{
 	{
-		string x = view.X.ToString ();
-		string y = view.Y.ToString ();
+		var x = view.X.ToString ();
+		var y = view.Y.ToString ();
 		_xRadioGroup.SelectedItem = _posNames.IndexOf (_posNames.Where (s => x.Contains (s)).First ());
 		_xRadioGroup.SelectedItem = _posNames.IndexOf (_posNames.Where (s => x.Contains (s)).First ());
 		_yRadioGroup.SelectedItem = _posNames.IndexOf (_posNames.Where (s => y.Contains (s)).First ());
 		_yRadioGroup.SelectedItem = _posNames.IndexOf (_posNames.Where (s => y.Contains (s)).First ());
 		_xText.Text = $"{view.Frame.X}";
 		_xText.Text = $"{view.Frame.X}";
 		_yText.Text = $"{view.Frame.Y}";
 		_yText.Text = $"{view.Frame.Y}";
 
 
-		string w = view.Width.ToString ();
-		string h = view.Height.ToString ();
+		var w = view.Width.ToString ();
+		var h = view.Height.ToString ();
 		_wRadioGroup.SelectedItem = _dimNames.IndexOf (_dimNames.Where (s => w.Contains (s)).First ());
 		_wRadioGroup.SelectedItem = _dimNames.IndexOf (_dimNames.Where (s => w.Contains (s)).First ());
 		_hRadioGroup.SelectedItem = _dimNames.IndexOf (_dimNames.Where (s => h.Contains (s)).First ());
 		_hRadioGroup.SelectedItem = _dimNames.IndexOf (_dimNames.Where (s => h.Contains (s)).First ());
 		_wText.Text = $"{view.Frame.Width}";
 		_wText.Text = $"{view.Frame.Width}";
@@ -311,7 +306,7 @@ public class AllViewsTester : Scenario {
 	{
 	{
 		var types = new List<Type> ();
 		var types = new List<Type> ();
 		foreach (var type in typeof (View).Assembly.GetTypes ()
 		foreach (var type in typeof (View).Assembly.GetTypes ()
-						.Where (myType => myType.IsClass && !myType.IsAbstract && myType.IsPublic && myType.IsSubclassOf (typeof (View)))) {
+			.Where (myType => myType.IsClass && !myType.IsAbstract && myType.IsPublic && myType.IsSubclassOf (typeof (View)))) {
 			types.Add (type);
 			types.Add (type);
 		}
 		}
 		types.Add (typeof (View));
 		types.Add (typeof (View));
@@ -364,7 +359,7 @@ public class AllViewsTester : Scenario {
 
 
 		// If the view supports a Source property, set it so we have something to look at
 		// If the view supports a Source property, set it so we have something to look at
 		if (view != null && view.GetType ().GetProperty ("Source") != null && view.GetType ().GetProperty ("Source").PropertyType == typeof (IListDataSource)) {
 		if (view != null && view.GetType ().GetProperty ("Source") != null && view.GetType ().GetProperty ("Source").PropertyType == typeof (IListDataSource)) {
-			var source = new ListWrapper (new List<string> () { "Test Text #1", "Test Text #2", "Test Text #3" });
+			var source = new ListWrapper (new List<string> { "Test Text #1", "Test Text #2", "Test Text #3" });
 			view?.GetType ().GetProperty ("Source")?.GetSetMethod ()?.Invoke (view, new [] { source });
 			view?.GetType ().GetProperty ("Source")?.GetSetMethod ()?.Invoke (view, new [] { source });
 		}
 		}
 
 

+ 5 - 6
UICatalog/Scenarios/Buttons.cs

@@ -3,8 +3,7 @@ using Terminal.Gui;
 
 
 namespace UICatalog.Scenarios;
 namespace UICatalog.Scenarios;
 [ScenarioMetadata (Name: "Buttons", Description: "Demonstrates all sorts of Buttons.")]
 [ScenarioMetadata (Name: "Buttons", Description: "Demonstrates all sorts of Buttons.")]
-[ScenarioCategory ("Controls")]
-[ScenarioCategory ("Layout")]
+[ScenarioCategory ("Controls"), ScenarioCategory ("Layout")]
 public class Buttons : Scenario {
 public class Buttons : Scenario {
 	public override void Setup ()
 	public override void Setup ()
 	{
 	{
@@ -32,7 +31,7 @@ public class Buttons : Scenario {
 		defaultButton.Clicked += (s, e) => Application.RequestStop ();
 		defaultButton.Clicked += (s, e) => Application.RequestStop ();
 		Win.Add (defaultButton);
 		Win.Add (defaultButton);
 
 
-		var swapButton = new Button (50, 0, "Swap Default (Absolute Layout)");
+		var swapButton = new Button (50, 0, "S_wap Default (Absolute Layout)");
 		swapButton.Clicked += (s, e) => {
 		swapButton.Clicked += (s, e) => {
 			defaultButton.IsDefault = !defaultButton.IsDefault;
 			defaultButton.IsDefault = !defaultButton.IsDefault;
 			swapButton.IsDefault = !swapButton.IsDefault;
 			swapButton.IsDefault = !swapButton.IsDefault;
@@ -58,7 +57,7 @@ public class Buttons : Scenario {
 		//With this method there is no need to call Application.TopReady += () => Application.TopRedraw (Top.Bounds);
 		//With this method there is no need to call Application.TopReady += () => Application.TopRedraw (Top.Bounds);
 		var x = Pos.Right (colorButtonsLabel) + 2;
 		var x = Pos.Right (colorButtonsLabel) + 2;
 		foreach (var colorScheme in Colors.ColorSchemes) {
 		foreach (var colorScheme in Colors.ColorSchemes) {
-			var colorButton = new Button ($"{colorScheme.Key}") {
+			var colorButton = new Button ($"_{colorScheme.Key}") {
 				ColorScheme = colorScheme.Value,
 				ColorScheme = colorScheme.Value,
 				//X = Pos.Right (prev) + 2,
 				//X = Pos.Right (prev) + 2,
 				X = x,
 				X = x,
@@ -119,7 +118,7 @@ public class Buttons : Scenario {
 		Win.Add (computedFrame);
 		Win.Add (computedFrame);
 
 
 		// Demonstrates how changing the View.Frame property can move Views
 		// Demonstrates how changing the View.Frame property can move Views
-		var moveBtn = new Button ("Move This \u263b Button _via Pos") {
+		var moveBtn = new Button ("Move This \u263b Button v_ia Pos") {
 			X = 0,
 			X = 0,
 			Y = Pos.Center () - 1,
 			Y = Pos.Center () - 1,
 			Width = 30,
 			Width = 30,
@@ -163,7 +162,7 @@ public class Buttons : Scenario {
 		absoluteFrame.Add (moveBtnA);
 		absoluteFrame.Add (moveBtnA);
 
 
 		// Demonstrates how changing the View.Frame property can SIZE Views (#583)
 		// Demonstrates how changing the View.Frame property can SIZE Views (#583)
-		var sizeBtnA = new Button (0, 2, " ~  s  gui.cs   master ↑10 = Со_хранить") {
+		var sizeBtnA = new Button (0, 2, " ~  s  gui.cs   master ↑_10 = Сохранить") {
 			ColorScheme = Colors.ColorSchemes ["Error"],
 			ColorScheme = Colors.ColorSchemes ["Error"],
 		};
 		};
 		sizeBtnA.Clicked += (s, e) => {
 		sizeBtnA.Clicked += (s, e) => {

+ 5 - 6
UICatalog/Scenarios/Dialogs.cs

@@ -108,14 +108,14 @@ namespace UICatalog.Scenarios {
 			};
 			};
 			frame.Add (label);
 			frame.Add (label);
 
 
-			var styleRadioGroup = new RadioGroup (new string [] { "Center", "Justify", "Left", "Right" }) {
+			var styleRadioGroup = new RadioGroup (new string [] { "_Center", "_Justify", "_Left", "_Right" }) {
 				X = Pos.Right (label) + 1,
 				X = Pos.Right (label) + 1,
 				Y = Pos.Top (label),
 				Y = Pos.Top (label),
 			};
 			};
 			frame.Add (styleRadioGroup);
 			frame.Add (styleRadioGroup);
 
 
 			frame.ValidatePosDim = true;
 			frame.ValidatePosDim = true;
-			void Top_Loaded (object sender, EventArgs args)
+			void Top_LayoutComplete (object sender, EventArgs args)
 			{
 			{
 				frame.Height =
 				frame.Height =
 					widthEdit.Frame.Height +
 					widthEdit.Frame.Height +
@@ -123,10 +123,9 @@ namespace UICatalog.Scenarios {
 					titleEdit.Frame.Height +
 					titleEdit.Frame.Height +
 					numButtonsEdit.Frame.Height +
 					numButtonsEdit.Frame.Height +
 					glyphsNotWords.Frame.Height +
 					glyphsNotWords.Frame.Height +
-					styleRadioGroup.Frame.Height;
-				Application.Top.Loaded -= Top_Loaded;
+					styleRadioGroup.Frame.Height + frame.GetAdornmentsThickness().Vertical;
 			}
 			}
-			Application.Top.Loaded += Top_Loaded;
+			Application.Top.LayoutComplete += Top_LayoutComplete;
 
 
 			Win.Add (frame);
 			Win.Add (frame);
 
 
@@ -150,7 +149,7 @@ namespace UICatalog.Scenarios {
 			// true: var btnText = new [] { "0", "\u2780", "➁", "\u2783", "\u2784", "\u2785", "\u2786", "\u2787", "\u2788", "\u2789" };
 			// true: var btnText = new [] { "0", "\u2780", "➁", "\u2783", "\u2784", "\u2785", "\u2786", "\u2787", "\u2788", "\u2789" };
 			// \u2781 is ➁ dingbats \ufb70 is	
 			// \u2781 is ➁ dingbats \ufb70 is	
 
 
-			var showDialogButton = new Button ("Show Dialog") {
+			var showDialogButton = new Button ("_Show Dialog") {
 				X = Pos.Center (),
 				X = Pos.Center (),
 				Y = Pos.Bottom (frame) + 2,
 				Y = Pos.Bottom (frame) + 2,
 				IsDefault = true,
 				IsDefault = true,

+ 11 - 12
UICatalog/Scenarios/MessageBoxes.cs

@@ -14,7 +14,6 @@ namespace UICatalog.Scenarios {
 				X = Pos.Center (),
 				X = Pos.Center (),
 				Y = 1,
 				Y = 1,
 				Width = Dim.Percent (75),
 				Width = Dim.Percent (75),
-				Height = 12
 			};
 			};
 			Win.Add (frame);
 			Win.Add (frame);
 
 
@@ -140,14 +139,14 @@ namespace UICatalog.Scenarios {
 			};
 			};
 			frame.Add (styleRadioGroup);
 			frame.Add (styleRadioGroup);
 
 
-			var ckbWrapMessage = new CheckBox ("Wrap Message", true) {
+			var ckbWrapMessage = new CheckBox ("_Wrap Message", true) {
 				X = Pos.Right (label) + 1,
 				X = Pos.Right (label) + 1,
-				Y = Pos.Top (label) + 3
+				Y = Pos.Bottom (styleRadioGroup)
 			};
 			};
 			frame.Add (ckbWrapMessage);
 			frame.Add (ckbWrapMessage);
 
 
 			frame.ValidatePosDim = true;
 			frame.ValidatePosDim = true;
-			void Top_Loaded (object sender, EventArgs args)
+			void Top_LayoutComplete (object sender, EventArgs args)
 			{
 			{
 				frame.Height =
 				frame.Height =
 					widthEdit.Frame.Height +
 					widthEdit.Frame.Height +
@@ -157,22 +156,22 @@ namespace UICatalog.Scenarios {
 					numButtonsEdit.Frame.Height +
 					numButtonsEdit.Frame.Height +
 					defaultButtonEdit.Frame.Height +
 					defaultButtonEdit.Frame.Height +
 					styleRadioGroup.Frame.Height +
 					styleRadioGroup.Frame.Height +
-					2 +
-					ckbWrapMessage.Frame.Height;
-				Application.Top.Loaded -= Top_Loaded;
+					ckbWrapMessage.Frame.Height +
+					frame.GetAdornmentsThickness ().Vertical;
+				Application.Top.Loaded -= Top_LayoutComplete;
 			}
 			}
-			//Application.Top.Loaded += Top_Loaded;
+			Application.Top.LayoutComplete += Top_LayoutComplete;
 
 
 			label = new Label ("Button Pressed:") {
 			label = new Label ("Button Pressed:") {
 				X = Pos.Center (),
 				X = Pos.Center (),
-				Y = Pos.Bottom (frame) + 4,
+				Y = Pos.Bottom (frame) + 2,
 				Height = 1,
 				Height = 1,
 				TextAlignment = Terminal.Gui.TextAlignment.Right,
 				TextAlignment = Terminal.Gui.TextAlignment.Right,
 			};
 			};
 			Win.Add (label);
 			Win.Add (label);
 			var buttonPressedLabel = new Label (" ") {
 			var buttonPressedLabel = new Label (" ") {
 				X = Pos.Center (),
 				X = Pos.Center (),
-				Y = Pos.Bottom (frame) + 5,
+				Y = Pos.Bottom (label) + 1,
 				Width = 25,
 				Width = 25,
 				Height = 1,
 				Height = 1,
 				ColorScheme = Colors.ColorSchemes ["Error"],
 				ColorScheme = Colors.ColorSchemes ["Error"],
@@ -181,12 +180,12 @@ namespace UICatalog.Scenarios {
 
 
 			//var btnText = new [] { "_Zero", "_One", "T_wo", "_Three", "_Four", "Fi_ve", "Si_x", "_Seven", "_Eight", "_Nine" };
 			//var btnText = new [] { "_Zero", "_One", "T_wo", "_Three", "_Four", "Fi_ve", "Si_x", "_Seven", "_Eight", "_Nine" };
 
 
-			var showMessageBoxButton = new Button ("Show MessageBox") {
+			var showMessageBoxButton = new Button ("_Show MessageBox") {
 				X = Pos.Center (),
 				X = Pos.Center (),
 				Y = Pos.Bottom (frame) + 2,
 				Y = Pos.Bottom (frame) + 2,
 				IsDefault = true,
 				IsDefault = true,
 			};
 			};
-			showMessageBoxButton.Clicked += (s,e) => {
+			showMessageBoxButton.Clicked += (s, e) => {
 				try {
 				try {
 					int width = int.Parse (widthEdit.Text);
 					int width = int.Parse (widthEdit.Text);
 					int height = int.Parse (heightEdit.Text);
 					int height = int.Parse (heightEdit.Text);

+ 7 - 7
UnitTests/Text/TextFormatterTests.cs

@@ -287,7 +287,7 @@ public class TextFormatterTests {
 		Key hotKey = KeyCode.Null;
 		Key hotKey = KeyCode.Null;
 		var result = false;
 		var result = false;
 
 
-		result = TextFormatter.FindHotKey (text, hotKeySpecifier, supportFirstUpperCase, out hotPos, out hotKey);
+		result = TextFormatter.FindHotKey (text, hotKeySpecifier, out hotPos, out hotKey, supportFirstUpperCase);
 		Assert.False (result);
 		Assert.False (result);
 		Assert.Equal (-1, hotPos);
 		Assert.Equal (-1, hotPos);
 		Assert.Equal (KeyCode.Null, hotKey);
 		Assert.Equal (KeyCode.Null, hotKey);
@@ -310,7 +310,7 @@ public class TextFormatterTests {
 	{
 	{
 		var hotKeySpecifier = (Rune)'_';
 		var hotKeySpecifier = (Rune)'_';
 
 
-		var result = TextFormatter.FindHotKey (text, hotKeySpecifier, supportFirstUpperCase, out var hotPos, out var hotKey);
+		var result = TextFormatter.FindHotKey (text, hotKeySpecifier, out var hotPos, out var hotKey, supportFirstUpperCase);
 		if (expectedResult) {
 		if (expectedResult) {
 			Assert.True (result);
 			Assert.True (result);
 		} else {
 		} else {
@@ -338,7 +338,7 @@ public class TextFormatterTests {
 	{
 	{
 		var hotKeySpecifier = (Rune)'_';
 		var hotKeySpecifier = (Rune)'_';
 
 
-		var result = TextFormatter.FindHotKey (text, hotKeySpecifier, supportFirstUpperCase, out var hotPos, out var hotKey);
+		var result = TextFormatter.FindHotKey (text, hotKeySpecifier, out var hotPos, out var hotKey, supportFirstUpperCase);
 		if (expectedResult) {
 		if (expectedResult) {
 			Assert.True (result);
 			Assert.True (result);
 		} else {
 		} else {
@@ -364,7 +364,7 @@ public class TextFormatterTests {
 	{
 	{
 		var hotKeySpecifier = (Rune)'_';
 		var hotKeySpecifier = (Rune)'_';
 
 
-		var result = TextFormatter.FindHotKey (text, hotKeySpecifier, supportFirstUpperCase, out var hotPos, out var hotKey);
+		var result = TextFormatter.FindHotKey (text, hotKeySpecifier, out var hotPos, out var hotKey, supportFirstUpperCase);
 		if (expectedResult) {
 		if (expectedResult) {
 			Assert.True (result);
 			Assert.True (result);
 		} else {
 		} else {
@@ -387,7 +387,7 @@ public class TextFormatterTests {
 
 
 		var hotKeySpecifier = (Rune)0;
 		var hotKeySpecifier = (Rune)0;
 
 
-		var result = TextFormatter.FindHotKey (text, hotKeySpecifier, supportFirstUpperCase, out var hotPos, out var hotKey);
+		var result = TextFormatter.FindHotKey (text, hotKeySpecifier, out var hotPos, out var hotKey, supportFirstUpperCase);
 		if (expectedResult) {
 		if (expectedResult) {
 			Assert.True (result);
 			Assert.True (result);
 		} else {
 		} else {
@@ -411,7 +411,7 @@ public class TextFormatterTests {
 	{
 	{
 		var hotKeySpecifier = (Rune)'_';
 		var hotKeySpecifier = (Rune)'_';
 
 
-		var result = TextFormatter.FindHotKey (text, hotKeySpecifier, false, out var _, out var hotKey);
+		var result = TextFormatter.FindHotKey (text, hotKeySpecifier, out var _, out var hotKey, false);
 		Assert.Equal (found, result);
 		Assert.Equal (found, result);
 		Assert.Equal (expected, hotKey);
 		Assert.Equal (expected, hotKey);
 	}
 	}
@@ -431,7 +431,7 @@ public class TextFormatterTests {
 
 
 		var hotKeySpecifier = (Rune)0;
 		var hotKeySpecifier = (Rune)0;
 
 
-		var result = TextFormatter.FindHotKey (text, hotKeySpecifier, supportFirstUpperCase, out var hotPos, out var hotKey);
+		var result = TextFormatter.FindHotKey (text, hotKeySpecifier, out var hotPos, out var hotKey, supportFirstUpperCase);
 		Assert.False (result);
 		Assert.False (result);
 		Assert.Equal (-1, hotPos);
 		Assert.Equal (-1, hotPos);
 		Assert.Equal (KeyCode.Null, hotKey);
 		Assert.Equal (KeyCode.Null, hotKey);

+ 13 - 3
UnitTests/View/DrawTests.cs

@@ -1,8 +1,6 @@
 using System.Text;
 using System.Text;
-using System;
 using Xunit;
 using Xunit;
 using Xunit.Abstractions;
 using Xunit.Abstractions;
-using Microsoft.VisualStudio.TestPlatform.Utilities;
 
 
 namespace Terminal.Gui.ViewsTests;
 namespace Terminal.Gui.ViewsTests;
 
 
@@ -382,6 +380,18 @@ t     ", _output);
 		TestHelpers.AssertDriverContentsWithFrameAre ("", _output);
 		TestHelpers.AssertDriverContentsWithFrameAre ("", _output);
 	}
 	}
 
 
+	[Theory, SetupFakeDriver]
+	[InlineData ("𝔽𝕆𝕆𝔹𝔸R")]
+	[InlineData ("a𐐀b")]
+	void DrawHotString_NonBmp (string expected)
+	{
+		var view = new View () { Width = 10, Height = 1 };
+		view.DrawHotString (expected, Attribute.Default, Attribute.Default);
+
+		TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
+
+	}
+
 	[Fact, AutoInitShutdown]
 	[Fact, AutoInitShutdown]
 	public void Draw_Minimum_Full_Border_With_Empty_Bounds ()
 	public void Draw_Minimum_Full_Border_With_Empty_Bounds ()
 	{
 	{
@@ -512,4 +522,4 @@ t     ", _output);
 │Test│
 │Test│
 └────┘", _output);
 └────┘", _output);
 	}
 	}
-}
+}

+ 2 - 2
UnitTests/View/HotKeyTests.cs

@@ -208,13 +208,13 @@ public class HotKeyTests {
 	}
 	}
 
 
 	[Theory]
 	[Theory]
-	[InlineData ("Test", KeyCode.T)]
+	[InlineData ("Test", KeyCode.Null)]
 	[InlineData ("^Test", KeyCode.T)]
 	[InlineData ("^Test", KeyCode.T)]
 	[InlineData ("T^est", KeyCode.E)]
 	[InlineData ("T^est", KeyCode.E)]
 	[InlineData ("Te^st", KeyCode.S)]
 	[InlineData ("Te^st", KeyCode.S)]
 	[InlineData ("Tes^t", KeyCode.T)]
 	[InlineData ("Tes^t", KeyCode.T)]
 	[InlineData ("other", KeyCode.Null)]
 	[InlineData ("other", KeyCode.Null)]
-	[InlineData ("oTher", KeyCode.T)]
+	[InlineData ("oTher", KeyCode.Null)]
 	[InlineData ("^Öther", (KeyCode)'Ö')]
 	[InlineData ("^Öther", (KeyCode)'Ö')]
 	[InlineData ("^öther", (KeyCode)'ö')]
 	[InlineData ("^öther", (KeyCode)'ö')]
 	// BUGBUG: '!' should be supported. Line 968 of TextFormatter filters on char.IsLetterOrDigit 
 	// BUGBUG: '!' should be supported. Line 968 of TextFormatter filters on char.IsLetterOrDigit 

+ 129 - 86
UnitTests/Views/ButtonTests.cs

@@ -1,23 +1,28 @@
 using Xunit;
 using Xunit;
 using Xunit.Abstractions;
 using Xunit.Abstractions;
 
 
-namespace Terminal.Gui.ViewsTests;
+namespace Terminal.Gui.ViewsTests; 
+
 public class ButtonTests {
 public class ButtonTests {
-	readonly ITestOutputHelper output;
+	readonly ITestOutputHelper _output;
 
 
-	public ButtonTests (ITestOutputHelper output)
-	{
-		this.output = output;
-	}
+	public ButtonTests (ITestOutputHelper output) => _output = output;
 
 
-	[Fact, AutoInitShutdown]
+	[Fact] [SetupFakeDriver]
 	public void Constructors_Defaults ()
 	public void Constructors_Defaults ()
 	{
 	{
 		var btn = new Button ();
 		var btn = new Button ();
 		Assert.Equal (string.Empty, btn.Text);
 		Assert.Equal (string.Empty, btn.Text);
-		Application.Top.Add (btn);
-		var rs = Application.Begin (Application.Top);
+		btn.BeginInit ();
+		btn.EndInit ();
 
 
+		Assert.Equal ($"{CM.Glyphs.LeftBracket}  {CM.Glyphs.RightBracket}", btn.TextFormatter.Text);
+		Assert.False (btn.IsDefault);
+		Assert.Equal (TextAlignment.Centered, btn.TextAlignment);
+		Assert.Equal ('_', btn.HotKeySpecifier.Value);
+		Assert.True (btn.CanFocus);
+		Assert.Equal (new Rect (0, 0, 4, 1), btn.Bounds);
+		Assert.Equal (new Rect (0, 0, 4, 1), btn.Frame);
 		Assert.Equal ($"{CM.Glyphs.LeftBracket}  {CM.Glyphs.RightBracket}", btn.TextFormatter.Text);
 		Assert.Equal ($"{CM.Glyphs.LeftBracket}  {CM.Glyphs.RightBracket}", btn.TextFormatter.Text);
 		Assert.False (btn.IsDefault);
 		Assert.False (btn.IsDefault);
 		Assert.Equal (TextAlignment.Centered, btn.TextAlignment);
 		Assert.Equal (TextAlignment.Centered, btn.TextAlignment);
@@ -29,42 +34,50 @@ public class ButtonTests {
 		Assert.Equal (string.Empty, btn.Title);
 		Assert.Equal (string.Empty, btn.Title);
 		Assert.Equal (KeyCode.Null, btn.HotKey);
 		Assert.Equal (KeyCode.Null, btn.HotKey);
 
 
+		btn.Draw ();
+
 		var expected = @$"
 		var expected = @$"
 {CM.Glyphs.LeftBracket}  {CM.Glyphs.RightBracket}
 {CM.Glyphs.LeftBracket}  {CM.Glyphs.RightBracket}
 ";
 ";
-		TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
-		Application.End (rs);
+		TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
 
 
-		btn = new Button ("ARGS", true) { Text = "Test" };
-		Assert.Equal ("Test", btn.Text);
-		Application.Top.Add (btn);
-		rs = Application.Begin (Application.Top);
+		btn = new Button ("ARGS", true) { Text = "_Test" };
+		btn.BeginInit ();
+		btn.EndInit ();
+		Assert.Equal ('_', btn.HotKeySpecifier.Value);
+		Assert.Equal (Key.T, btn.HotKey);
+		Assert.Equal ("_Test", btn.Text);
 
 
-		Assert.Equal ($"{CM.Glyphs.LeftBracket}{CM.Glyphs.LeftDefaultIndicator} Test {CM.Glyphs.RightDefaultIndicator}{CM.Glyphs.RightBracket}", btn.TextFormatter.Text);
+		Assert.Equal ($"{CM.Glyphs.LeftBracket}{CM.Glyphs.LeftDefaultIndicator} Test {CM.Glyphs.RightDefaultIndicator}{CM.Glyphs.RightBracket}", btn.TextFormatter.Format ());
 		Assert.True (btn.IsDefault);
 		Assert.True (btn.IsDefault);
 		Assert.Equal (TextAlignment.Centered, btn.TextAlignment);
 		Assert.Equal (TextAlignment.Centered, btn.TextAlignment);
-		Assert.Equal ('_', btn.HotKeySpecifier.Value);
 		Assert.True (btn.CanFocus);
 		Assert.True (btn.CanFocus);
 		Assert.Equal (new Rect (0, 0, 10, 1), btn.Bounds);
 		Assert.Equal (new Rect (0, 0, 10, 1), btn.Bounds);
 		Assert.Equal (new Rect (0, 0, 10, 1), btn.Frame);
 		Assert.Equal (new Rect (0, 0, 10, 1), btn.Frame);
 		Assert.Equal (KeyCode.T, btn.HotKey);
 		Assert.Equal (KeyCode.T, btn.HotKey);
-		Application.End (rs);
 
 
-		btn = new Button (3, 4, "Test", true);
-		Assert.Equal ("Test", btn.Text);
-		Application.Top.Add (btn);
-		rs = Application.Begin (Application.Top);
+		btn = new Button (1, 2, "_abc", true);
+		btn.BeginInit ();
+		btn.EndInit ();
+		Assert.Equal ("_abc", btn.Text);
+		Assert.Equal (Key.A, btn.HotKey);
 
 
-		Assert.Equal ($"{CM.Glyphs.LeftBracket}{CM.Glyphs.LeftDefaultIndicator} Test {CM.Glyphs.RightDefaultIndicator}{CM.Glyphs.RightBracket}", btn.TextFormatter.Text);
+		Assert.Equal ($"{CM.Glyphs.LeftBracket}{CM.Glyphs.LeftDefaultIndicator} abc {CM.Glyphs.RightDefaultIndicator}{CM.Glyphs.RightBracket}", btn.TextFormatter.Format ());
 		Assert.True (btn.IsDefault);
 		Assert.True (btn.IsDefault);
 		Assert.Equal (TextAlignment.Centered, btn.TextAlignment);
 		Assert.Equal (TextAlignment.Centered, btn.TextAlignment);
 		Assert.Equal ('_', btn.HotKeySpecifier.Value);
 		Assert.Equal ('_', btn.HotKeySpecifier.Value);
 		Assert.True (btn.CanFocus);
 		Assert.True (btn.CanFocus);
-		Assert.Equal (new Rect (0, 0, 10, 1), btn.Bounds);
-		Assert.Equal (new Rect (3, 4, 10, 1), btn.Frame);
-		Assert.Equal (KeyCode.T, btn.HotKey);
 
 
-		Application.End (rs);
+		Application.Driver.ClearContents ();
+		btn.Draw ();
+
+		expected = @$"
+ {CM.Glyphs.LeftBracket}{CM.Glyphs.LeftDefaultIndicator} abc {CM.Glyphs.RightDefaultIndicator}{CM.Glyphs.RightBracket}
+";
+		TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
+
+		Assert.Equal (new Rect (0, 0, 10, 1), btn.Bounds);
+		Assert.Equal (new Rect (1, 2, 10, 1), btn.Frame);
 	}
 	}
 
 
 	[Fact]
 	[Fact]
@@ -72,21 +85,24 @@ public class ButtonTests {
 	public void KeyBindings_Command ()
 	public void KeyBindings_Command ()
 	{
 	{
 		var clicked = false;
 		var clicked = false;
-		Button btn = new Button ("_Test");
+		var btn = new Button ("_Test");
 		btn.Clicked += (s, e) => clicked = true;
 		btn.Clicked += (s, e) => clicked = true;
 		Application.Top.Add (btn);
 		Application.Top.Add (btn);
 		Application.Begin (Application.Top);
 		Application.Begin (Application.Top);
 
 
 		// Hot key. Both alone and with alt
 		// Hot key. Both alone and with alt
 		Assert.Equal (KeyCode.T, btn.HotKey);
 		Assert.Equal (KeyCode.T, btn.HotKey);
-		Assert.True (btn.NewKeyDownEvent (new (KeyCode.T)));
+		Assert.True (btn.NewKeyDownEvent (new Key (KeyCode.T)));
 		Assert.True (clicked);
 		Assert.True (clicked);
 		clicked = false;
 		clicked = false;
 
 
-		Assert.True (btn.NewKeyDownEvent (new (KeyCode.T | KeyCode.AltMask)));
+		Assert.True (btn.NewKeyDownEvent (new Key (KeyCode.T | KeyCode.AltMask)));
 		Assert.True (clicked);
 		Assert.True (clicked);
 		clicked = false;
 		clicked = false;
 
 
+		Assert.True (btn.NewKeyDownEvent (btn.HotKey));
+		Assert.True (clicked);
+		clicked = false;
 		Assert.True (btn.NewKeyDownEvent (btn.HotKey));
 		Assert.True (btn.NewKeyDownEvent (btn.HotKey));
 		Assert.True (clicked);
 		Assert.True (clicked);
 		clicked = false;
 		clicked = false;
@@ -94,32 +110,32 @@ public class ButtonTests {
 		// IsDefault = false
 		// IsDefault = false
 		// Space and Enter should work
 		// Space and Enter should work
 		Assert.False (btn.IsDefault);
 		Assert.False (btn.IsDefault);
-		Assert.True (btn.NewKeyDownEvent (new (KeyCode.Enter)));
+		Assert.True (btn.NewKeyDownEvent (new Key (KeyCode.Enter)));
 		Assert.True (clicked);
 		Assert.True (clicked);
 		clicked = false;
 		clicked = false;
 
 
 		// IsDefault = true
 		// IsDefault = true
 		// Space and Enter should work
 		// Space and Enter should work
 		btn.IsDefault = true;
 		btn.IsDefault = true;
-		Assert.True (btn.NewKeyDownEvent (new (KeyCode.Enter)));
+		Assert.True (btn.NewKeyDownEvent (new Key (KeyCode.Enter)));
 		Assert.True (clicked);
 		Assert.True (clicked);
 		clicked = false;
 		clicked = false;
 
 
 		// Toplevel does not handle Enter, so it should get passed on to button
 		// Toplevel does not handle Enter, so it should get passed on to button
-		Assert.True (Application.Top.NewKeyDownEvent (new (KeyCode.Enter)));
+		Assert.True (Application.Top.NewKeyDownEvent (new Key (KeyCode.Enter)));
 		Assert.True (clicked);
 		Assert.True (clicked);
 		clicked = false;
 		clicked = false;
 
 
 		// Direct
 		// Direct
-		Assert.True (btn.NewKeyDownEvent (new (KeyCode.Enter)));
+		Assert.True (btn.NewKeyDownEvent (new Key (KeyCode.Enter)));
 		Assert.True (clicked);
 		Assert.True (clicked);
 		clicked = false;
 		clicked = false;
 
 
-		Assert.True (btn.NewKeyDownEvent (new (KeyCode.Space)));
+		Assert.True (btn.NewKeyDownEvent (new Key (KeyCode.Space)));
 		Assert.True (clicked);
 		Assert.True (clicked);
 		clicked = false;
 		clicked = false;
 
 
-		Assert.True (btn.NewKeyDownEvent (new ((KeyCode)'T')));
+		Assert.True (btn.NewKeyDownEvent (new Key ((KeyCode)'T')));
 		Assert.True (clicked);
 		Assert.True (clicked);
 		clicked = false;
 		clicked = false;
 
 
@@ -135,22 +151,22 @@ public class ButtonTests {
 	public void HotKeyChange_Works ()
 	public void HotKeyChange_Works ()
 	{
 	{
 		var clicked = false;
 		var clicked = false;
-		Button btn = new Button ("Test");
+		var btn = new Button ("_Test");
 		btn.Clicked += (s, e) => clicked = true;
 		btn.Clicked += (s, e) => clicked = true;
 		Application.Top.Add (btn);
 		Application.Top.Add (btn);
 		Application.Begin (Application.Top);
 		Application.Begin (Application.Top);
 
 
 		Assert.Equal (KeyCode.T, btn.HotKey);
 		Assert.Equal (KeyCode.T, btn.HotKey);
-		Assert.True (btn.NewKeyDownEvent (new (KeyCode.T)));
+		Assert.True (btn.NewKeyDownEvent (new Key (KeyCode.T)));
 		Assert.True (clicked);
 		Assert.True (clicked);
 
 
 		clicked = false;
 		clicked = false;
-		Assert.True (btn.NewKeyDownEvent (new (KeyCode.T | KeyCode.AltMask)));
+		Assert.True (btn.NewKeyDownEvent (new Key (KeyCode.T | KeyCode.AltMask)));
 		Assert.True (clicked);
 		Assert.True (clicked);
 
 
 		clicked = false;
 		clicked = false;
 		btn.HotKey = KeyCode.E;
 		btn.HotKey = KeyCode.E;
-		Assert.True (btn.NewKeyDownEvent (new (KeyCode.E | KeyCode.AltMask)));
+		Assert.True (btn.NewKeyDownEvent (new Key (KeyCode.E | KeyCode.AltMask)));
 		Assert.True (clicked);
 		Assert.True (clicked);
 	}
 	}
 
 
@@ -162,7 +178,7 @@ public class ButtonTests {
 	[AutoInitShutdown]
 	[AutoInitShutdown]
 	public void KeyBindingExample ()
 	public void KeyBindingExample ()
 	{
 	{
-		int pressed = 0;
+		var pressed = 0;
 		var btn = new Button ("Press Me");
 		var btn = new Button ("Press Me");
 
 
 		btn.Clicked += (s, e) => pressed++;
 		btn.Clicked += (s, e) => pressed++;
@@ -171,44 +187,46 @@ public class ButtonTests {
 		Assert.Contains (Command.Default, btn.GetSupportedCommands ());
 		Assert.Contains (Command.Default, btn.GetSupportedCommands ());
 		Assert.Contains (Command.Accept, btn.GetSupportedCommands ());
 		Assert.Contains (Command.Accept, btn.GetSupportedCommands ());
 
 
+		Application.Top.Add (btn);
+		Application.Begin (Application.Top);
 		Application.Top.Add (btn);
 		Application.Top.Add (btn);
 		Application.Begin (Application.Top);
 		Application.Begin (Application.Top);
 
 
 		// default keybinding is Space which results in keypress
 		// default keybinding is Space which results in keypress
-		Application.OnKeyDown (new ((KeyCode)' '));
+		Application.OnKeyDown (new Key ((KeyCode)' '));
 		Assert.Equal (1, pressed);
 		Assert.Equal (1, pressed);
 
 
 		// remove the default keybinding (Space)
 		// remove the default keybinding (Space)
 		btn.KeyBindings.Clear (Command.Default, Command.Accept);
 		btn.KeyBindings.Clear (Command.Default, Command.Accept);
 
 
 		// After clearing the default keystroke the Space button no longer does anything for the Button
 		// After clearing the default keystroke the Space button no longer does anything for the Button
-		Application.OnKeyDown (new ((KeyCode)' '));
+		Application.OnKeyDown (new Key ((KeyCode)' '));
 		Assert.Equal (1, pressed);
 		Assert.Equal (1, pressed);
 
 
 		// Set a new binding of b for the click (Accept) event
 		// Set a new binding of b for the click (Accept) event
 		btn.KeyBindings.Add (KeyCode.B, Command.Default, Command.Accept);
 		btn.KeyBindings.Add (KeyCode.B, Command.Default, Command.Accept);
 
 
 		// now pressing B should call the button click event
 		// now pressing B should call the button click event
-		Application.OnKeyDown (new (KeyCode.B));
+		Application.OnKeyDown (new Key (KeyCode.B));
 		Assert.Equal (2, pressed);
 		Assert.Equal (2, pressed);
 
 
 		// now pressing Shift-B should NOT call the button click event
 		// now pressing Shift-B should NOT call the button click event
-		Application.OnKeyDown (new (KeyCode.ShiftMask | KeyCode.B));
+		Application.OnKeyDown (new Key (KeyCode.ShiftMask | KeyCode.B));
 		Assert.Equal (2, pressed);
 		Assert.Equal (2, pressed);
 
 
 		// now pressing Alt-B should NOT call the button click event
 		// now pressing Alt-B should NOT call the button click event
-		Application.OnKeyDown (new (KeyCode.AltMask | KeyCode.B));
+		Application.OnKeyDown (new Key (KeyCode.AltMask | KeyCode.B));
 		Assert.Equal (2, pressed);
 		Assert.Equal (2, pressed);
 
 
 		// now pressing Shift-Alt-B should NOT call the button click event
 		// now pressing Shift-Alt-B should NOT call the button click event
-		Application.OnKeyDown (new (KeyCode.ShiftMask | KeyCode.AltMask | KeyCode.B));
+		Application.OnKeyDown (new Key (KeyCode.ShiftMask | KeyCode.AltMask | KeyCode.B));
 		Assert.Equal (2, pressed);
 		Assert.Equal (2, pressed);
 	}
 	}
 
 
 	[Fact]
 	[Fact]
 	public void TestAssignTextToButton ()
 	public void TestAssignTextToButton ()
 	{
 	{
-		View b = new Button () { Text = "heya" };
+		View b = new Button { Text = "heya" };
 		Assert.Equal ("heya", b.Text);
 		Assert.Equal ("heya", b.Text);
 		Assert.Contains ("heya", b.TextFormatter.Text);
 		Assert.Contains ("heya", b.TextFormatter.Text);
 		b.Text = "heyb";
 		b.Text = "heyb";
@@ -223,14 +241,17 @@ public class ButtonTests {
 	public void Setting_Empty_Text_Sets_HoKey_To_KeyNull ()
 	public void Setting_Empty_Text_Sets_HoKey_To_KeyNull ()
 	{
 	{
 		var super = new View ();
 		var super = new View ();
-		var btn = new Button ("Test");
+		var btn = new Button ("_Test");
 		super.Add (btn);
 		super.Add (btn);
 		super.BeginInit ();
 		super.BeginInit ();
 		super.EndInit ();
 		super.EndInit ();
 
 
-		Assert.Equal ("Test", btn.Text);
+		Assert.Equal ("_Test", btn.Text);
 		Assert.Equal (KeyCode.T, btn.HotKey);
 		Assert.Equal (KeyCode.T, btn.HotKey);
 
 
+		btn.Text = string.Empty;
+		Assert.Equal ("", btn.Text);
+		Assert.Equal (KeyCode.Null, btn.HotKey);
 		btn.Text = string.Empty;
 		btn.Text = string.Empty;
 		Assert.Equal ("", btn.Text);
 		Assert.Equal ("", btn.Text);
 		Assert.Equal (KeyCode.Null, btn.HotKey);
 		Assert.Equal (KeyCode.Null, btn.HotKey);
@@ -247,15 +268,18 @@ public class ButtonTests {
 			X = Pos.Center (),
 			X = Pos.Center (),
 			Y = Pos.Center ()
 			Y = Pos.Center ()
 		};
 		};
-		var win = new Window () {
+		var win = new Window {
 			Width = Dim.Fill (),
 			Width = Dim.Fill (),
 			Height = Dim.Fill ()
 			Height = Dim.Fill ()
 		};
 		};
 		win.Add (btn);
 		win.Add (btn);
 		Application.Top.Add (win);
 		Application.Top.Add (win);
 
 
+		Assert.False (btn.IsInitialized);
 		Assert.False (btn.IsInitialized);
 		Assert.False (btn.IsInitialized);
 
 
+		Application.Begin (Application.Top);
+		((FakeDriver)Application.Driver).SetBufferSize (30, 5);
 		Application.Begin (Application.Top);
 		Application.Begin (Application.Top);
 		((FakeDriver)Application.Driver).SetBufferSize (30, 5);
 		((FakeDriver)Application.Driver).SetBufferSize (30, 5);
 
 
@@ -272,27 +296,30 @@ public class ButtonTests {
 └────────────────────────────┘
 └────────────────────────────┘
 ";
 ";
 
 
-		var pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
+		var pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
 		Assert.Equal (new Rect (0, 0, 30, 5), pos);
 		Assert.Equal (new Rect (0, 0, 30, 5), pos);
 	}
 	}
 
 
 	[Fact, AutoInitShutdown]
 	[Fact, AutoInitShutdown]
 	public void Update_Parameterless_Only_On_Or_After_Initialize ()
 	public void Update_Parameterless_Only_On_Or_After_Initialize ()
 	{
 	{
-		var btn = new Button () {
+		var btn = new Button {
 			X = Pos.Center (),
 			X = Pos.Center (),
 			Y = Pos.Center (),
 			Y = Pos.Center (),
 			Text = "Say Hello 你"
 			Text = "Say Hello 你"
 		};
 		};
-		var win = new Window () {
+		var win = new Window {
 			Width = Dim.Fill (),
 			Width = Dim.Fill (),
-			Height = Dim.Fill (),
+			Height = Dim.Fill ()
 		};
 		};
 		win.Add (btn);
 		win.Add (btn);
 		Application.Top.Add (win);
 		Application.Top.Add (win);
 
 
+		Assert.False (btn.IsInitialized);
 		Assert.False (btn.IsInitialized);
 		Assert.False (btn.IsInitialized);
 
 
+		Application.Begin (Application.Top);
+		((FakeDriver)Application.Driver).SetBufferSize (30, 5);
 		Application.Begin (Application.Top);
 		Application.Begin (Application.Top);
 		((FakeDriver)Application.Driver).SetBufferSize (30, 5);
 		((FakeDriver)Application.Driver).SetBufferSize (30, 5);
 
 
@@ -309,30 +336,33 @@ public class ButtonTests {
 └────────────────────────────┘
 └────────────────────────────┘
 ";
 ";
 
 
-		var pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
+		var pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
 		Assert.Equal (new Rect (0, 0, 30, 5), pos);
 		Assert.Equal (new Rect (0, 0, 30, 5), pos);
 	}
 	}
 
 
 	[Fact, AutoInitShutdown]
 	[Fact, AutoInitShutdown]
 	public void AutoSize_Stays_True_With_EmptyText ()
 	public void AutoSize_Stays_True_With_EmptyText ()
 	{
 	{
-		var btn = new Button () {
+		var btn = new Button {
 			X = Pos.Center (),
 			X = Pos.Center (),
 			Y = Pos.Center (),
 			Y = Pos.Center (),
 			AutoSize = true
 			AutoSize = true
 		};
 		};
 
 
-		var win = new Window () {
+		var win = new Window {
 			Width = Dim.Fill (),
 			Width = Dim.Fill (),
-			Height = Dim.Fill (),
+			Height = Dim.Fill ()
 		};
 		};
 		win.Add (btn);
 		win.Add (btn);
 		Application.Top.Add (win);
 		Application.Top.Add (win);
 
 
+		Assert.True (btn.AutoSize);
 		Assert.True (btn.AutoSize);
 		Assert.True (btn.AutoSize);
 
 
+		btn.Text = "Say Hello 你";
 		btn.Text = "Say Hello 你";
 		btn.Text = "Say Hello 你";
 
 
+		Assert.True (btn.AutoSize);
 		Assert.True (btn.AutoSize);
 		Assert.True (btn.AutoSize);
 
 
 		Application.Begin (Application.Top);
 		Application.Begin (Application.Top);
@@ -345,25 +375,26 @@ public class ButtonTests {
 └────────────────────────────┘
 └────────────────────────────┘
 ";
 ";
 
 
-		TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
+		TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
 	}
 	}
 
 
 	[Fact, AutoInitShutdown]
 	[Fact, AutoInitShutdown]
 	public void AutoSize_Stays_True_Center ()
 	public void AutoSize_Stays_True_Center ()
 	{
 	{
-		var btn = new Button () {
+		var btn = new Button {
 			X = Pos.Center (),
 			X = Pos.Center (),
 			Y = Pos.Center (),
 			Y = Pos.Center (),
 			Text = "Say Hello 你"
 			Text = "Say Hello 你"
 		};
 		};
 
 
-		var win = new Window () {
+		var win = new Window {
 			Width = Dim.Fill (),
 			Width = Dim.Fill (),
-			Height = Dim.Fill (),
+			Height = Dim.Fill ()
 		};
 		};
 		win.Add (btn);
 		win.Add (btn);
 		Application.Top.Add (win);
 		Application.Top.Add (win);
 
 
+		Assert.True (btn.AutoSize);
 		Assert.True (btn.AutoSize);
 		Assert.True (btn.AutoSize);
 
 
 		Application.Begin (Application.Top);
 		Application.Begin (Application.Top);
@@ -376,7 +407,7 @@ public class ButtonTests {
 └────────────────────────────┘
 └────────────────────────────┘
 ";
 ";
 
 
-		TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
+		TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
 
 
 		Assert.True (btn.AutoSize);
 		Assert.True (btn.AutoSize);
 		btn.Text = "Say Hello 你 changed";
 		btn.Text = "Say Hello 你 changed";
@@ -390,28 +421,30 @@ public class ButtonTests {
 └────────────────────────────┘
 └────────────────────────────┘
 ";
 ";
 
 
-		TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
+		TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
 	}
 	}
 
 
-	[Fact, AutoInitShutdown]
+	[Fact] [AutoInitShutdown]
 	public void AutoSize_Stays_True_AnchorEnd ()
 	public void AutoSize_Stays_True_AnchorEnd ()
 	{
 	{
-		var btn = new Button () {
+		var btn = new Button {
 			Y = Pos.Center (),
 			Y = Pos.Center (),
 			Text = "Say Hello 你",
 			Text = "Say Hello 你",
 			AutoSize = true
 			AutoSize = true
 		};
 		};
 		var btnTxt = $"{CM.Glyphs.LeftBracket} {btn.Text} {CM.Glyphs.RightBracket}";
 		var btnTxt = $"{CM.Glyphs.LeftBracket} {btn.Text} {CM.Glyphs.RightBracket}";
 
 
+		btn.X = Pos.AnchorEnd () - Pos.Function (() => btn.TextFormatter.Text.GetColumns ());
 		btn.X = Pos.AnchorEnd () - Pos.Function (() => btn.TextFormatter.Text.GetColumns ());
 		btn.X = Pos.AnchorEnd () - Pos.Function (() => btn.TextFormatter.Text.GetColumns ());
 
 
-		var win = new Window () {
+		var win = new Window {
 			Width = Dim.Fill (),
 			Width = Dim.Fill (),
-			Height = Dim.Fill (),
+			Height = Dim.Fill ()
 		};
 		};
 		win.Add (btn);
 		win.Add (btn);
 		Application.Top.Add (win);
 		Application.Top.Add (win);
 
 
+		Assert.True (btn.AutoSize);
 		Assert.True (btn.AutoSize);
 		Assert.True (btn.AutoSize);
 
 
 		Application.Begin (Application.Top);
 		Application.Begin (Application.Top);
@@ -424,7 +457,7 @@ public class ButtonTests {
 └────────────────────────────┘
 └────────────────────────────┘
 ";
 ";
 
 
-		TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
+		TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
 
 
 		Assert.True (btn.AutoSize);
 		Assert.True (btn.AutoSize);
 		btn.Text = "Say Hello 你 changed";
 		btn.Text = "Say Hello 你 changed";
@@ -439,10 +472,10 @@ public class ButtonTests {
 └────────────────────────────┘
 └────────────────────────────┘
 ";
 ";
 
 
-		TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
+		TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
 	}
 	}
 
 
-	[Fact, AutoInitShutdown]
+	[Fact] [AutoInitShutdown]
 	public void AutoSize_False_With_Fixed_Width ()
 	public void AutoSize_False_With_Fixed_Width ()
 	{
 	{
 		var tab = new View ();
 		var tab = new View ();
@@ -508,13 +541,13 @@ public class ButtonTests {
 		};
 		};
 		tab.Add (ckbMatchWholeWord);
 		tab.Add (ckbMatchWholeWord);
 
 
-		var tabView = new TabView () {
+		var tabView = new TabView {
 			Width = Dim.Fill (),
 			Width = Dim.Fill (),
 			Height = Dim.Fill ()
 			Height = Dim.Fill ()
 		};
 		};
 		tabView.AddTab (new Tab () { DisplayText = "Find", View = tab }, true);
 		tabView.AddTab (new Tab () { DisplayText = "Find", View = tab }, true);
 
 
-		var win = new Window () {
+		var win = new Window {
 			Width = Dim.Fill (),
 			Width = Dim.Fill (),
 			Height = Dim.Fill ()
 			Height = Dim.Fill ()
 		};
 		};
@@ -559,10 +592,10 @@ public class ButtonTests {
 └────────────────────────────────────────────────────┘
 └────────────────────────────────────────────────────┘
 ";
 ";
 
 
-		TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
+		TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
 	}
 	}
 
 
-	[Fact, AutoInitShutdown]
+	[Fact] [AutoInitShutdown]
 	public void Pos_Center_Layout_AutoSize_True ()
 	public void Pos_Center_Layout_AutoSize_True ()
 	{
 	{
 		var button = new Button ("Process keys") {
 		var button = new Button ("Process keys") {
@@ -570,7 +603,7 @@ public class ButtonTests {
 			Y = Pos.Center (),
 			Y = Pos.Center (),
 			IsDefault = true
 			IsDefault = true
 		};
 		};
-		var win = new Window () {
+		var win = new Window {
 			Width = Dim.Fill (),
 			Width = Dim.Fill (),
 			Height = Dim.Fill ()
 			Height = Dim.Fill ()
 		};
 		};
@@ -591,10 +624,10 @@ public class ButtonTests {
 └────────────────────────────┘
 └────────────────────────────┘
 ";
 ";
 
 
-		TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
+		TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
 	}
 	}
 
 
-	[Fact, AutoInitShutdown]
+	[Fact] [AutoInitShutdown]
 	public void Pos_Center_Layout_AutoSize_False ()
 	public void Pos_Center_Layout_AutoSize_False ()
 	{
 	{
 		var button = new Button ("Process keys") {
 		var button = new Button ("Process keys") {
@@ -604,7 +637,7 @@ public class ButtonTests {
 			IsDefault = true,
 			IsDefault = true,
 			AutoSize = false
 			AutoSize = false
 		};
 		};
-		var win = new Window () {
+		var win = new Window {
 			Width = Dim.Fill (),
 			Width = Dim.Fill (),
 			Height = Dim.Fill ()
 			Height = Dim.Fill ()
 		};
 		};
@@ -623,29 +656,38 @@ public class ButtonTests {
 └────────────────────────────┘
 └────────────────────────────┘
 ";
 ";
 
 
-		TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
+		TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
 	}
 	}
-	[Fact, AutoInitShutdown]
+
+	[Fact] [AutoInitShutdown]
 	public void Button_HotKeyChanged_EventFires ()
 	public void Button_HotKeyChanged_EventFires ()
 	{
 	{
-		var btn = new Button ("Yar");
+		var btn = new Button ("_Yar");
 
 
 		object sender = null;
 		object sender = null;
 		KeyChangedEventArgs args = null;
 		KeyChangedEventArgs args = null;
 
 
+		btn.HotKeyChanged += (s, e) => {
+			sender = s;
+			args = e;
 		btn.HotKeyChanged += (s, e) => {
 		btn.HotKeyChanged += (s, e) => {
 			sender = s;
 			sender = s;
 			args = e;
 			args = e;
 
 
 		};
 		};
+		};
 
 
 		btn.HotKey = KeyCode.R;
 		btn.HotKey = KeyCode.R;
 		Assert.Same (btn, sender);
 		Assert.Same (btn, sender);
 		Assert.Equal (KeyCode.Y, args.OldKey);
 		Assert.Equal (KeyCode.Y, args.OldKey);
 		Assert.Equal (KeyCode.R, args.NewKey);
 		Assert.Equal (KeyCode.R, args.NewKey);
-
+		btn.HotKey = KeyCode.R;
+		Assert.Same (btn, sender);
+		Assert.Equal (KeyCode.Y, args.OldKey);
+		Assert.Equal (KeyCode.R, args.NewKey);
 	}
 	}
-	[Fact, AutoInitShutdown]
+
+	[Fact] [AutoInitShutdown]
 	public void Button_HotKeyChanged_EventFires_WithNone ()
 	public void Button_HotKeyChanged_EventFires_WithNone ()
 	{
 	{
 		var btn = new Button ();
 		var btn = new Button ();
@@ -656,6 +698,7 @@ public class ButtonTests {
 		btn.HotKeyChanged += (s, e) => {
 		btn.HotKeyChanged += (s, e) => {
 			sender = s;
 			sender = s;
 			args = e;
 			args = e;
+
 		};
 		};
 
 
 		btn.HotKey = KeyCode.R;
 		btn.HotKey = KeyCode.R;
@@ -663,4 +706,4 @@ public class ButtonTests {
 		Assert.Equal (KeyCode.Null, args.OldKey);
 		Assert.Equal (KeyCode.Null, args.OldKey);
 		Assert.Equal (KeyCode.R, args.NewKey);
 		Assert.Equal (KeyCode.R, args.NewKey);
 	}
 	}
-}
+}

+ 40 - 47
UnitTests/Views/CheckBoxTests.cs

@@ -1,19 +1,12 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Xunit;
+using Xunit;
 using Xunit.Abstractions;
 using Xunit.Abstractions;
 
 
 namespace Terminal.Gui.ViewsTests;
 namespace Terminal.Gui.ViewsTests;
+
 public class CheckboxTests {
 public class CheckboxTests {
 	readonly ITestOutputHelper _output;
 	readonly ITestOutputHelper _output;
 
 
-	public CheckboxTests (ITestOutputHelper output)
-	{
-		this._output = output;
-	}
+	public CheckboxTests (ITestOutputHelper output) => _output = output;
 
 
 	[Fact]
 	[Fact]
 	public void Constructors_Defaults ()
 	public void Constructors_Defaults ()
@@ -60,7 +53,7 @@ public class CheckboxTests {
 	public void KeyBindings_Command ()
 	public void KeyBindings_Command ()
 	{
 	{
 		var toggled = false;
 		var toggled = false;
-		CheckBox ckb = new CheckBox ();
+		var ckb = new CheckBox ();
 		ckb.Toggled += (s, e) => toggled = true;
 		ckb.Toggled += (s, e) => toggled = true;
 		Application.Top.Add (ckb);
 		Application.Top.Add (ckb);
 		Application.Begin (Application.Top);
 		Application.Begin (Application.Top);
@@ -69,32 +62,32 @@ public class CheckboxTests {
 		Assert.False (toggled);
 		Assert.False (toggled);
 		Assert.Equal (KeyCode.Null, ckb.HotKey);
 		Assert.Equal (KeyCode.Null, ckb.HotKey);
 
 
-		ckb.Text = "Test";
+		ckb.Text = "_Test";
 		Assert.Equal (KeyCode.T, ckb.HotKey);
 		Assert.Equal (KeyCode.T, ckb.HotKey);
-		Assert.True (Application.Top.NewKeyDownEvent (new (KeyCode.T)));
+		Assert.True (Application.Top.NewKeyDownEvent (new Key (KeyCode.T)));
 		Assert.True (ckb.Checked);
 		Assert.True (ckb.Checked);
 		Assert.True (toggled);
 		Assert.True (toggled);
 
 
 		ckb.Text = "T_est";
 		ckb.Text = "T_est";
 		toggled = false;
 		toggled = false;
 		Assert.Equal (KeyCode.E, ckb.HotKey);
 		Assert.Equal (KeyCode.E, ckb.HotKey);
-		Assert.True (Application.Top.NewKeyDownEvent (new (KeyCode.E | KeyCode.AltMask)));
+		Assert.True (Application.Top.NewKeyDownEvent (new Key (KeyCode.E | KeyCode.AltMask)));
 		Assert.True (toggled);
 		Assert.True (toggled);
 		Assert.False (ckb.Checked);
 		Assert.False (ckb.Checked);
 
 
 		toggled = false;
 		toggled = false;
 		Assert.Equal (KeyCode.E, ckb.HotKey);
 		Assert.Equal (KeyCode.E, ckb.HotKey);
-		Assert.True (Application.Top.NewKeyDownEvent (new (KeyCode.E)));
+		Assert.True (Application.Top.NewKeyDownEvent (new Key (KeyCode.E)));
 		Assert.True (toggled);
 		Assert.True (toggled);
 		Assert.True (ckb.Checked);
 		Assert.True (ckb.Checked);
 
 
 		toggled = false;
 		toggled = false;
-		Assert.True (Application.Top.NewKeyDownEvent (new ((KeyCode)' ')));
+		Assert.True (Application.Top.NewKeyDownEvent (new Key ((KeyCode)' ')));
 		Assert.True (toggled);
 		Assert.True (toggled);
 		Assert.False (ckb.Checked);
 		Assert.False (ckb.Checked);
 
 
 		toggled = false;
 		toggled = false;
-		Assert.True (Application.Top.NewKeyDownEvent (new (KeyCode.Space)));
+		Assert.True (Application.Top.NewKeyDownEvent (new Key (KeyCode.Space)));
 		Assert.True (toggled);
 		Assert.True (toggled);
 		Assert.True (ckb.Checked);
 		Assert.True (ckb.Checked);
 		Assert.True (ckb.AutoSize);
 		Assert.True (ckb.AutoSize);
@@ -109,15 +102,15 @@ public class CheckboxTests {
 		Assert.Equal (new Rect (0, 0, 6, 1), pos);
 		Assert.Equal (new Rect (0, 0, 6, 1), pos);
 	}
 	}
 
 
-	[Fact, AutoInitShutdown]
+	[Fact] [AutoInitShutdown]
 	public void AutoSize_StaysVisible ()
 	public void AutoSize_StaysVisible ()
 	{
 	{
-		var checkBox = new CheckBox () {
+		var checkBox = new CheckBox {
 			X = 1,
 			X = 1,
 			Y = Pos.Center (),
 			Y = Pos.Center (),
 			Text = "Check this out 你"
 			Text = "Check this out 你"
 		};
 		};
-		var win = new Window () {
+		var win = new Window {
 			Width = Dim.Fill (),
 			Width = Dim.Fill (),
 			Height = Dim.Fill (),
 			Height = Dim.Fill (),
 			Title = "Test Demo 你"
 			Title = "Test Demo 你"
@@ -186,17 +179,17 @@ public class CheckboxTests {
 		Assert.Equal (new Rect (0, 0, 30, 5), pos);
 		Assert.Equal (new Rect (0, 0, 30, 5), pos);
 	}
 	}
 
 
-	[Fact, AutoInitShutdown]
+	[Fact] [AutoInitShutdown]
 	public void TextAlignment_Left ()
 	public void TextAlignment_Left ()
 	{
 	{
-		var checkBox = new CheckBox () {
+		var checkBox = new CheckBox {
 			X = 1,
 			X = 1,
 			Y = Pos.Center (),
 			Y = Pos.Center (),
 			Text = "Check this out 你",
 			Text = "Check this out 你",
 			AutoSize = false,
 			AutoSize = false,
 			Width = 25
 			Width = 25
 		};
 		};
-		var win = new Window () {
+		var win = new Window {
 			Width = Dim.Fill (),
 			Width = Dim.Fill (),
 			Height = Dim.Fill (),
 			Height = Dim.Fill (),
 			Title = "Test Demo 你"
 			Title = "Test Demo 你"
@@ -236,10 +229,10 @@ public class CheckboxTests {
 		Assert.Equal (new Rect (0, 0, 30, 5), pos);
 		Assert.Equal (new Rect (0, 0, 30, 5), pos);
 	}
 	}
 
 
-	[Fact, AutoInitShutdown]
+	[Fact] [AutoInitShutdown]
 	public void TextAlignment_Centered ()
 	public void TextAlignment_Centered ()
 	{
 	{
-		var checkBox = new CheckBox () {
+		var checkBox = new CheckBox {
 			X = 1,
 			X = 1,
 			Y = Pos.Center (),
 			Y = Pos.Center (),
 			Text = "Check this out 你",
 			Text = "Check this out 你",
@@ -247,7 +240,7 @@ public class CheckboxTests {
 			AutoSize = false,
 			AutoSize = false,
 			Width = 25
 			Width = 25
 		};
 		};
-		var win = new Window () {
+		var win = new Window {
 			Width = Dim.Fill (),
 			Width = Dim.Fill (),
 			Height = Dim.Fill (),
 			Height = Dim.Fill (),
 			Title = "Test Demo 你"
 			Title = "Test Demo 你"
@@ -288,10 +281,10 @@ public class CheckboxTests {
 		Assert.Equal (new Rect (0, 0, 30, 5), pos);
 		Assert.Equal (new Rect (0, 0, 30, 5), pos);
 	}
 	}
 
 
-	[Fact, AutoInitShutdown]
+	[Fact] [AutoInitShutdown]
 	public void TextAlignment_Justified ()
 	public void TextAlignment_Justified ()
 	{
 	{
-		var checkBox1 = new CheckBox () {
+		var checkBox1 = new CheckBox {
 			X = 1,
 			X = 1,
 			Y = Pos.Center (),
 			Y = Pos.Center (),
 			Text = "Check first out 你",
 			Text = "Check first out 你",
@@ -299,7 +292,7 @@ public class CheckboxTests {
 			AutoSize = false,
 			AutoSize = false,
 			Width = 25
 			Width = 25
 		};
 		};
-		var checkBox2 = new CheckBox () {
+		var checkBox2 = new CheckBox {
 			X = 1,
 			X = 1,
 			Y = Pos.Bottom (checkBox1),
 			Y = Pos.Bottom (checkBox1),
 			Text = "Check second out 你",
 			Text = "Check second out 你",
@@ -307,7 +300,7 @@ public class CheckboxTests {
 			AutoSize = false,
 			AutoSize = false,
 			Width = 25
 			Width = 25
 		};
 		};
-		var win = new Window () {
+		var win = new Window {
 			Width = Dim.Fill (),
 			Width = Dim.Fill (),
 			Height = Dim.Fill (),
 			Height = Dim.Fill (),
 			Title = "Test Demo 你"
 			Title = "Test Demo 你"
@@ -357,10 +350,10 @@ public class CheckboxTests {
 		Assert.Equal (new Rect (0, 0, 30, 6), pos);
 		Assert.Equal (new Rect (0, 0, 30, 6), pos);
 	}
 	}
 
 
-	[Fact, AutoInitShutdown]
+	[Fact] [AutoInitShutdown]
 	public void TextAlignment_Right ()
 	public void TextAlignment_Right ()
 	{
 	{
-		var checkBox = new CheckBox () {
+		var checkBox = new CheckBox {
 			X = 1,
 			X = 1,
 			Y = Pos.Center (),
 			Y = Pos.Center (),
 			Text = "Check this out 你",
 			Text = "Check this out 你",
@@ -368,7 +361,7 @@ public class CheckboxTests {
 			AutoSize = false,
 			AutoSize = false,
 			Width = 25
 			Width = 25
 		};
 		};
-		var win = new Window () {
+		var win = new Window {
 			Width = Dim.Fill (),
 			Width = Dim.Fill (),
 			Height = Dim.Fill (),
 			Height = Dim.Fill (),
 			Title = "Test Demo 你"
 			Title = "Test Demo 你"
@@ -409,16 +402,16 @@ public class CheckboxTests {
 		Assert.Equal (new Rect (0, 0, 30, 5), pos);
 		Assert.Equal (new Rect (0, 0, 30, 5), pos);
 	}
 	}
 
 
-	[Fact, AutoInitShutdown]
+	[Fact] [AutoInitShutdown]
 	public void AutoSize_Stays_True_AnchorEnd_Without_HotKeySpecifier ()
 	public void AutoSize_Stays_True_AnchorEnd_Without_HotKeySpecifier ()
 	{
 	{
-		var checkBox = new CheckBox () {
+		var checkBox = new CheckBox {
 			Y = Pos.Center (),
 			Y = Pos.Center (),
 			Text = "Check this out 你"
 			Text = "Check this out 你"
 		};
 		};
 		checkBox.X = Pos.AnchorEnd () - Pos.Function (() => checkBox.GetSizeNeededForTextWithoutHotKey ().Width);
 		checkBox.X = Pos.AnchorEnd () - Pos.Function (() => checkBox.GetSizeNeededForTextWithoutHotKey ().Width);
 
 
-		var win = new Window () {
+		var win = new Window {
 			Width = Dim.Fill (),
 			Width = Dim.Fill (),
 			Height = Dim.Fill (),
 			Height = Dim.Fill (),
 			Title = "Test Demo 你"
 			Title = "Test Demo 你"
@@ -455,16 +448,16 @@ public class CheckboxTests {
 		TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
 		TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
 	}
 	}
 
 
-	[Fact, AutoInitShutdown]
+	[Fact] [AutoInitShutdown]
 	public void AutoSize_Stays_True_AnchorEnd_With_HotKeySpecifier ()
 	public void AutoSize_Stays_True_AnchorEnd_With_HotKeySpecifier ()
 	{
 	{
-		var checkBox = new CheckBox () {
+		var checkBox = new CheckBox {
 			Y = Pos.Center (),
 			Y = Pos.Center (),
 			Text = "C_heck this out 你"
 			Text = "C_heck this out 你"
 		};
 		};
 		checkBox.X = Pos.AnchorEnd () - Pos.Function (() => checkBox.GetSizeNeededForTextWithoutHotKey ().Width);
 		checkBox.X = Pos.AnchorEnd () - Pos.Function (() => checkBox.GetSizeNeededForTextWithoutHotKey ().Width);
 
 
-		var win = new Window () {
+		var win = new Window {
 			Width = Dim.Fill (),
 			Width = Dim.Fill (),
 			Height = Dim.Fill (),
 			Height = Dim.Fill (),
 			Title = "Test Demo 你"
 			Title = "Test Demo 你"
@@ -501,7 +494,7 @@ public class CheckboxTests {
 		TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
 		TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
 	}
 	}
 
 
-	[Fact, AutoInitShutdown]
+	[Fact] [AutoInitShutdown]
 	public void AllowNullChecked_Get_Set ()
 	public void AllowNullChecked_Get_Set ()
 	{
 	{
 		var checkBox = new CheckBox ("Check this out 你");
 		var checkBox = new CheckBox ("Check this out 你");
@@ -510,25 +503,25 @@ public class CheckboxTests {
 		Application.Begin (top);
 		Application.Begin (top);
 
 
 		Assert.False (checkBox.Checked);
 		Assert.False (checkBox.Checked);
-		Assert.True (checkBox.NewKeyDownEvent (new (KeyCode.Space)));
+		Assert.True (checkBox.NewKeyDownEvent (new Key (KeyCode.Space)));
 		Assert.True (checkBox.Checked);
 		Assert.True (checkBox.Checked);
-		Assert.True (checkBox.MouseEvent (new MouseEvent () { X = 0, Y = 0, Flags = MouseFlags.Button1Clicked }));
+		Assert.True (checkBox.MouseEvent (new MouseEvent { X = 0, Y = 0, Flags = MouseFlags.Button1Clicked }));
 		Assert.False (checkBox.Checked);
 		Assert.False (checkBox.Checked);
 
 
 		checkBox.AllowNullChecked = true;
 		checkBox.AllowNullChecked = true;
-		Assert.True (checkBox.NewKeyDownEvent (new (KeyCode.Space)));
+		Assert.True (checkBox.NewKeyDownEvent (new Key (KeyCode.Space)));
 		Assert.Null (checkBox.Checked);
 		Assert.Null (checkBox.Checked);
 		Application.Refresh ();
 		Application.Refresh ();
 		TestHelpers.AssertDriverContentsWithFrameAre (@$"
 		TestHelpers.AssertDriverContentsWithFrameAre (@$"
 {CM.Glyphs.NullChecked} Check this out 你", _output);
 {CM.Glyphs.NullChecked} Check this out 你", _output);
-		Assert.True (checkBox.MouseEvent (new MouseEvent () { X = 0, Y = 0, Flags = MouseFlags.Button1Clicked }));
+		Assert.True (checkBox.MouseEvent (new MouseEvent { X = 0, Y = 0, Flags = MouseFlags.Button1Clicked }));
 		Assert.True (checkBox.Checked);
 		Assert.True (checkBox.Checked);
-		Assert.True (checkBox.NewKeyDownEvent (new (KeyCode.Space)));
+		Assert.True (checkBox.NewKeyDownEvent (new Key (KeyCode.Space)));
 		Assert.False (checkBox.Checked);
 		Assert.False (checkBox.Checked);
-		Assert.True (checkBox.MouseEvent (new MouseEvent () { X = 0, Y = 0, Flags = MouseFlags.Button1Clicked }));
+		Assert.True (checkBox.MouseEvent (new MouseEvent { X = 0, Y = 0, Flags = MouseFlags.Button1Clicked }));
 		Assert.Null (checkBox.Checked);
 		Assert.Null (checkBox.Checked);
 
 
 		checkBox.AllowNullChecked = false;
 		checkBox.AllowNullChecked = false;
 		Assert.False (checkBox.Checked);
 		Assert.False (checkBox.Checked);
 	}
 	}
-}
+}

+ 2 - 2
UnitTests/Views/RadioGroupTests.cs

@@ -170,7 +170,7 @@ public class RadioGroupTests {
 	[Fact]
 	[Fact]
 	public void KeyBindings_Are_Added_Correctly ()
 	public void KeyBindings_Are_Added_Correctly ()
 	{
 	{
-		var rg = new RadioGroup (new string [] { "Left", "Right" });
+		var rg = new RadioGroup (new string [] { "_Left", "_Right" });
 		Assert.NotEmpty (rg.KeyBindings.GetCommands (KeyCode.L));
 		Assert.NotEmpty (rg.KeyBindings.GetCommands (KeyCode.L));
 		Assert.NotEmpty (rg.KeyBindings.GetCommands (KeyCode.R));
 		Assert.NotEmpty (rg.KeyBindings.GetCommands (KeyCode.R));
 
 
@@ -185,7 +185,7 @@ public class RadioGroupTests {
 	[Fact]
 	[Fact]
 	public void KeyBindings_HotKeys ()
 	public void KeyBindings_HotKeys ()
 	{
 	{
-		var rg = new RadioGroup (new string [] { "Left", "Right", "Cen_tered", "Justified" });
+		var rg = new RadioGroup (new string [] { "_Left", "_Right", "Cen_tered", "_Justified" });
 		Assert.NotEmpty (rg.KeyBindings.GetCommands (KeyCode.L));
 		Assert.NotEmpty (rg.KeyBindings.GetCommands (KeyCode.L));
 		Assert.NotEmpty (rg.KeyBindings.GetCommands (KeyCode.L | KeyCode.ShiftMask));
 		Assert.NotEmpty (rg.KeyBindings.GetCommands (KeyCode.L | KeyCode.ShiftMask));
 		Assert.NotEmpty (rg.KeyBindings.GetCommands (KeyCode.L | KeyCode.AltMask));
 		Assert.NotEmpty (rg.KeyBindings.GetCommands (KeyCode.L | KeyCode.AltMask));