Re: [dev] [st][PATCH] Add support for utmp in st (DISREGARD LAST)

From: <k0ga_AT_shike2.com>
Date: Tue, 14 Oct 2014 01:41:02 +0200

> Because that is the character sent by the key in this position with this
> expected function (i.e. the <x] key above enter) on DEC terminals. It's

First, terminals only send ascii codes, functions are assigned to them
by programs. Programs that are designed to work only with terminals
that generate a concrete value are wrong programs. There is a
terminfo capability called 'kbs' that in the case of st is ^H, and any
program that want to detect a backspace has to check it. If your
program need to check against delete then it must check 'kdch1'
capability. This is why all programs that use terminfo correctly (or
they use curses) work without problems in st. Or are you suggesting
to remove terminfo and force to all the terminals to behave like linux
virtual terminal?

The Unix kernel driver doesn't assign functions to key, it only has
default values that must be changed to fit the actual terminal you
have and of course the user preferences. This is the reason why
profile was invented ("stty erase `tput kbs`" will work for any
terminal with kbs definition). If a user of suckless software cannot
write a proper profile then he should think to change to another
terminal.

Second, keyboard layout has changed a lot between different DEC
terminals:

        1) vt100 had no F1-F4 keys, it had PF1-PF2 that only worked
        locally. it had a delete key, but it also had LF and BS keys.
        If we send DELETE in Backspace key, where do we put the vt100
        BS key?. And where do we put LF?.

        2) vt220 had not ESC, LF or BS, so if you want them you have
        to press CTRL+[, CTRL+L and CTRL+H. Do you really want a
        vt220 keyboard?

St is not an attempt to have a perfect vt100 or vt220 emulator, and this
is the reason why it sets TERM to st-256color and not vt100.

I already have explained that this topic is something common to
all terminal emulators, and some of them assign BACKSPACE and other
assign DELETE, and both are correct, it is only a decision of the
terminal.

> also, for better or worse, what modern linux systems have standardized
> on (I haven't done a survey of bsd, solaris, etc).

Linux has not standardized anything. POSIX is the standard. You can
see the important definitions in [1] and [2], and it doesn't say
anything about default values.

The default value of ERASE changes between different versions of
Solaris, and there are also a lot of systems that are not POSIX alike.
Maybe you don't use them, but some of us we do it. A terminal is
something that will be used to connect to very different systems, from
routers to Windows machines, so saying that linux has a default value
for something is not important at all.

> { XK_Home, ShiftMask, "\033[2J", 0, -1,
> 0},
> { XK_Home, ShiftMask, "\033[1;2H", 0, +1,
> 0},
> { XK_Home, XK_ANY_MOD, "\033[H", 0, -1,
> 0},
> { XK_Home, XK_ANY_MOD, "\033[1~", 0, +1,
> 0},
> { XK_End, ControlMask, "\033[J", -1, 0,
> 0},
> { XK_End, ControlMask, "\033[1;5F", +1, 0,
> 0},
> { XK_End, ShiftMask, "\033[K", -1, 0,
> 0},
> { XK_End, ShiftMask, "\033[1;2F", +1, 0,
> 0},
> { XK_End, XK_ANY_MOD, "\033[4~", 0, 0,
> 0},
>
> Find is ESC[1~, Select is ESC[4~. No other codes here are from DEC
> terminals.

My vt520 has Home=^[[H, and End=^[[4~ (Mainly because it admits a PS2
keyboard or a DEC keyboard).

Regards,

[1] http://pubs.opengroup.org/onlinepubs/007908799/xcu/stty.html
[2] http://pubs.opengroup.org/onlinepubs/007908799/xbd/termios.html
Received on Tue Oct 14 2014 - 01:41:02 CEST

This archive was generated by hypermail 2.3.0 : Tue Oct 14 2014 - 01:48:06 CEST