From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin@cygwin.com
Cc: Kevin Locke <kevin@kevinlocke.name>
Subject: Re: Screen clearing in CMD without "Legacy Console Mode"
Date: Fri, 30 Apr 2021 23:53:58 +0900 [thread overview]
Message-ID: <20210430235358.2ae6daa41e3f0b6cb0daa173@nifty.ne.jp> (raw)
In-Reply-To: <YIwTSMfJu9uMwrKn@kevinlocke.name>
On Fri, 30 Apr 2021 08:25:12 -0600
Kevin Locke wrote:
> Hi All,
>
> I'm investigating an issue in Git for Windows[^1], which also affects
> Cygwin. The issue is that, when using CMD (i.e. Command Prompt) on
> Windows 10 1703 or above with "Legacy Console Mode"[^2] disabled, if
> TERM=cygwin is set in the environment, the console is not cleared when
> vi exits. To demonstrate, with Cygwin 3.2.0, in CMD with "Legacy
> Console Mode" disabled:
>
> cd C:\cygwin64
> set TERM=cygwin
> bin\vi etc\bash.bashrc
> :q
>
> After exiting vi, the console window has not been cleared and content
> from etc\bash.bashrc remains visible, making further use of the console
> difficult until cleared.
>
> The difference appears to result from enabling
> SetConsoleMode(ENABLE_VIRTUAL_TERMINAL_PROCESSING) and
> SetConsoleMode(ENABLE_VIRTUAL_TERMINAL_INPUT)[^3] to behave like
> xterm-256color when supported[^4] (they are not supported in "Legacy
> Console Mode").
>
> I'm not too familiar with TTY/PTY handling, much less Cygwin on top of
> CMD. It's not clear to me if the alternate screen buffer behaves
> differently in CMD than xterm, whether Cygwin has any responsibility, or
> if the issue is in how CMD handles ANSI escape sequences. Johannes
> Schindelin suggested it may make sense not to enable virtual terminal
> processing when TERM=cygwin is set.[^5] Thoughts?
>
> Any advice or assistance for how to address this issue would be
> appreciated.
>
> Thanks,
> Kevin
>
> [^1]: https://github.com/git-for-windows/git/issues/3177
> [^2]: https://docs.microsoft.com/windows/console/legacymode
> [^3]: https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/fhandler_console.cc;h=ebe89fc9f8fd9fcb8102ee9884b8b91f04e88fb1;hb=5eb232ede72e394e280d1a23131267c7002d2c52#l464
> [^4]: https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/fhandler_console.cc;h=ebe89fc9f8fd9fcb8102ee9884b8b91f04e88fb1;hb=5eb232ede72e394e280d1a23131267c7002d2c52#l1327
> [^5]: https://github.com/git-for-windows/git/issues/3177#issuecomment-828494565
Why on earth do you want to set TERM=cygwin?
If you don't set TERM=cygwin, TERM is automatically set to
xterm-256color, in which the issue does not occur.
--
Takashi Yano <takashi.yano@nifty.ne.jp>
next prev parent reply other threads:[~2021-04-30 14:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-30 14:25 Kevin Locke
2021-04-30 14:53 ` Takashi Yano [this message]
2021-04-30 15:02 ` Kevin Locke
2021-05-05 13:07 ` Johannes Schindelin
2021-05-06 9:12 ` Takashi Yano
2021-05-06 9:15 ` Takashi Yano
2021-04-30 16:40 ` Brian Inglis
2021-04-30 17:11 ` Takashi Yano
2021-04-30 18:00 ` Jack Adrian Zappa
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=20210430235358.2ae6daa41e3f0b6cb0daa173@nifty.ne.jp \
--to=takashi.yano@nifty.ne.jp \
--cc=cygwin@cygwin.com \
--cc=kevin@kevinlocke.name \
/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).