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

Oliver Webb aquahobbyist at proton.me
Thu Mar 7 22:02:18 PST 2024


On Wednesday, March 6th, 2024 at 01:22, Rob Landley <rob at landley.net> wrote:
 
> It's actually "reset" that should yank the tty out of cooked mode, which I
> believe it does now.
> 
> Why we have both "clear" and "reset", I couldn't tell you.

reset sets tty settings while clear doesn't, large enough
difference to probably not make one a OLDTOY pointing at the other.
Although reset does everything clear does

Looking at the man page for reset, it does even more historical stuff that
doesn't matter today, like "-r" which is the same as "reset; echo Terminal type is ${TERM}."
and "-s" which is "reset; echo TERM=$TERM;"

> > Looking more at ncurses clear, what does it do?
>
> Way too much, all of which is historical nonsense.

ncurses clear does seem to have a -x option to save the scrollback buffer.
Not too important but it'd be one line of code to implement ("if (!toys.optargs) xputsn("\e[3J");")

> Toybox produces ansi escape sequences (well, "man 7 console_codes" really, but
> MOSTLY ansi), and OFFICIALLY does not care what the TERM= is set to (or that it
> is set at all) as a matter of policy.

> Toybox assumes Linux.

What is the oldest version of Linux are we planning to support? The nommu stuff seems to have only
been done on 2.4/2.6 kernels from 15 years ago. So is "\e[3J" (A escape code added in 3.0)
something we can use?

-   Oliver Webb <aquahobbyist at proton.me>


More information about the Toybox mailing list