Skip to content

Code to add shortcut key information to model #33

Description

@Phundamentals

Hi,

While I do understand this is not the best or proper way to request a code change, but since I'm terrible at git and have never worked with pull requests, here it is.

Can the following code or something along its lines be added to ModelHelper.cs on line 35? It adds the neccessary information for the template to actually display key combinations.

			if (excelCommand.ShortCut != null)
			{
				System.Text.RegularExpressions.Match match = System.Text.RegularExpressions.Regex.Match(excelCommand.ShortCut, "^[\\^\\+\\%\\s]*([^\\^\\+\\%\\s]+)$");
				if (match.Success)
				{
					string shortcutKeys = string.Empty;
					if (excelCommand.ShortCut.Contains("^"))
						shortcutKeys = "Ctrl ";
					if (excelCommand.ShortCut.Contains("+"))
						shortcutKeys += "Shift ";
					if (excelCommand.ShortCut.Contains("%"))
						shortcutKeys += "Alt ";
					shortcutKeys = shortcutKeys.TrimStart().Replace(" ", " + ");
					shortcutKeys += match.Groups[1].Value;
					command.ShortCut = shortcutKeys;
				}
			}

Regards,

Sascha Sanches

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions