浏览代码

Fixes #822. Moves the cursor position to the first rune if no hotkey is specified.

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

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

@@ -220,5 +220,19 @@ namespace Terminal.Gui {
 			}
 			return false;
 		}
+
+		///<inheritdoc/>
+		public override void PositionCursor ()
+		{
+			if (HotKey == Key.Unknown) {
+				for (int i = 0; i < base.Text.RuneCount; i++) {
+					if (base.Text [i] == text [0]) {
+						Move (i, 0);
+						return;
+					}
+				}
+			}
+			base.PositionCursor ();
+		}
 	}
 }