Directionals are sometimes done using the ascii, for some. For example, "line feed" is *technically* the same as down arrow, even though it doesn't end up working that way, instead replacing "carriage return", or the combo of the two, which as I said some place else, is *technically* the correct sequence. However, most telnet systems that used a character by character system probably use the "code" for a character, which unfortunately would screw up UTM-8 and Unicode, both. Why? Because, I am not sure what it would do with UTM-8, but in unicode a two character code in the "0 + X" set is the "standard ascii" letter for that, not a function key. The correct codes, if using something that doesn't know about Unicode/UTM-8 are the ones generated by the keyboard codes, and those are:
Up - 0 + 72
Down - 0 + 80
Left - 0 + 75
Right - 0 + 77
PgUp - 0 + 73
PgDn - 0 + 81
Home - 0 + 71
End - 0 + 79
Basically, there is no direct way to send them normally, and if you are using UTM-8 or Unicode, I am not sure they supply any way to send command codes at all, other than the basic set. Now, on Apple IIs, they did use the ascii for it, I think it was something like:
up = ?? VT maybe?
down = LF
Right = HT
Left = BS
Noting that BS does not "erase" a character, it merely moves you "back one space", so you can type over the last position. FF was used as a sort of PgDn, since that "scrolls" the entire visible page off the screen. It was the only way Apple IIs could "do" a clear screen. Other things like PgUp or Home/End, where a bit iffier. Maybe EOT for End, but again, no "Home", unless they where using SOH... Lets face it, modern clients, with all the fancy stuff they do, are not really meant to do character by character negotiation, or handle the use of things like PgUp/PgDn.
Now, this isn't to say you couldn't *if* you had a relatively modern keyboard (like all of them now), and you assigned the "keypad" set as ones to send to the mud, and the separate set as ones to "control the client". But, a) reading which is which is more complicated than just getting the basic codes, and b) in Mushclient the keypad is used for movement of the character. Mind you, turning on/off numlock isn't that hard, so, it might be possible. Its just more complicated, since the client doesn't know the difference, as far as I know, between the _|_ version of the arrows/paging keys and the keypad. I can't be sure though, since I don't know how the internals of the accelerators work, or if those "correctly" return the "state" of the numlock, or just the keycode, without testing the state first. In other words, the raw code might say, "Keypad home", but something else would be needed to check, "Is Numlock on?" |