- Subject: How to discover prefix keysequences?
- From: Marko Mahnic <marko.mahnic@xxxxxxxx>
- Date: Mon, 16 May 2005 11:14:58 +0200
Hi.
I would like to implement Alt-key handling (for keys A..Z)
in FL-Jed in the following way:
1. If Alt-<char> is bound to anything, pass "\e<char>" to JED
2. If Alt-<char> is a prefix of a keysequence, pass "\e<char>" to JED
3. Let FLTK handle Alt-XX
Curently I am using jed_get_key_function(buf, &s).
With it I can handle case 1 but not case 2.
If I assign "goto_line" to "\egl" (Alt-g l), I cannot
detect that Alt-g is used in a keysequence.
I can write a separate function (is_prefix_key) to return
the length of the prefix.
Alternatively jed_get_key_function can be modified to
return such info but only when the keystr parameter is
not NULL:
------- keymap.c, 1175
key = SLang_do_key (CBuf->keymap, get_key_function_callback);
+ if (key == NULL)
+ return -1 - (Getkey_Callback_Data.num_read - 1)
}
if (key == NULL)
return -1;
-----------------
(When keystr is NULL JED rads the key with jed_getkey;
if the keysequence is not assigned, the function
allways returns -1).
What other (SLang?) code would the change affect?
Is it better to modify jed_get_key_function or to
write is_prefix_key?
Example:
setkey("goto_line", "\egl");
then
1. jed_get_key_function("\002\eg", &s)
returns -1 - 2
which means "\eg" is a prefix sequence of length 2
2. jed_get_key_function("\003\egf", &s)
returns -1 - 2
which means "\eg" is a prefix sequence, but "\egf" is not assigned
3. jed_get_key_function("\003\egl", &s)
returns 1..3
which means "\egl" is assigned (current behaviour)
Marko
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2005 date index]
[2005 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]