2
0
BDisp 3 жил өмнө
parent
commit
6542e86979

+ 3 - 1
Terminal.Gui/Core/View.cs

@@ -189,7 +189,9 @@ namespace Terminal.Gui {
 		public virtual Key HotKey {
 			get => hotKey;
 			set {
-				hotKey = TextFormatter.HotKey = value;
+				if (hotKey != value) {
+					hotKey = TextFormatter.HotKey = (value == Key.Unknown ? Key.Null : value);
+				}
 			}
 		}
 

+ 1 - 10
Terminal.Gui/Views/Button.cs

@@ -37,7 +37,6 @@ namespace Terminal.Gui {
 		Rune _leftDefault;
 		Rune _rightDefault;
 		Key hotKey = Key.Null;
-		Rune hotKeySpecifier;
 
 		/// <summary>
 		///   Initializes a new instance of <see cref="Button"/> using <see cref="LayoutStyle.Computed"/> layout.
@@ -155,19 +154,11 @@ namespace Terminal.Gui {
 					} else if (v != Key.Null) {
 						AddKeyBinding (Key.Space | v, Command.Accept);
 					}
-					hotKey = v;
+					hotKey = TextFormatter.HotKey = v;
 				}
 			}
 		}
 
-		/// <inheritdoc/>
-		public override Rune HotKeySpecifier {
-			get => hotKeySpecifier;
-			set {
-				hotKeySpecifier = TextFormatter.HotKeySpecifier = value;
-			}
-		}
-
 		/// <inheritdoc/>
 		protected override void UpdateTextFormatterText ()
 		{

+ 0 - 21
Terminal.Gui/Views/Checkbox.cs

@@ -13,8 +13,6 @@ namespace Terminal.Gui {
 	/// The <see cref="CheckBox"/> <see cref="View"/> shows an on/off toggle that the user can set
 	/// </summary>
 	public class CheckBox : View {
-		Key hotKey = Key.Null;
-		Rune hotKeySpecifier;
 		Rune charChecked;
 		Rune charUnChecked;
 		bool @checked;
@@ -118,25 +116,6 @@ namespace Terminal.Gui {
 			return Text.RuneSubstring (0, Math.Min (Frame.Width - 2, Text.RuneCount));
 		}
 
-		/// <inheritdoc/>
-		public override Key HotKey {
-			get => hotKey;
-			set {
-				if (hotKey != value) {
-					var v = value == Key.Unknown ? Key.Null : value;
-					hotKey = v;
-				}
-			}
-		}
-
-		/// <inheritdoc/>
-		public override Rune HotKeySpecifier {
-			get => hotKeySpecifier;
-			set {
-				hotKeySpecifier = TextFormatter.HotKeySpecifier = value;
-			}
-		}
-
 		/// <summary>
 		///    The state of the <see cref="CheckBox"/>
 		/// </summary>