PowerArgs.Cli.Button.UpdateWidth C# (CSharp) Method

UpdateWidth() private method

private UpdateWidth ( ) : void
return void
        private void UpdateWidth()
        {
            int w = Text == null ? 2 : Text.Length + 2;

            if (Shortcut != null && Shortcut.Modifier.HasValue && Shortcut.Modifier == ConsoleModifiers.Alt)
            {
                w += "ALT+".Length;
            }
            else if (Shortcut != null && Shortcut.Modifier.HasValue && Shortcut.Modifier == ConsoleModifiers.Shift)
            {
                w += "SHIFT+".Length;
            }
            else if (Shortcut != null && Shortcut.Modifier.HasValue && Shortcut.Modifier == ConsoleModifiers.Control)
            {
                w += "CTL+".Length;
            }

            if (Shortcut != null)
            {
                w += Shortcut.Key.ToString().Length + " ()".Length;
            }
            Width = w;
        }