Re: [dev] [st] [PATCH] 8bit-meta like xterm

From: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Tue, 23 Apr 2013 13:58:02 +0200

On Tue, Apr 23, 2013 at 10:50:32AM +0200, Christoph Lohmann wrote:
> Greetings.
>
> On Tue, 23 Apr 2013 10:50:32 +0200 Otto Modinos <ottomodinos_AT_gmail.com> wrote:
> > Howdy Comrades.
> > I'm new to this mailing list.
> > Just found st couple of days back and really loved it. It lacked however
> > the ability to send Meta as the 8th bit, the way xterm does. I needed this
> > because most of the apps I tried didn't recognize the escape sequence st
> > was using. So this little patch adds this.
> > It can be enabled by setting meta8 to true in config.def.h and disabled at
> > runtime with the -8 cmdline switch.
> > Hope you can merge it in st mainline, or at least added in as a patch in
> > the site.
>
> I am considering making this the default behaviour of st. Are there any
> arguments against it?

The unique problem is utf8 encoding will put the 8 bit to 1 in some
characters, so it is not very clear for me like applications can difference
between meta-character and first byte of a utf8 sequence. I can see that
terminfo has the following fields:

        km: Has a meta key
        rmm: turn off meta mode
        smm: turn on meta mode

And the information about them is:

     If the terminal has a ``meta key'' which acts as a shift key, setting
     the 8th bit of any character transmitted, this fact can be indicated
     with km. Otherwise, software will assume that the 8th bit is parity
     and it will usually be cleared. If strings exist to turn this ``meta
     mode'' on and off, they can be given as smm and rmm.


xterm has km capability but doesn't have rmm or smm. I suppouse that
applications should look in km and doesn't translate if not km. The page
http://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/meta-bit.html
says:

        xterm itself has relatively little understanding of complex
        character sets: it operates either in "conventional 8bit mode" or in
        UTF-8 mode. In the former, the character set is assumed to be
        single-byte and the Meta key translates each low-half character into
        its high-half counterpart in the obvious way. In the latter mode,
        the Meta key translates ASCII into ISO-8859-1 and then encodes it as
        UTF-8 (so that, for example, Meta-a sends C3 A1 which is the UTF-8
        encoding of U+00E1). xterm supports all other character sets by
        interposing "luit", which means that whether a Meta combination
        generates anything in (say) Shift-JIS will depend entirely on
        whether the relevant Unicode value between U+0080 and U+00FF is
        representable in the target character set. Meanwhile, Meta appears
        to do nothing at all if combined with anything not in the 00-7F
        range, be it a character outside that range or a multi-character
        sequence from a function key.


Too much complex for me. I think is better by default send ESC, and add some
sequences for rmm and smm (of course add rmm to is2). If a user want
activate meta8 mode only has to write: "tput smm". And in this case he
should know that applications he is using don't deal with utf8 encoding.
Received on Tue Apr 23 2013 - 13:58:02 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 23 2013 - 14:00:14 CEST