Search code examples
terminaltelnetansi-escape

ANSI Escape Sequences


I need help identifying what these ANSI escape sequences represent. I'm currently filtering/evaluating the ANSI codes in a terminal screen reader I'm writing, but I'm not sure what these are.

Escape Sequences:

[0;1mm

[0;1;;4m

I'm using the below chart of escape sequences as reference: http://ascii-table.com/ansi-escape-sequences-vt-100.php


Solution

  • ECMA-48 is the primary source of these.

    As to your specific examples:

    [0;1mm
    

    Is SGR (select graphic rendition) 0 and 1, followed by a normal unescaped m. SGR 0 resets all the rendition attributes, 1 enables bold.

    [0;1;;4m
    

    Is SGR 0, 1, 4. 0 resets, 1 enables bold, 4 enables single underline.


    EDIT: Actually, I believe this second example is equivalent to

    CSI 0;1;0;4 m
    

    which resets, enables bold, resets a second time, then enables underline. So overall, only enables underline, not bold.