Re: [dev] [st] some more random fixes

From: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Sun, 23 Jun 2013 01:19:48 +0200

On Sat, Jun 22, 2013 at 11:39:19PM +0200, Markus Teich wrote:
> And of course i only did this patch for
> XK_KP_Delete and forgot about
> XK_Delete.

Sorry but these patches are incorrects.


> + { XK_Delete, XK_ANY_MOD, "\033[3~", 0, 0, 0},
> { XK_Delete, XK_ANY_MOD, "\033[P", -1, 0, 0},
> - { XK_Delete, XK_ANY_MOD, "\033[3~", +1, 0, 0},

This change causes that Delete always generates \033[3~, even in ascii mode,
where it must generates \033[P (the sequence for deleting a char). Like is
said in the FAQ it is a bug in mksh, because it doesn't set the terminal in
keypad mode before testing against Delete. You should look in the
documentation of your shell, because it must provide a way of fixing its
bug, or in other case you could send a bug notification to them.

When terminal is in ascii mode it generates sequences which the own terminal
understand for such functions. You can test how works the ascii mode with:


        rmkx && stty -echo cbreak min 1 && clear && cat >/dev/tty

after running the command you will see how you can edit a page in the
editor (remember run 'reset' after the test), and all the keys works as
expected:

        - Insert: sets the terminal in insert mode instead of replace mode
        - Shift + Insert (only if it is not enabled the shortcut for copy):
              sets the terminal in replace mode.
        - Control + Insert: Insert a new line in the position where is
          located the cursor

        - Supr: delete the character under the cursor
        - Control + Delete : clears the screen
        - Shift + Delete: clears the line

        - Home: goes to first position in the screen
        - Control + End : Clears until end of screen
        - Shift + End : clears until end of line

Like I said, this works due to the correct generation of ascii sequences,
and like it is said in terminfo man page and in the FAQ:


       If the terminal has a keypad that transmits codes when the keys are
       pressed, this information can be given. Note that it is not possible
       to handle terminals where the keypad only works in local (this
       applies, for example, to the unshifted HP 2621 keys). If the keypad
       can be set to transmit or not transmit, give these codes as smkx and
       rmkx. Otherwise the keypad is assumed to always transmit.

Like our terminfo entry defines rmkx and smkx all the programs which want
detect these keys directly must write smkx before of testing them.
Received on Sun Jun 23 2013 - 01:19:48 CEST

This archive was generated by hypermail 2.3.0 : Sun Jun 23 2013 - 01:24:05 CEST