[PATCH 2/2] Cygwin: pty: Disable clear screen on new pty if TERM=dumb or emacs*.

Takashi Yano takashi.yano@nifty.ne.jp
Thu Sep 5 01:13:00 GMT 2019


On Wed, 4 Sep 2019 11:22:42 -0600
Brian Inglis wrote:
> That output seems to be generated by a shell or program running in the pty.
> If the recipient can not handle escape sequences, then the shell or program in
> the pty should be configured by setting e.g. TERM=dumb when launching the
> terminal, or in the shell environment.

No. Output is almost same even if setting TERM=dumb.
See attached log.

Consider what should be the output of pseudo console if console
application like below is executed.

#include <windows.h>

int main()
{
    HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
    COORD p = {20, 10};
    DWORD n;
    SetConsoleCursorPosition(h, p);
    SetConsoleTextAttribute(h, FOREGROUND_RED);
    WriteConsole(h, "R", 1, &n, 0);
    SetConsoleTextAttribute(h, FOREGROUND_GREEN);
    WriteConsole(h, "G", 1, &n, 0);
    SetConsoleTextAttribute(h, FOREGROUND_BLUE);
    WriteConsole(h, "B", 1, &n, 0);
    SetConsoleTextAttribute(h, FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
    WriteConsole(h, "W", 1, &n, 0);
    WriteConsole(h, "\r\n", 2, &n, 0);
    return 0;
}

Setting cursor posision and text color cannot be realized
without ANSI escape sequences.

Indeed, the output of the pseudo console by the program above is:
^[[?25l^[[11;21H^[[?25h^[[?25l^[[31mR^[[32mG^[[34mB^[[mW^M
^[[?25h

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pcon-output-dumb.log
Type: application/octet-stream
Size: 1757 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20190905/a4d425d9/attachment.obj>


More information about the Cygwin-patches mailing list