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

Key commands should be matched exactly #216

Closed
vitosamson opened this issue Nov 6, 2015 · 2 comments · Fixed by #219
Closed

Key commands should be matched exactly #216

vitosamson opened this issue Nov 6, 2015 · 2 comments · Fixed by #219
Assignees

Comments

@vitosamson
Copy link
Contributor

Currently if you press opt-cmd-B or ctrl-cmd-B it toggles bold, even though the key command is configured for just META+B or CTRL+B, but not both together.

@rlivsey
Copy link
Collaborator

rlivsey commented Nov 6, 2015

Good catch, the culprit is in findKeyCommands here where we're currently just checking for the defined keys but not checking if any others are pressed.

return (modifier && key.hasModifier(modifier)) || (!modifier && !key.hasAnyModifier());

@bantic
Copy link
Collaborator

bantic commented Nov 9, 2015

I think maybe a bitmask for the key modifiers would simplify this? I may take a stab at this later today.

@bantic bantic self-assigned this Nov 9, 2015
bantic added a commit that referenced this issue Nov 9, 2015
 * Add `modiferMask` property to key and key commands
 * Changes buildKeyCommand to allow multiple modifiers, i.e. `str: 'META+SHIFT+K'
 * Add additional assertions to ensure key commands are valid
 * Deprecate using a `modifier` property when creating a key command

fixes #216
bantic added a commit that referenced this issue Nov 9, 2015
 * Add `modiferMask` property to key and key commands
 * Changes buildKeyCommand to allow multiple modifiers, i.e. `str: 'META+SHIFT+K'
 * Add additional assertions to ensure key commands are valid
 * Deprecate using a `modifier` property when creating a key command

fixes #216
bantic added a commit that referenced this issue Nov 9, 2015
 * Add `modiferMask` property to key and key commands
 * Changes buildKeyCommand to allow multiple modifiers, i.e. `str: 'META+SHIFT+K'
 * Add additional assertions to ensure key commands are valid
 * Deprecate using a `modifier` property when creating a key command

fixes #216
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

Successfully merging a pull request may close this issue.

3 participants