slang-users mailing list

[2004 Date Index] [2004 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [slang-users] Reconstructing the last key sequence


Thomas Schultz <tststs@xxxxxx> wrote:
>First of all, thank you for the instant and helpful reply to my last
>e-mail. Now I know the key sequence that triggered the function, but in
>case it is an escape sequence, I'd like to convert it to a more
>human-friendly format before displaying it. I'd also like to allow users
>to use strings like "<Up>" and "<Down>" in the keybinding section of the
>config files instead of forcing them to look up the exact escape sequences
>for the respective keys.

The only support for symbolic key-sequence is via the ^(xx) construct
where xx is the two digit termcap code for the key.  For example, the
up arrow is represented by "ku" (see man 5 termcap for details).
Hence, 

   definekey (FUNCTION, "^(ku)", KEYMAP);

will cause slang to perform a terminfo lookup for the escape sequence
associated with the specified key.

>To me, this mapping sounds like a good job for the I/O library. Can this
>be done with s-lang or do I have to handle those conversions on the

JED handles this in keydefs.sl, which defines symbolic constants that are
wrappers around around the termcap code, e.g., Key_Up = "^(ku)" to
permit

   definekey (FUNCTION, Key_Up, KEYMAP);

Mapping a key-sequence back to the constants is tricky, particularly
if one allows ESC to be a separate sequence.  Then does ESC [ A
represent 3 characters or a single Up-arrow?

>application level? In slang.h, I saw constants for SL_KEY_UP etc. - the
>manual says that they can be used with SLkp_getkey, but is there any
>chance of using them with keymaps as well?

No, these correspond more to "keysyms" rather than key codes.

I am certainly willing to entertain suggestions on this issue.

Thanks,
--John

_______________________________________________
To unsubscribe, visit http://jedsoft.org/slang/mailinglists.html


[2004 date index] [2004 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]