The Accidental Rubyist

invalid byte sequence in UTF-8

xterm-color key issues fixed

leave a comment »

xterm-color blows as a TERM. Even vt100/200, xterm (and xterm-256color) send proper values for F1..F4 and backtab. xterm-color sends a 27,79,80 for F1 (i.e., three keys). So I spent the wee hours of last night hacking some ugly lines into window.getchar() to trap these combinations.

Then i found that backtab is 27,79,81. Added more ugly code for that. But that’s about it.

What is problematic is that xterm-color sends 27,79 for M-O (Meta or Alt O). I checked manver’s VER::keyboard.rb and for xterm-color it (incorrectly) sends “M-O” followed by the character “P”, although the code appears to check for this combination (See SPECIAL_KEYS in his code).

So now my getchar() will send a M-O or F1 correctly for xterm-color, although the M-O takes a little longer to be passed to your program since it waits for getch to return -1.

I suggest avoiding xterm-color since other keys could also bomb at some time. Please tell me if there are fixes for it. I like “screen” the best, although it doesn’t show underlines.

Advertisements

Written by totalrecall

December 22, 2008 at 1:11 pm

Posted in ncurses, rbcurse

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: