|
@@ -102,6 +102,11 @@ namespace Terminal.Gui {
|
|
|
/// </summary>HotKeyTagMask
|
|
|
public uint HotKeyTagMask { get; set; } = 0x100000;
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Gets the position cursor from <see cref="HotKey"/>. If the <see cref="HotKey"/> is defined, the cursor will be positioned over it.
|
|
|
+ /// </summary>
|
|
|
+ public int PositionCursor { get; set; }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// Gets the formatted lines.
|
|
|
/// </summary>
|
|
@@ -567,16 +572,17 @@ namespace Terminal.Gui {
|
|
|
int x;
|
|
|
switch (textAlignment) {
|
|
|
case TextAlignment.Left:
|
|
|
- x = bounds.Left;
|
|
|
- break;
|
|
|
case TextAlignment.Justified:
|
|
|
x = bounds.Left;
|
|
|
+ PositionCursor = hotKeyPos;
|
|
|
break;
|
|
|
case TextAlignment.Right:
|
|
|
x = bounds.Right - runes.Length;
|
|
|
+ PositionCursor = bounds.Width - runes.Length + hotKeyPos;
|
|
|
break;
|
|
|
case TextAlignment.Centered:
|
|
|
x = bounds.Left + (bounds.Width - runes.Length) / 2;
|
|
|
+ PositionCursor = (bounds.Width - runes.Length) / 2 + hotKeyPos;
|
|
|
break;
|
|
|
default:
|
|
|
throw new ArgumentOutOfRangeException ();
|
|
@@ -588,6 +594,9 @@ namespace Terminal.Gui {
|
|
|
rune = runes [col - x];
|
|
|
}
|
|
|
if ((rune & HotKeyTagMask) == HotKeyTagMask) {
|
|
|
+ if (textAlignment == TextAlignment.Justified) {
|
|
|
+ PositionCursor = col - bounds.Left;
|
|
|
+ }
|
|
|
Application.Driver?.SetAttribute (hotColor);
|
|
|
Application.Driver?.AddRune ((Rune)((uint)rune & ~HotKeyTagMask));
|
|
|
Application.Driver?.SetAttribute (normalColor);
|