#ECMA48

2025-12-19

@nixCraft

Tried it. It didn't clear the screen.

#terminals #FormFeed #EraseDisplay #UnixShells #ECMA48

A white on black terminal display showing two shell prompts.  The cat command has been run, and the output of pressing Control+L, then enter, then Control+C is shown.
2025-12-19

@lemgandi

Surprisingly, to those of us who grew up with home computers, that's not truly the case.

unix.stackexchange.com/a/59361

#terminals #FormFeed #EraseDisplay #ECMA48

2025-09-09

As someone who has done a fair amount of code dealing with ECMA-35 and ECMA-48, today I discovered that node has a has-ansi package.

It is on version 6. It is 7 lines long. It requires 2 other packages. And it is marked beta.

There's an entire separate package with a complete infrastructure of its own for a single regular expression.

This degree of incohesion is mad.

@ska @dalias #node #npm #ECMA48

2025-06-15

I have turned inverse screen on with DEC private mode 5, to give myself the old-time Sun workstation black-on-white framebuffer console experience on the cheap.

Unfortunately, ncurses programs like vi emit a "visual bell" out of the box, instead of the BEL character, because this was the new friendlier way to do bells in shared offices in the 1980s. I remember it.

vb turns private mode 5 on and then off again, because there's no #DECVT control sequence for toggling the current state.

#ECMA48

2025-06-08

@stafwag

All in all, getting it right, and compatible with what's out in the world, is quite a task. Many of us end up with entire DEC VT state machines. Because it turns out that it's perfectly legitimate to emit some C0 control characters in the middle of a control sequence. I kid you not.

#ECMA35 #ECMA48

2025-06-08

@stafwag

And then once control sequences are parsed correctly, on top of that there are four different types of control sequence used in the wild for setting colours: old AIXterm, XTerm 256-colour, ITU/IEC T.416 faulty, and ITU/IEC T.416 correct.

There's a whole history of a missed field and erroneous use of semi-colons instead of colons, for the ITU/IEC T.416 faulty case.

Plus the "default" colour.

Plus multiple graphics rendtions in a single control sequence.

#ECMA35 #ECMA48

2025-06-08

@stafwag

Colours in ncurses. Ouch!

Your SGR parser is a bit simplistic. The basic syntax of control sequences in ECMA-35 and ECMA-48 is a bit more complex than that. More than digits can be parameter characters, and there are intermediate characters to contend with too. Plus there's true CSI rather than its 7-bit alias.

#ECMA35 #ECMA48

2025-05-25

I don't know what #less is trying to do, here, without looking at the source; but there's not a terminal in existence that I know of where using CUB to overprint "ESC" with "ESC" actually achieves something.

write(1,"\^[[m\n:\^[[K",8) = 8 (0x8)
write(1,"\r\^[[K \^[[KESC\^[[D\^[[D\^[[DESC",23) = 23 (0x17)
write(1,"\^[[K[\^[[D[",8) = 8 (0x8)
write(1,"\^[[KB\^[[DB\r\^[[K",12) = 12 (0xc)

#ECMA48

2025-05-03

Why DEC modifiers less 1? Because adding 1 was a bodge for the days when missing parameters defaulted to 1. Default to 0 has been in ECMA-48 since the 1990s.

Why keyboard⇒DEC-like? Because the keyboard page is where the old non-DEC terminal keys like ExSel, Oper and Again live, and this can easily encompass those in sort-of-DEC-VT manner.

Why consumer⇒SCO-like? Because SCO's extensions tend to deal in PC-like stuff that isn't like old terminals, like AL/AC keys.

#TerminalEmulators #ECMA48

2025-05-03

Here's what I invented:

It's the #ECMA48 FNK control sequence with leading parameter characters for private extensions:

USB keyboard page keys have a leading '?' (modelled after DEC extensions).

USB consumer page keys have a leading '=' (modelled after SCO extensions).

Key numbers are the USB usage codes in those pages. Modifiers are encoded as a sub-parameter, DEC values minus 1, allowing multiple keys per control sequence. Sub-parameters default to 0.

#nosh #uservt #TerminalEmulators

A white-on black virtual terminal screen, where the console-decode-ecma48 command has been run with the --input parameter.  Various input control sequences (in 7-bit human-readable form) are shown decoded to the names of various "multimedia" and "office" keyboard application launch and application control keys; the ends of input lines decoded as "LF".
2023-06-29

Re: portal.mozz.us/gemini/thrig.me

There's even more rabbit-hole than this.

For example: It's largely a myth that Form Feed clears the screen, or even ever did, despite what reams of introductions to programming in C say.

(continued...)
#FormFeed #ECMA35 #ECMA48 #VDUs #CProgramming

