-
Hi, when I switch to an alternate screen buffer using virtual code And the alternate screen is software-based that isn't handled by underlaying API's. At the same time, the buffer created in Windows API is successfully closes using the ANSI ESC code If it's not, how would I be able to detect from Windows Console API that the screen is switched. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I don't think you can detect the alternate buffer status with a Console API call, and if you could, it's probably not something you should rely on. However, you can query that state with a standard
That said, you should be aware that not all terminals will respond to |
Beta Was this translation helpful? Give feedback.
I don't think you can detect the alternate buffer status with a Console API call, and if you could, it's probably not something you should rely on. However, you can query that state with a standard
DECRQM
escape sequence. If you output\x1b[?1049$p
, you should get back one of two responses:\x1b[?1049;1$y
if you're in the alternate buffer\x1b[?1049;2$y
if you're in the main bufferThat said, you should be aware that not all terminals will respond to
DECRQM
, and it has only been supported in Windows Terminal since version 1.17.