浏览代码

Fixes changes requested.

BDisp 3 年之前
父节点
当前提交
d9a56e97c8
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      Terminal.Gui/Views/Button.cs

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

@@ -111,6 +111,7 @@ namespace Terminal.Gui {
 			_rightDefault = new Rune (Driver != null ? Driver.RightDefaultIndicator : '>');
 
 			CanFocus = true;
+			AutoSize = true;
 			this.is_default = is_default;
 			this.text = text ?? string.Empty;
 			Update ();
@@ -197,7 +198,7 @@ namespace Terminal.Gui {
 			else
 				TextFormatter.Text = ustring.Make (_leftBracket) + " " + text + " " + ustring.Make (_rightBracket);
 
-			int w = TextFormatter.Size.Width - (TextFormatter.Text.Contains (HotKeySpecifier) ? 1 : 0);
+			int w = TextFormatter.Size.Width - GetHotKeySpecifierLength ();
 			GetCurrentWidth (out int cWidth);
 			var canSetWidth = SetWidth (w, out int rWidth);
 			if (canSetWidth && (cWidth < rWidth || AutoSize)) {