[Toybox] [PATCH] clear.c: Clear scrollback buffer on non-vte (gnome based) terminals

enh enh at google.com
Tue Mar 5 16:31:51 PST 2024


On Tue, Mar 5, 2024 at 4:01 PM Oliver Webb via Toybox
<toybox at lists.landley.net> wrote:
>
> (Yes, I did read "I believe there is no point in continuing this conversation.",
> but there are still some questions and statements I feel the need to respond to)
>
> On Tuesday, March 5th, 2024 at 16:32, Mouse <mouse at Rodents-Montreal.ORG> wrote:
> > except for a recent spate of programs that insist on
> > throwing X3.64 at me even when $TERM gives them no reason to think it
> > will work (that becomes really obvious, when ESC does nothing!)
>
> This is one of those programs. And has always been back to whenever it was first
> made, so is toybox vi and probably toybox top as well.
>
> Admittedly, I haven't been a developer for very long, but you are the only
> person I've ever seen that does not use ANSI escape codes,
> at least from my standpoint, your problem is not widely shared.
>
> > > The vast majority of terminals from probably at least the last 25
> > > years have ANSI escape code (X3.64) support.
> >
> > So, the last 25 years are all that matters to you?
>
> TL;DR: Yes.
>
> To Paraphrase design.html:
> One of the design goals of toybox is to be as simplistic as possible,
> while still being as fast, small, and feature-full as possible. A
> general rule is that you should be able to implement 80% of the features
> you need before you have to start compromising on speed, features, smallness,
> or simplicity. From there, complexity is a budget, and you should spend it implementing
> the most sensible things.
>
> I'd much rather spend complexity implementing something else than rewriting
> terminfo from scratch.
>
> Portability falls under "full-featured", and trying to
> support platforms and strange implementations from over 25 years ago
> creates GNU-like code full of ifdef's and other ugly, complex, ambiguous things.
> Any terminfo implementation would be massive, terminfo thousands of terminals
> to check, over 150 ways to clear the screen, even if you strip that down it's still bad
>
> We have a 7-10 year support horizon, How many terminal escape protocols have been relevant
> in the last 10 years: One. The story is the same for UTF8 and LP64

(to be fair, toybox does support ILP32 too, not just LP64 --- it's
just weird stuff like Windows' LLP64 that's explicitly out of scope
aiui.)

> > Also, I don't recall seeing anything in X3.41 or X3.64 for scrollback
> > manipulation; as far as I can recall, it doesn't mention anything like
> > scrollback. The closest I find in my notes with a few quick greps are
> > CSI ... U and CSI ... V, which aren't a very good fit to most
> > scrollback implementations I've seen.
>
> \e[3J is a widely implemented extension (so is \ec), not standardized, but
> linux tty's, VTE terminals (gnome-terminal and the dozen derivatives of it),
> st, xterm, kitty, and tmux all have it. And probably more that I haven't tested yet.
> I haven't found a terminal without support for it, which is why I decided to use it.

fwiw, i just tested and that sequence works (and has the expected
effect) on macOS' terminal too.

> > > Terminal manipulation is what X3.64 codes are for
> >
> > Indeed. And communication is what German is for. But I, at least,
> > don't expect everyone to speak German,
>
> Comparing terminal manipulation codes to human languages isn't very
> accurate. The difference between X3.64 and "the rest of the protocols"
> is much more like the difference between ASCII and EBCDIC. Or Linux and
> the rest of the unix-es (HP-UX, Solaris, SunOS, Hurd and Minix to some extent)
> that were relevant in the unix wars.

(ouch! i'm offended on their behalf that IRIX -- and even godawful
AIX! -- don't make your list, but "hurd" does :-) i honestly still
don't believe hurd actually exists! i've never seen it, whereas i've
actively used all the others you mention, plus the two i just
mentioned, and Tru64 too. if you want "obscure but definitely a real
thing", how about Plan 9?)

> A very long time ago, different standards were relevant. Then after some dispute, one won out over
> the other. And since 99.9% of people use one, us spending time and complexity
> writing support for both is annoying, pointless for all except the 0.1% of people
> who use another protocol, and detrimental for the 99.9% of people who have agreed
> on the standard (more code is harder to maintain, non-portability creates ifdef forests, etc)
>
> Portability to older/different things is good, but replicating terminfo in toybox would kinda be
> like adding EBCDIC help text. Times have changed and people use, implement, and write stuff for
> the _one_ thing everyone uses.
>
> > nor any other single language.
> > Nor do I expect all terminals to speak any single control/escape
> > sequence language.
>
> The vast majority (Every modern terminal I've ever seen) of them do, which is why I expect it.
>
> > I...see.
> >
> > I believe there is no point in continuing this conversation.
>
> I'll stop replying beyond this then if you believe there is nothing to add
>
> -   Oliver Webb <aquahobbyist at proton.me>
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net


More information about the Toybox mailing list