Sophrinix / TryRuby

Try Ruby is a interactive shell that quickly and whimsically teaches the Ruby programming language. Originally _why's idea, it has been recreated from the ground up by Rubyists who have a passion for Ruby and for teaching their fellow (wo)man how to program.
tryruby.org
345 stars 80 forks source link

Arrow keys don't work #7

Closed ghost closed 14 years ago

ghost commented 14 years ago

You can't use arrow keys like you can in a command line. This will be confusing because in one of the lessons it says to press the up arrow to retype the last command.

Sophrinix commented 14 years ago

I am able to use the up and down arrow keys on a standard US keyboard. What keyboard, web browser, and operating system are you using? Thanks.

Patru commented 14 years ago

not being the original author I just add my 2 cents. I use TryRuby in two environments, at home on the mac I could never use the command history (my kinesis-ergo USB is a little unusual, but the scan codes should be ok) though I only tried the swiss-german keyboard layout. At work on Windows and IE6 the arrow-keys worked most of the time. I use a split keyboard on a PS/2 also with the swiss-german layout, although the keyboard is a US-version (and I am missing one key ...)

Sophrinix commented 14 years ago

I am suspicious that the scan or break code for the swiss-german up arrow is different than that of the us keyboard.

I will look into this and see if there is a different key mapping.

While this would not make sense, anything is possible.

ghost commented 14 years ago

Oops, I commented on this 2 days ago but github did not like my comment I guess. I was trying it on Chrome on Windows. It works in firefox on the same computer.

davidmiani commented 14 years ago

I made a page at http://tryruby.nfshost.com/keypress_test.html which should help with diagnosing the problem. Can anyone with the problems go to that page, type up, and see what keycode is produced. Eg I got a KeyCode value of 38.

Sophrinix commented 14 years ago

If you are getting anything other than 38 when you hit the up arrow key, please let me know! If this is the case if you could tell me what language your browser is set to as well, basically the UA info, that would be fantastic.

ghost commented 14 years ago

i got 38.

Patru commented 14 years ago

Even on my Mac with the kinesis-Advantage using the swiss-german keyboard layout I get 38 for the up-arrow and 40 for the down arrow. The left arrow is 37 and the right arrow is 39, however, all of these do not work in TryRuby. I neither get command line editing nor command history on the Mac (in Safari that is, I just noticed it will work in Camino (Firefox-derivative) which gives the same KeyCodes). So I have to conclude that his is neither a keyboard- nor a Mac, but a Safari-issue.

davidmiani commented 14 years ago

The up key also doesn't work on chromium and opera. It works fine for Firefox and internet explorer 6 under wine (most likely ie under windows as well). So it is definitely a JavaScript problem, not a localisation problem. Will work on this when I have some time.

Sophrinix commented 14 years ago

yeah, I should have added this point to the README. It is only confirmed to work on firefox and android.

dermotbutterfield commented 14 years ago

I agree it would be great if this worked in Chrome.

Sophrinix commented 14 years ago

this now works on safari. i need to test opera, chrome, and explorer. please note that explorer will not be a priority-- especially 6

Sophrinix commented 14 years ago

we have chrome support. now for opera and I will call this ticket done

Sophrinix commented 14 years ago

opera support in is, but i'm convinced that macbooks are just weird. I am going to call this done, but will re open this ticket if when i get back to my linux box this issue exist there too. they keycode for up arrow on a macbook is 38 . This is also true of chrome, so why it gives me & is whacked.

ghost commented 14 years ago

i still use chrome and it is not working.

Sophrinix commented 14 years ago

It should be fixed in the repo. I need to push these changes to the live site. Does it work on trb.sophrinix.com

Sophrinix commented 14 years ago

I was testing on mac chrome. Are you on windows?

ghost commented 14 years ago

yes. on trb.sophrinix.com, the up/down keys work fine, but the delete key doesn't do anything and the backspace key does what the delete key should do.

Sophrinix commented 14 years ago

do you mind going to trb.sophrinix.com/keypress_test.html and pressing delete and backspace and letting me know what they come up for you ( i assume on chrome?)

I'll make the changes to get them in.

I will push the trb.sophrinix.com code to tryruby.sophrinix.com once I know its correct and didn't introduce any new issues.

ghost commented 14 years ago

When i pushed backspace, the page said "8" and then went back a page in my history. Delete is 46.