[PATCH 2/2] Cygwin: pty: Disable clear screen on new pty if TERM=dumb or emacs*.
Wed Sep 4 03:34:00 GMT 2019
On Tue, 3 Sep 2019 20:47:14 -0600
Brian Inglis wrote:
> On 2019-09-03 19:46, Takashi Yano wrote:
> > - Pseudo console support introduced by commit
> > 169d65a5774acc76ce3f3feeedcbae7405aa9b57 shows garbage ^[[H^[[J in
> > some of emacs screens. These screens do not handle ANSI escape
> > sequences. Therefore, clear screen is disabled on these screens.
> Dealing with escape sequences is way out of the scope of any pty driver.
> It is up to the terminal emulator or applications running in the terminal to
> handle terminal characteristics appropriately.
> The pty driver should not touch *ANY* escape sequences coming from the system,
> nor should it generate any to it, as TERM may not be set at the time, or
> appropriately or usefully in some shells e.g. cmd or powershell.
> Most folks probably use mintty or cmd as their Cygwin terminal, but some use
> other terminals, like various flavours of xterm and rxvt, with ssh sessions in
> and out, so they could be on Linux consoles or proprietary AIX/HP-UX/Sun
> terminals, and operate properly as long as they have a good terminfo definition.
> I see this issue as similar to the Windows text file handling changes required
> when coreutils/textutils went POSIX and removed '\r\n' crlf handling to give the
> same results as on Unix systems.
> To handle terminal characteristics properly would require terminfo support in
> the pty driver: I doubt anyone wants that, so the best approach is to do
> nothing, and let the terminal or application handle it: they are more likely to
> have the configuration options or hooks to do so easily.
You are definitely right. However, the essence of the problem is that
the pseudo console itself outputs a lot of ANSI escape sequences
even if client program output only ASCII characters.
Attached is the raw output from pseudo console when the screen shows
the simple text below.
---- from here ----
[yano@Express5800-S70 ~]$ cmd
Microsoft Windows [Version 10.0.18362.329]
(c) 2019 Microsoft Corporation. All rights reserved.
[yano@Express5800-S70 ~]$ exit
---- to here ----
You will noticed that the screen is cleared if you execute
in a terminal which support ANSI escape sequences.
So clearing the screen when creating pseudo console is the result of
compromise to synchronize real screen and screen buffer of pseudo
Takashi Yano <email@example.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 3962 bytes
Desc: not available
More information about the Cygwin-patches