There's no escaping it: an exploration of ANSI codes (blog.safia.rocks)

26 points by ankitg12 3 days ago

9 comments:

by kevin_thibedeau 4 minutes ago

> Even fancier terminal UIs, like Vim and htop, extend the ANSI codes for cursor positioning and screen manipulation

These aren't an extension. They're either part of ECMA-48 like the color codes or legacy from VT52/VT100 that has become de facto standard.

by daneel_w 3 hours ago

I am not sure if it's part of the ANSI standard, but the AmigaDOS shell supported a set of ANSI codes that provided single line stepping - not a whole text line/row, but a single raster line - allowing for pretty advanced graphics rendering by overlaying rows of text shifted by just one or two pixels vertically. It was a tad fancier than the very common ASCII art, being used in the same venues and always a "treat" to come across, though not as common due to the size and additional time needed to render.

by mspreij 3 days ago
by trumpdong 3 days ago

I was expecting something more... informative?

by kps 4 hours ago
by JdeBP 3 hours ago

I recommend starting with ECMA-35. The actual structure of escape sequences is explained there. Otherwise it gets lost that it's the ESC [ that is the entire escape sequence, an alternative form of CSI, and that this actually is one part of an entire mechanism of escape sequences with intermediate and final bytes. It's a control sequence that CSI then introduces.

by kevin_thibedeau 17 minutes ago

The important part is that the escape prefix is just an alternate way to represent each of the 32 C1 control characters with a pair of 7-bit characters.

by Lerc 2 hours ago

I have never quite found a full and comprehensive catalogue of escape sequences. I think the last time I needed a list, I found a developer of a terminal app(might have been kitty?) had a page with what they had found.

This isn't no much a specification as a collection of variously supported codes.

Some have been deliberately killed off (like setting the window title to the string returned from a commandline string). An escape code so powerful that it gives text files shell access.

by noelwelsh 3 days ago

This would be far better without the slop and just the widget with a little bit of explanatory text.

Data from: Hacker News, provided by Hacker News (unofficial) API