From d17e3d5ef79417d68906c0149832e2cde029de92 Mon Sep 17 00:00:00 2001 From: BDisp Date: Fri, 24 Jul 2020 13:44:20 +0100 Subject: [PATCH] Fixes #822. Moves the cursor position to the first rune if no hotkey is specified. --- Terminal.Gui/Views/Button.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Terminal.Gui/Views/Button.cs b/Terminal.Gui/Views/Button.cs index 7ed27082e..1a0825c3a 100644 --- a/Terminal.Gui/Views/Button.cs +++ b/Terminal.Gui/Views/Button.cs @@ -220,5 +220,19 @@ namespace Terminal.Gui { } return false; } + + /// + 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 (); + } } }