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

SRValidator doesn't catch NSMenuItem shortcuts that involve arrow keys #20

Closed
gcox opened this issue Aug 17, 2013 · 15 comments
Closed

SRValidator doesn't catch NSMenuItem shortcuts that involve arrow keys #20

gcox opened this issue Aug 17, 2013 · 15 comments
Assignees

Comments

@gcox
Copy link

gcox commented Aug 17, 2013

When using SRValidator to validate a shortcut by testing an NSMenu to see if the shortcut is taken, it fails to detect that an NSMenuItem is using a shortcut involving an arrow key.

If I change lines 128-131 of SRKeyCodeTransformer.m to pass NS_ArrowFunctionKey instead of SRKeyCodeGlyph_Arrow, the problem is resolved and SRRecorderControl still displays the user friendly rendering of the arrow key characters. I didn't submit a pull request b/c I'm not sure yet if this has any negative effects in the library.

@ghost ghost assigned Kentzo Aug 17, 2013
@Kentzo
Copy link
Owner

Kentzo commented Aug 17, 2013

@gcox Interesting. I've checked with ShortcutRecorderDemo. If you set item's shortcut to e.g. cmd-left_arrow and then try to set any other shortcut to this value, app will show a warning.

Could you reproduce this problem with this demo?

@gcox
Copy link
Author

gcox commented Aug 17, 2013

@Kentzo Sure. The problem is when you use interface builder to record the key equivalent for a menu item.

  • Add a new menu item to the ShortcutRecorderDemo menu using interface builder
  • Set the new menu item's shortcut to cmd+left using interface builder
  • Run the demo and use it to record the cmd+left shortcut

No warning is displayed. If you NSLog the keyEquivalent for the new menu item and the keyEquivalent for the shortcut recorded by ShortcutRecorder, you'll see they do not match.

@Kentzo
Copy link
Owner

Kentzo commented Aug 17, 2013

@gcox Hmm, probably found an interesting bug.
With you changes, try to set shorcut to cmd-left_arrow. It will work. Then set shortcut to cmd-right_arrow. It won't work. Now clear the shortcut and set it to cmd-right_arrow again. It will start working.

@Kentzo
Copy link
Owner

Kentzo commented Aug 19, 2013

@gcox Ok, I found some other issues with checking other special keys. Will push fix in 1-2 days.

Kentzo added a commit that referenced this issue Aug 20, 2013
- Introduce new method that encapsulate all keycode/key equivalent comparison
- Take into account modifier flags
- Separate logic of Explicit and Implicit modifier flags
@Kentzo
Copy link
Owner

Kentzo commented Aug 20, 2013

@gcox Pushed fixes. Please take a look.

@Kentzo
Copy link
Owner

Kentzo commented Aug 22, 2013

@gcox Any chance you've taken a look at the develop branch?

@gcox
Copy link
Author

gcox commented Aug 22, 2013

@Kentzo Sorry, I have looked at the diff but I haven't had time to pull this down and play around with it. I should have some time tonight though.

@Kentzo
Copy link
Owner

Kentzo commented Aug 22, 2013

@gcox Thanks.

@gcox
Copy link
Author

gcox commented Aug 23, 2013

@Kentzo I pulled the code from the develop branch into the demo application and the same core issue that I initially reported seems to be unchanged. Creating a shortcut that involves an arrow key for a menu item, using interface builder's own shortcut recorder control, does not get caught by the validator when using the demo to record a shortcut.

@Kentzo
Copy link
Owner

Kentzo commented Aug 23, 2013

Thanks for your help @gcox.

Are you trying to set it with or without modifier flags? What is your system language layout?

Best regards,

Ilya Kulakov
From my iPhone

23.08.2013, â 10:58, George notifications@github.com íàïèñàë(à):

@Kentzo I pulled the code from the develop branch into the demo application and the same core issue that I initially reported seems to be unchanged. Creating a shortcut that involves an arrow key for a menu item, using interface builder's own shortcut recorder control, does not get caught by the validator when using the demo to record a shortcut.


Reply to this email directly or view it on GitHub.

@Kentzo
Copy link
Owner

Kentzo commented Aug 23, 2013

Double checked, that works for me.

Could you archive and upload your version of the demo so I can check it?

Best regards,

Ilya Kulakov
From my iPhone

23.08.2013, â 10:58, George notifications@github.com íàïèñàë(à):

@Kentzo I pulled the code from the develop branch into the demo application and the same core issue that I initially reported seems to be unchanged. Creating a shortcut that involves an arrow key for a menu item, using interface builder's own shortcut recorder control, does not get caught by the validator when using the demo to record a shortcut.


Reply to this email directly or view it on GitHub.

@gcox
Copy link
Author

gcox commented Aug 23, 2013

The shortcut I'm using is CMD+Right Arrow
Language = English, Region = US

Here's an archive of the demo app:
https://dl.dropboxusercontent.com/u/11163/ShortcutRecorderDemo.zip

@Kentzo
Copy link
Owner

Kentzo commented Aug 23, 2013

You set key equivalent of the "Ping" menu item, not "Item".
The difference is that "Ping" is bound to user settings and therefore once you start the app settings set in IB will be overwritten.

Just set key equivalent for a proper item ("Item") and try test again.

On 23.08.2013, at 17:41, George notifications@github.com wrote:

The shortcut I'm using is CMD+Right Arrow
Language = English, Region = US

Here's an archive of the demo app:
https://dl.dropboxusercontent.com/u/11163/ShortcutRecorderDemo.zip


Reply to this email directly or view it on GitHub.

@gcox
Copy link
Author

gcox commented Aug 23, 2013

Ahhh, I'm an idiot:) You're right, will confirm when I get home.

@gcox
Copy link
Author

gcox commented Aug 25, 2013

@Kentzo Confirmed this is working correctly

@Kentzo Kentzo closed this as completed Sep 13, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants