Explorar o código

Merge pull request #823 from BDisp/button-move-first-rune-text

Fixes #822. Moves the cursor position to the first rune if no hotkey is specified.
Charlie Kindel %!s(int64=5) %!d(string=hai) anos
pai
achega
c04e5d0b28
Modificáronse 1 ficheiros con 14 adicións e 0 borrados
  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 ();
+		}
 	}
 }