Re: [dev] [st] Home key does not work in yash

From: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Fri, 9 Aug 2024 15:16:03 +0200

On Fri, Aug 09, 2024 at 12:33:57AM +0200, Страхиња Радић wrote:
> st sets the default, but setting TERM overrides that and allows for
> some flexibility. But the testing has shown that TERM is irrelevant for
> this issue. Even with the OP's settings, Backspace in st+yash is
> working without issues here. The only difference with different values
> for TERM seems to be whether yash outputs the cwd or not. With some
> choices for TERM, cwd isn't output near the bottom of the terminal
> window by yash's example prompt.

That is not true. You cannot check the terminfo entry with the shell,
because moderm shells use raw mode and they handle keys by themself
(usually matching against ^H, ^? or \033\177, so they "work" in any terminal,
independently of the maybe wrong configuration of the user) without caring
about the terminfo entry. Please, try something like:


        stty erase ^H
        cat > /dev/tty
        whatever`press backspace`
        ^D

If you use a default st then backspace will not behave as you would
expect after pressing it, because st (now) produces a DEL character
(^?) instead of a BACKSPACE (^H) character in application mode.
When you are in application mode, the only important thing is the
termio configuration, that usually is set by stty (that if your
terminal is an acutal terminal connected to a serial line is
configured using getty or a simialr program in your system
configuration), but when you are not in keypad mode then the terminal
prduces a escape sequence that only has meaning in the context of
the terminfo definition that by default in the case of st is:

        kbs=\177,

if you want to change the keypad (or application mode) mode then
you have to use:

        tput smkx # enable keypad mode

or
        tput rmkx # disable keypad mode

and of course, tput uses the terminfo database to swich between the modes
(just as curiosity note, the DEL character is ^? == 0177 because it means
all the 7 bits to 1, that in punched card means all the bits to 1, so it means
to rubber all the holes and having an empty space in the card). You can take
a look to terminfo(5) for more information. If you still want to know more
then you can read [1].

And now the short summary, don't change the TERM info never ever, the system
configration sets the default values based in getty or the own terminal emulator
sets the correct value. Seting TERM directly is always 99.99% wrong and you can
get wrong results.


> Indeed there is, the key array.
>
> The st FAQ[1] even has some information about the Del key, which is
> related:

Thanks for the hint, if you use git blame you will see that I wrote it.

Regards,

[1] https://www.amazon.com/termcap-terminfo-Help-System-Administrators/dp/0937175226
Received on Fri Aug 09 2024 - 15:16:03 CEST

This archive was generated by hypermail 2.3.0 : Fri Aug 09 2024 - 15:24:09 CEST