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

Fix: Add support for special characters #131

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

avigoldman
Copy link

Closes #130

@timc1
Copy link

timc1 commented Nov 16, 2021

Fwiw should probably remove all the local prettier formatting in this PR!

Comment on lines +92 to +94
if (/^[^A-Za-z0-9]$/.test(event.key) && press[1] === event.key) {
return true
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused why this isn't handled by:

(
  press[1].toUpperCase() !== event.key.toUpperCase() &&
  press[1] !== event.code
) ||
'?'.toUpperCase() === '?' // true

Should we also be comparing:

(
  press[1] !== event.key &&
  press[1].toUpperCase() !== event.key.toUpperCase() &&
  press[1] !== event.code
) ||

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be missing something super obvious here but this case:

( press[1].toUpperCase() !== event.key.toUpperCase() && press[1] !== event.code ) ||

is correct, it's properly returning false. However because it returns false, we check the second value, and then third value, which:

KEYBINDING_MODIFIER_KEYS.find(mod => {
  return !press[0].includes(mod) && press[1] !== mod && getModifierState(event, mod)
})

returns Shift, which when we apply !"Shift" it returns false 😅

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 this pull request may close these issues.

? doesn't work
3 participants