Re: [dev] [st] delele behaves as backspace... again

From: <>
Date: Mon, 3 Nov 2014 11:06:31 +0100

> Hi folks,
> my delete-key behaves as backspace since commit
> 9d9e049eac3dacb2725f9d792f7cdd2230062313 on all my linux machines
> (debian, fedora, ubuntu) and openbsd.

> i had this problem in the past (and wrote to this list about it), and
> my .zshrc since then contains stty erase ^H:

It helps with the correct defininition of backspace (from kernel point of view),
but it is not related to delete key. I suspect zsh sets your terminal in application

> Output of CTRL-V + DEL (on both openbsd and fedora, both have stty erase = ^H):
> st, zsh: ^?
> st, bash: ^[[P

Yes, zsh sets your terminal in application mode, and the value of kdl1 should be
checked only in keyboard mode. This is a bug in zsh. You can read this in the

        If you are using zsh, then read the zsh FAQ <>

                It should be noted that the O / [ confusion can occur with other keys
                such as Home and End. Some systems let you query the key sequences sent
                sent by these keys forom the system's terminal database, terminfo.
                Unfortunately, the key sequences given there tpyically apply to the mode
                that is not the one zsh uses by default (it's the "application" mode rather
                than the ""raw" mode). Explaining the use of terminfo is outside of the scope
                of this FAQ, but if you whish to use the key sequences given there you can
                tell the line editor to turn on "application" mode when it starts and turn it
                off when it stops:

                        function zle-line-init () { echoti smkx }
                        funcion zle-line-finish() { echoti rmkx }
                        zle -N zle-line-init
                        zle -N zle-line-finish

                Putting these lines into your .zshr will fix the problems.

Do you have these lines in your zshrc?

I have tested this configuration and it is true that it doesn't work,
but I think I know why. Readline and zsh are too much smart and think
that erase key is kbs capability, or ^?, but it shouldn't suppose
that, because in our case ^? is delete key. They are not compliant
with terminfo database, and it is clearly an error. They try to fix
a configuration problem and at the end they break the terminal
word totally.

At this point there are several solutions here

        - Send a patch to readline and zsh people, although I don't think they are going
         to modify anythyng.
        - Put st always in application mode and modify your terminfo
        definition to match Delete key with ^[[P (the value generated by st
        in application mode). You cannot do that in OpenBSD for example.
        - Use a suckless shell that is terminfo compliant.
        - Modify the keys generated by st. This option is not dificult, because you
        only have to modify the values in your config.h (I think I should put this
        option in the FAQ to).

Received on Mon Nov 03 2014 - 11:06:31 CET

This archive was generated by hypermail 2.3.0 : Mon Nov 03 2014 - 11:12:07 CET