This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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>

Attachment: pcon-output-dumb.log
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]