2023-05-23

It's amazing to see the built in X text window in cacaflame actually run faster, tunnelled over the exact same SSH connection, than sending the original text and colour control sequences to a terminal emulator to have the terminal emulator render them locally instead of the X server.

It says something about how bloody inefficient streamed ECMA-48 text is. There's a reason that back in the BBS days, people were inventing binary protocols such as AVATAR.

#ECMA48 #X

2023-05-22

@jhx @meka

Note that boldface red is not universally bright red. That's a CGAism that the world is gradually seeing rid of. SGR 91 is unequivocally bright red.

Also, SGR 39 is a convenient way of going back to the default colour.

#ECMA48

2023-05-03

MobaXTerm fares somewhat better, getting REP of non-BMP characters right.

But conversely it seems unable to comprehend unscii-16, and insists upon unscii font glyphs being only 8 lines high, resulting in massive gutters between rows.

And only unscii has the glyphs for MouseText. They're not in Cascadia Mono, for example.

#MobaXTerm #MouseText #Unicode #ECMA48

A screenshot of some MouseText art, depicting a window with title bar and scrollbars in black on white text.A screenshot of what is supposed to be black on white MouseText, but greeked because the font used does not have the glyphs.
2023-05-03

Microsoft Terminal goes badly wrong when REP is combined with characters outwith the BMP. Microsoft Terminal Preview is better, but still goes wrong sometimes when (as in the second image here on the bottom scrollbar) told to REP a character.

#MicrosoftTerminal #MouseText #Unicode #ECMA48

A screenshot of Microsoft Terminal showing what is supposed to be some (monochrome, white on black) MouseText art, that has been completely messed up.A screenshot of Microsoft Terminal Preview showing some (monochrome, white on black) MouseText art of a window with titlebars and scrollbar, that has been slightly messed up on the bottom scrollbar.
2023-04-22

@RL_Dane @teamtuck

XTerm, urxvt, GNOME Terminal, and Konsole all have it. As has my terminal emulator. You just have to output the DECSCNM control sequence, just as you would with a real DEC VT.

#DECVT #ECMA48 #T416 #terminal

2023-04-22

@RL_Dane @teamtuck

Try inverting the screen and switching between DEC VT520 "light" and "dark". (As you can see, my toolkit has a handy tool for doing this, but it's a simple exercise in printf(1) without.) If that's not satisfactory, then fiddle with the #terminal emulator's palette configuration.

There's nothing that you can do otherwise. In GUIs, applications have "Give me the user's choice of title bar colour" library calls. There's none of that for Unix TUIs.

#T416 #DECVT #ECMA48

2023-04-21

@RL_Dane @teamtuck (continued...)

The _only_ control that you have is DECSCNM, an extension to ECMA-48 control sequences from DEC VTs that many terminal emulators (sort of, rxvt getting it wrong, for example) also support.

It basically inverts the sense of the SGR 7 (negative image/reverse video) attribute for the entire display. DEC VT520 doco called it "light" and "dark".

vt100.net/docs/vt510-rm/DECSCN

jdebp.info/Softwares/nosh/guid

#DECVT #ECMA48 #T416

A terminal emulator window showing several multicoloured Z shell prompts, with inverted screen set on.  The commands being run are "setterm", with a variety of environment variables set to adjust the terminal type, setting the foreground colour to red and turning inverted screen on and off; piped through "console-decode-ecma48", which then outputs the control sequences used.A terminal emulator window showing several multicoloured Z shell prompts, with inverted screen set off.  The commands being run are "setterm", with a variety of environment variables set to adjust the terminal type, setting the foreground colour to red and turning inverted screen on and off; piped through "console-decode-ecma48", which then outputs the control sequences used.
2023-04-21

@RL_Dane @teamtuck (continued...)
How the ECMA-48, #AIXTerm, and ITU T.416 indexed colours come out is up to the #terminal; as is, indeed, how the default colour comes out.

For these indexed colour schemes there's usually a palette that maps to RGB. Some terminal _emulators_ can adjust the palette. But real terminals didn't even have the 256-colour indexed system, let alone palettes.

The applications pretty much have no say.

#DECVT #ECMA48 #T416
(...continued)

2023-04-21

@RL_Dane @teamtuck

The colour #terminal paradigm just doesn't work that way.

Applications can pick from the 8 colours of ECMA-48, or from that plus the additional 8 colours from IBM #AIXterm, or from the 256 indexed colour set of ITU T.416, or from the full ITU T.416 RGB direct colour system.

There are no "modes" or "themes". An application asks for the default colour, or for an explicit ECMA-48, AIXterm, T.416 indexed colour, or RGB direct colour.

#DECVT #ECMA48 #T416
(...continued)

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst