soegaard / whalesong

Whalesong: Racket to JavaScript compiler
http://hashcollision.org/whalesong
145 stars 14 forks source link

does not support capital letter input (and other shift key characters) #44

Open stchang opened 9 years ago

stchang commented 9 years ago

See https://github.com/vishesh/whalebin/issues/16

schanzer commented 9 years ago

Welcome to keypress/keydown hell!

We should really collaborate on this, given that the same code is used in WeScheme. The issue is that keydown events are the ONLY way to find out if control keys (shift, control, f2, etc) have been pressed, but keypress events are the ONLY way to find out what actual ASCII character should be generated. You need to listen for both to get the "full" info, but this gets really messy, as I've discovered by implementing it in WeScheme.

However, even this approach has limitations when it comes to foreign characters.

I think we need to be a lot more clever here, most likely by sending keypress events to an offscreen