Re: [hackers] [st][patch] Handle DECRQM (Request Mode) escape sequences

From: François-Xavier Carton <fx.carton91_AT_gmail.com>
Date: Tue, 1 Dec 2020 00:34:54 +0100

On Mon, Nov 30, 2020 at 02:32:27PM +0100, Hiltjo Posthuma wrote:
> On Mon, Nov 30, 2020 at 12:56:13AM +0100, François-Xavier Carton wrote:
> > On Sun, Nov 29, 2020 at 05:37:30PM +0100, Hiltjo Posthuma wrote:
> > >
> > > Hi Francois,
> > >
> > > First: thanks for the patch.
> > >
> > > Do you have maybe a practical use-case example why you'd like to request
> > > supporting this?
> > >
> > > In all st years it has not been requested before. I'd like to prevent
> > > obscure/non-tested features. Although maybe it's not so obscure and useful, in
> > > that case please say so :)
> > >
> > > --
> > > Kind regards,
> > > Hiltjo
> >
> > Hi Hiltjo,
> >
> > Well, I guess that if it's not been requested before, then it's not a
> > highly used feature. And I do understand your concern about that.
> >
> > I implemented this because I wanted to use that feature in one of my
> > programs (and the only terminal emulator I have installed is st). More
> > precisely, the program switches to alternate screen at the beginning,
> > and restores normal screen at the end. However, this can break things
> > when run under another program that does the same thing (eg. vim, less,
> > ...). So in my program, I wanted to test whether alternate screen is
> > enabled at the beginning, and if so, omit switching back to normal
> > screen at the end.
> >
> > The reason I posted the patch here is 1) to get feedback; and 2) if this
> > is deemed useful to have, I'd rather have it mainlined than maintain it
> > separately, as the patch makes changes in core functions.
> >
> > That being said, I understand why you would like not to support this, as
> > the feature is rarely used.
> >
> > Best,
> > François-Xavier
> >
>
> Hi Francois,
>
> Thanks for the detailed reply.
>
> Maybe you could use the tcsetattr and tcgetattr interfaces. This is the more
> common way to handle that from what I've seen and it should work on many
> systems.
>
> In a nutshell:
>
> Store (at startup):
> tcgetattr(0, &tsave);
> <change properties and set)
>
> Restore (at cleanup on exit):
> tcsetattr(0, TCSANOW, &tsave);
>
>
> To set application mode you could use curses "enter_ca_mode" and "exit_ca_mode"
> (smcup, rmcup):
>
> https://man.openbsd.org/terminfo.5
>
> --
> Kind regards,
> Hiltjo
>

Hi Hiltjo,

Thanks for the pointers.

I already use tcgetattr/tcsetattr (to enter raw mode, disable echo, ...). I
don't use curses, as I'm trying to keep the source code simple, but I'll check
the source code of {enter,exit}_ca_mode. Hopefully, I'll eventually find out
what is causing my terminal to get messed up :)

Best,
François-Xavier
Received on Tue Dec 01 2020 - 00:34:54 CET

This archive was generated by hypermail 2.3.0 : Tue Dec 01 2020 - 00:48:32 CET