The terminal escape sequences ocean is deep and dark
ethanheilman.com
ethanheilman.com
When developing terminal services, you're standing on the shoulders of giants and must account for 30+ years of terminal hackery. The up-side is you can also use that same terminal hackery for fun things like progress bars, emoji's, colors, blinking (ux faux pas) for attention, spinners, tables, and yes - even matrix rain effect by positioning cursors and clearing partial screen coords. [1]
Another fun one was asking the terminal how big it is [2] (and also figuring out the modem speed as a side effect) -- especially when a major telnet client fails as soon as the width is above 256 characters [3]...
Both of these would have been simple if the terminal is a local one, but the fun part is dealing with an unknown implementation at the other end of tcp - and the fact that that's even possible :-)
[1]: https://github.com/9001/r0c/blob/master/r0c/ivt100.py#L1651-...
[2]: https://github.com/9001/r0c/blob/master/r0c/ivt100.py#L625-L...
[3]: https://github.com/9001/r0c/commit/5e7d64d7f81cab3350259b0cd...
The modern experience of a laser emitting sheets long after you think you've killed the rogue non-PPD non-PDF input stream, is analogous.
2) Laugh as your friend's terminal goes audibly berserk, drawing the attention of everybody in the computer lab.
3) Apologize for getting your friend in trouble with the printing office.
One time, I forgot to add the check to the queue, and I got aroused from my Friday hijinks with the alarming call that the Halon system had gone off and our operator wanted my blood. The printer had actually caught fire, due to 20,000 missing LF characters putting every single line on the same character (carriage return), burning a hole in the platen and yeah .. setting off the Halon.
That's when I learned, as a junior programmer, the value of pipes.
Sounds like a perfect BOFH episode.
The day I got my own pizzabox and ethernet connection, and thus didn't ever have to bother an Operator for access to anything, ever again, was another big step up in the career path I chose for myself .. still, I miss those grumpy old fuckers. They had good stories to tell, usually, and I still 'sync;sync;sync' to rewind tape, now and then, by muscle memory ..
Is it Wangers? A wank? Management? Parliament/senate?
It's impossible to even find them all; there were no standards (until the ANSI controls were standardized quite late in the process) and every terminal mfr (most of whom are long dead) made their own. Eventually many started by copying the VT100 set, because DEC was a big company, but even then they'd implement a subset and/or add more. And of course there would be namespace collisions. So yes, no terminal ever supported all of them, and that wouldn't really make any sense.
As for soft terminals (terminal emulators): just pick a terminal (the old hardware kind I mean) that's in the termcap database and implement only what it does. ANSI is a good default.
(none of this makes the author's problem any easier; just expanding on one part)
When I wrote my own terminal emulator and client it was easier to just start from scratch.
Just support a reasonable subset of xterm and telnet. You don't need to delve into support libraries for physical terminals that haven't existed for decades.
That doesn't work, though. Not reliably.
They couldn't have chosen a better 4-digit number for that one.
this involved writing tables using a limited regex-like language, a bit like termcap/terminfo on unix. you could actually load a revised table (these things were difficult to debug) while the 7171 was running, and even sometimes get away with it, without crashing all user sessions.
like all ibm kit of that era (mid 80s) the thing was beautifully built and documented
It's impossible. There's too much legacy stuff, it would be like boiling the oceans, and there's both no real glory to be had and no money to be made.
Oh, and for the legacy stuff. Since there is no real API, everyone did as they pleased, for the new protocol/standard/tools to take off they would either have to be amazing and almost completely supersede existing stuff (ultra hard) or to offer backwards compatibility, which the lack of the API would make it a humongous software undertaking. I've been watching what the Oil shell is doing to just extend Bash in a smart way, and the amount of work going into just that is mindboggling.
You'd need a madman (more likely, several) like Lennart Poettering and look at what did, it got him death threats for writing software and getting it adopted.
Well, it's kinda happening, finally, right? The oceans and atmosphere heating up? So not impossible.
You'd have your high level CLI which would call programs, those programs would provide:
1. input and output in form of JSON services. This would function like a modern pipe functionality,
2. a CLI UI which talked to those services. This CLI can swapped out for another at the callers digression,
3. a built in debugging and code reading system similar to developers console in modern web browsers,
4. and hooks for intercepting calls made outside the program either to the OS or the dynamic libraries like LD_PRELOAD
In some sense it would replace the terminal with a web browser like CLI. Unlike a web browser you'd be able to mix and match CLI UIs and pipe processes together.
I'm not convinced that is a good idea. The beauty of terminals and the power of being about do stuff like process substitution largely comes from the use of simple abstractions. Would a JSON based pipe be less or more powerful than pipes as they are today? I suppose you could always use a utility to strip the JSON and turn it into the newline text streams that the commandline today is so good at manipulating.
I've always wanted a virtual terminal that had a terminal state stack, when you run a command or open a program, all the changes to the terminal are pushed on the top of terminal stack. When I quit the program or the command stops, the state is popped. It seems like it would be very difficult to implement such a thing in the current terminal framework because as far as I can tell, they do not understand when a command starts or stops. Then again the effectiveness of virtual terminals over the last 5 or so decades is likely because of this simplicity and its corresponding flexibility.
You could probably have a push/pop escape sequence requiring a matching unique token that intermediate output can't guess.
OSC 57473 ; 1 ; <token> ST
⋮
OSC 57473 ; 0 ; <token> STMy bash prompts have all been dead boring by comparison.
I have to say I'm impressed you read that far and found my error. I enjoy the fact that I can post something technical like this and someone would read this much into the details. I debated writing up my debugging notes. I might try writing up more of my debugging notes.
Made my day, thanks!
(Remember the XML craze a few years back? Probably not, and that's a good thing.)
If it's designed by a small team for this specific use case, not to take over the universe.
But then the question becomes, who assembles this small crack team, and for what?
Why would they get paid? Who would pay them?
This is like basic research, more or less. Nobody wants to pay for it, but everyone would want now the benefits of the resulting awesome offshoots 20 years into the future.
27 ..... b1 ..... I am amazed this person wrote an entire article and never once noticed the absurdity.
The absurdity that a number less than 32 would start with b in hex instead of 1.
The absurdity of making this mistake consistently in a post about diligently fixing bugs and not proofreading or checking it.
How does one not notice this?
> How does one not notice this?
coz people skip funny magic numbers when reading
Trivially easily?
Wait 'til you hear about the C1 control set (§5.3 in the current version of ECMA-48).
> Gen z programmers, not even once.
I know I shouldn't even reply to this, but I'm old enough that I have used physical 8-bit ASCII terminals with C1 controls (and ISO 2022 page switching).
Thanks for the feedback.
If I see 345,345,345+123,123,123=578,578,578,578 I probably wouldn't notice that this is incorrect but once I decide to really look at it the three errors are obvious.
These aren't just funny codes, there is a whole mindset behind it. ASCII being grouped in chunks of 32. Being able to flip between uppercase and lowercase by flipping a bit. The history of upper 8-bit codepages in DOS.
And I didn't even comment on the fact that your "byte" uses 16-bit notation.