Re: [dev] [st] Terminal abnormal key codes

From: Fabian Homborg <>
Date: Wed, 02 Sep 2015 17:29:50 +0200

Roberto E. Vargas Caballero <> writes:

> Hi,
>> Our question is probably better stated as the following:
>> st seems to e.g. send "[P" for delete instead of the '\E[3;2~' in
>> terminfo (which fish does use), unless we explicitly do the equivalent
>> of "tput smkx". This not only applies to delete, but a few other key
>> combinations as well, like insert or ctrl-up.
>> Of course this is stated in the FAQ, but the question is _why_ is it
>> this way and is it possible to change that?
> Because there are two ways of using the terminal, in ASCII mode and in
> application mode. Maybe you only use the terminal in application mode,
> but some of us (mainly me) use the terminal for other kind of things,
> connecting to non POSIX machines, over serial lines, and in these cases
> we use this mode. St is not only a Unix place where ppl can write unix
> commands (take a look to -l switch of st).
>> From our perspective st is the only terminal (we've found at least) that
>> behaves this way - every other term (like xterm, konsole or linux VTs)
>> seems to not need this and just always sends the sequences specified in
>> terminfo.
> You are wrong:
> $ curl 2>/dev/null |
> gunzip |
> sed 's/#.*//g' |
> grep -c smkx
> 111

That's not what I'm talking about. Of course a tone of terminals have
smkx defined, but fish currently doesn't send it and works on (as far as
I know) anything but st.

In other words:

If you launch fish in { konsole, xterm, gnome-terminal, linux in-kernel
VTs, iTerm2, ... } your keys work, without smkx.

If you launch fish in st, your keys don't, until you do "tput smkx".

> There are 111 definitions in the official terminfo definition which
> use smkx. Maybe you don't use any of them, but some of use use
> some of them. For example I have a physical vt500 that I use as
> console in several of my servers, and it has smkx sequence. Are
> you saying me that I am going to be able to use fish in this
> terminal? and only because you are too lazy to follow the terminfo
> standard?

Apparently, st is the only thing that does follow it.

>> There's two things we can do on our side - do "tput smkx" and "tput
>> rmkx" either only in st or always (which I don't know if it'll break
>> stuff elsewhere) or bind both kinds of sequences st sends, neither
>> solution being _great_.
> It should not break anything. If the terminal does not define smkx
> you will not print anything, and if the terminal define it is because
> it needs the sequence. All the application which use curses work
> without problems in st when they try to match any key. mainly because
> curses follows the terminfo specification perfectly.

I'll probably try that, thank you.

> The question here is, why do you want to write a shell knowing
> it has bugs and it will not be able of running in all the possible
> (current or future) terminals?

The only term I currently know of that has a problem with fish is st.

Fabian Homborg

Received on Wed Sep 02 2015 - 17:29:50 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 02 2015 - 17:36:08 CEST