Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code to add shortcut key information to model #33

Open
Phundamentals opened this issue Nov 12, 2020 · 2 comments
Open

Code to add shortcut key information to model #33

Phundamentals opened this issue Nov 12, 2020 · 2 comments

Comments

@Phundamentals
Copy link

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

@govert
Copy link
Member

govert commented Nov 13, 2020

Thank you @Phundamentals - that looks like a nice improvement. I'll add it to the code.

govert added a commit that referenced this issue Nov 13, 2020
(thanks to Sascha Sanches, @Phundamentals)
Issue #33
@Phundamentals
Copy link
Author

Thank you!

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

No branches or pull requests

2 participants