Hacker News new | past | comments | ask | show | jobs | submit login

How do you add something like this to ANSI ?

I'd like to add annotations to regions of the screen about which file / directory a region mentions.

In this way an aware terminal could let you open files by right clicking in the terminal, or change directory etc.

You could even run a program under the shell to check which files were opened and annotate areas if they are mentioned.




Read ECMA-48¹, which is the free (as in beer) printing of the ‘ANSI’ terminal controls standard. If you want to supply text (like a file name), you'd probably use an OSC command ESC ] Ps ; Pt ST with a Ps that no one else is using. To mark the start and end of a region, you'd probably use a pair of control sequences (CSI) analogous to START / END OF SELECTED AREA, from a private use range.

(The true-color sequence comes from an ITU recommended extension / future version, T.416². It would be interesting for the OP site to list which terminals support the full proposal, including CMY an CMYK specifications, as well as RGB.)

¹ http://www.ecma-international.org/publications/files/ECMA-ST... ² http://handle.itu.int/11.1002/1000/2546-en?locatt=format:pdf


Some terminals already detect URLs by pattern and make them clickable. You could also add an escape sequence to create the annotation you describe, then modify a terminal app to support the sequence. However, terminals don't always display trusted data, so it's very risky to add escape sequences that do anything more than display formatted text.

For example, there are sequences defined to change the title of the terminal window or print to a printer, but they are frequently disabled or left unsupported for security reasons.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: