public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "André Bleau" <andre_bleau@hotmail.com>
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: Re: Problems with a combination of a mingw program, mintty, and CYGWIN=disable_pcon
Date: Thu, 7 May 2020 14:41:17 +0000	[thread overview]
Message-ID: <MN2PR04MB6384D262345C802BBCB0ADAA93A50@MN2PR04MB6384.namprd04.prod.outlook.com> (raw)
In-Reply-To: <20200507191707.48a948b5c573592d9d293f7a@nifty.ne.jp>

Takashi Yano wrote:
________________________________________
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
________________________________________

Hi Takashi. Thanks for the quick response. Adding these lines of codes to my program and to the simple test case mentioned
solved the problem of gaps in lines when run from mintty with pcon enabled.

However, it does not solve the problem of mintty misbehavior when started from a bash script to run the same program. 
Maybe this is a problem that Thomas Wolf would be interested in.

Regards,

- André Bleau

      reply	other threads:[~2020-05-07 14:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-07  3:38 André Bleau
2020-05-07 10:17 ` Takashi Yano
2020-05-07 14:41   ` André Bleau [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MN2PR04MB6384D262345C802BBCB0ADAA93A50@MN2PR04MB6384.namprd04.prod.outlook.com \
    --to=andre_bleau@hotmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).