Share via

Unexpected ANSI sequence behavior in CMD.exe

Anonymous
2022-06-05T01:37:29.16+00:00

![208435-image.png][1] [1]: /api/attachments/208435-image.png?platform=QnA On the left you can see the result of an underline text attribute being applied to the console screen in Windows Terminal, and a message being displayed. On the right you can see the same operation done on cmd.exe. Both terminal windows were resized, however the display on CMD is messed up. It seems like the attributes were applied everywhere. Why is this happening? How do I avoid this behavior on the console? The application (tat) is using ANSI sequences with ENABLE_VIRTUAL_TERMINAL_PROCESSING enabled to affect these attributes.

Windows development | Windows API - Win32
Developer technologies | C++
Developer technologies | C++

A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.


1 answer

Sort by: Most helpful
  1. Stanislav 1 Reputation point
    2022-06-06T07:11:05.75+00:00

    VT emulation on Windows is very bad.
    My advise - not to bother too much.

    PS Graphics rendition is a responsibility of "ESC [ <n> m SGR" command.
    https://vt100.net

    PPS Even Linux terminals can't do it 100% proper way.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.