-
Notifications
You must be signed in to change notification settings - Fork 194
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
KeyPress fix #170
KeyPress fix #170
Conversation
keypress now: - Understands key modifiers (alt ctrl shift) - Uses Shoes v3 naming convention - yields symbols when key modifiers and/or special keys
Yay man! Thank you! |
@baalhiverne I confirmed this tiny snippet with your baalhiverne:master on my Windows 7. Shoes.app do
keypress do |k|
p k
end
end And got the following. "a" #=> a
:"" #=> Shift
"A" #=> Shift + a
:"" #=> Ctrl
:"control_\u0001" #=> Ctrl + a
:"" #=> Alt
:alt_a #=> Alt + a
:"" #=> Ctrl
:control_ #=> Ctrl + Shift
:"control_shift_\u0001" #=> Ctrl + Shift + a
:"\n" #=> Ebter
:delete #=> Delete
:"" #=> Shift
"!" #=> Shift + 1
:backspace #=> Backspce
:escape #=> Esc Great work, thanks! But if we keep compatibility with Shoes 3, |
Thanks for looking at it @ashbb so there still seems to be a problem we should fix with About testing if I understand the code correctly we could just stub the argument - key = mock(:key, keyCode: 55, stateMask: WHATEVER_THE_STATE_MASK_LOOKS_LIKE) Then call the method and see if the correct result is returned. That should be done for some major key combinations, like the ones ashbb tested - I'm happy to help you with that if you like :-) One other thing, I'm not quite sure but I think we settled with calling all methods ruby style (key_code instead of keyCode) ( @wasnotrice @ashbb can you confirm?). Thank you very much for your work on this @baalhiverne <3 |
Awesome work @baalhiverne ! Could you just change some of the methods to use snake_case, like instead of |
just FYI I'm working on this on my fixKeyPress Branch: https://github.com/PragTob/shoes4/tree/keypressFix Some bugs still remain.. for now shift + left_arrow doesn't give Cheers, |
Work can be seen in #279 so I will close this PR here and we can move the discussion there. |
keypress now: