Problems with a combination of a mingw program, mintty, and CYGWIN=disable_pcon
Takashi Yano
takashi.yano@nifty.ne.jp
Thu May 7 10:17:07 GMT 2020
Hi André,
Thanks for the report.
On Thu, 7 May 2020 03:38:25 +0000
André Bleau via Cygwin <cygwin@cygwin.com> wrote:
> Hi cygwin users,
>
> I have cli program that I run with mintty. It is a simple C++ program, reading from cin and outputing to cout. It is cross-compiled as a mingw program. I've been running it without problems fro over 2 years. Recently, I updated cygwin to 3.1.4-1 and noticed the pcon support. Since then, the output of my program has been messy: output lines have intermittent gaps in them. I made a simple test case that reproduces the problem, from the following simple C++ file, hello.cpp :
>
> #include <iostream>
> using namespace std;
> static string Green = "\033[32m";
> static string Yellow = "\033[33m";
> static string Reset = "\033[0m";
To use escape sequences in pseudo console, please add the following
code just like in normal cosole (command prompt).
#include <windows.h>
...
DWORD mode;
GetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), &mode);
mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), mode);
This should solve your problem.
--
Takashi Yano <takashi.yano@nifty.ne.jp>
More information about the Cygwin
mailing list