Ver código fonte

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 5 anos atrás
pai
commit
c04e5d0b28
1 arquivos alterados com 14 adições e 0 exclusões
  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 ();
+		}
 	}
 }