jed-users mailing list

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

Re: Remap ^M


G. Milde wrote:
> % On 28 May 2003 John wrote to jed-users:
> % (see http://www.ruptured-duck.com/jed-users-2003/msg00295.html)
> % I will fix it in the next release.  When I wrote the code, there were
> % no such keysyms below 0xFF00.
>
> So, it should work with the newest jed version...
The code for x_set_keysym has not changed - it still uses
4 tables (Normal, Ctrl, Shift, Ctrl-Shift) with 256 entries.

>
> The problem is, that some modes and emulations might bind ^M to something
> important. As it is a very common binding, be carefull to have a spare
> xjed session open to be able to recover.

I have almost no experience with different terminals, but here
is an idea:
  Jed should internally distinguish between ^M and the Return key.
  On terminals that generate an ^M for Return key, ^M should be
  translated into a sequence stored in Key_Return variable.
  All the references to ^M should be revised an possibly replaced
  with Key_Return.
  The same should be done for Tab, Backspace, Delete, ...
  This means that various XXXterm.c files should be revised.

  Another solution is to define (as Günter did in x-keydefs)
    variable Key_Return = "^M"
  and use this Key_Return in setkey (etc.) instead of "^M".
  Then if we want to distinguish between Return and ^M,
  we do the following
     Key_Return = "\e[8~";
     x_set_keysym (0xFF0D, ' ', Key_Return);

  But this only works for xterm / xjed.

Another thing. Let's say xterm is a 'reference terminal'
for keyprocessing. We could make all other termials translate
their keycodes into xterm keycodes. Them x_set_keysym would
work on every terminal.

  For example wterm (wjed) would convert scancode 0x3b into
  0xFFBE (F1 key) and then lookup in KeySym_Mapping to find
  the correct keysequence to store into the keybuffer.

  I do not know for various other terminals though...

Proposal for x_set_keysyms:

    static SLKeyMap_List_Type *XKeys_Keymap;

    x_set_keysym (int *np, int *shift, char *str)
    {
       char kcode[4];
       sprintf(kcode, "%c%c%c", shift, (*np & 0xff00) >> 8, *np % 0xff);

       SLkm_define_keystring (kcode, str);
    }

    SLkm_define_keystring would work same as SLkm_define_key but
    instead of storing a pointer to a function it would store a
    pointer to a keystring.

    also shift is a bitmap of special keys (ALT, SHIFT, CTRL, ...)
    and so Jed could support Ctrl-Shift and other combinations.

    X_process_events(...)
    {
       ...
       if (ks > FE00)
       {
         char kcode[4];
         sprintf(kcode, "%c%c%c", shift, (ks & 0xff00) >> 8, ks % 0xff);
         SLang_Key_Type *pkey = SLkm_find_key(kcode, XKeys_keymap);
         if (pkey && pkey->type == SLKEY_F_STRING)
         {
            bufp = pkey->keystring; // or pkey->s
         }
         else ...
         ...
         // store valid bufp into Jed keybuffer.
       }
       ...
     }

  John, could such x_set_keysym work or am I missing something?


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>.


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