From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by sourceware.org (Postfix) with ESMTPS id 5F01C3857400 for ; Wed, 5 May 2021 13:07:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5F01C3857400 X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [172.28.146.104] ([89.1.212.20]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N17YY-1lX5Rh2n98-012aCa; Wed, 05 May 2021 15:07:07 +0200 Date: Wed, 5 May 2021 15:07:04 +0200 (CEST) From: Johannes Schindelin X-X-Sender: virtualbox@gitforwindows.org To: Kevin Locke cc: Takashi Yano , cygwin@cygwin.com Subject: Re: Screen clearing in CMD without "Legacy Console Mode" In-Reply-To: Message-ID: References: <20210430235358.2ae6daa41e3f0b6cb0daa173@nifty.ne.jp> User-Agent: Alpine 2.21.1 (DEB 209 2017-03-23) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Provags-ID: V03:K1:VbL0AQtrX1KTybowGFYeiv8gqv0LPecdhREltEZY4CA0ONKVmvG x43VxH3/6+hYNGEIHzsY7IN0jbxdoQakKDg6OYCW16R3+idrrj/MzelmRip2J4Hj6z6nk5X S2VJxubwHJkdsNRL02V8s3Pjb5AMU/bP6dM62YjeOtW2JZt2P4NGAt6h85C9zHtCh2Afd0d 7K7v6hmc8gcgH3Y21X28g== X-UI-Out-Filterresults: notjunk:1;V03:K0:YE07QqqFpMw=:H5coGkiyyx+kOziKEUz87L IizVm6DQ6oofUPs6o1KIbwtRJRuKax8AKNEI84Si9AjVEPh+jJp/Iwt9uS+g+sYF7QFsXL5MC 8Um8zcnb6mvS+bVlYgdQKuZqoa2AgbhVUfJT6N47HGXplTQ/mcePDx4OmfYzN6iYpG5ddMemY D+IPaCHUXdhZ+Vgj6jaQJikGqumoX2gz/kAgGDiTgDfmNsr9uq8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XclkfpWLDpm Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 13:07:24 -0000 Hi, On Fri, 30 Apr 2021, Kevin Locke wrote: > On Fri, 2021-04-30 at 23:53 +0900, Takashi Yano wrote: > > On Fri, 30 Apr 2021 08:25:12 -0600 Kevin Locke wrote: > >> 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=3Dcygwin is set in the environment, the console is not cleared w= hen > >> vi exits. To demonstrate, with Cygwin 3.2.0, in CMD with "Legacy > >> Console Mode" disabled: > >> > >> cd C:\cygwin64 > >> set TERM=3Dcygwin > >> 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 conso= le > >> difficult until cleared. > > > > Why on earth do you want to set TERM=3Dcygwin? > > If you don't set TERM=3Dcygwin, TERM is automatically set to > > xterm-256color, in which the issue does not occur. TERM=3Dcygwin would be correct right until the time when you toggle `ENABLE_VIRTUAL_TERMINAL_PROCESSING` under our feet. That is, when the Cygwin process is called, this flag is not set, so `TERM=3Dxterm-256color` would be incorrect. And then when the Cygwin proce= ss returns, the flag is set, and the calling process should somehow guess that `TERM` should be set differently. Oh, and you probably expect the caller to then figure out whether the flag was _actually_ toggled, just in case we're running on a Windows 10 version that is too old to understand that flag. If you expect CMD to be no longer used after the Cygwin process returns, that might be a valid world view. But that is probably not a very tenable world view. If Cygwin is unable to handle `TERM=3Dcygwin` correctly when `ENABLE_VIRTUAL_TERMINAL_PROCESSING` is toggled, then Cygwin should definitely, absolutely, with 100% certainty _not_ toggle that flag when `TERM` is already set to `cygwin`! Ciao, Johannes > Unfortunately, I am not clear on that myself.[^6] According to Johannes > Schindelin[^7]: > > > We specifically set TERM so that Cygwin (or more correctly, the MSYS2 = runtime) uses ANSI sequences... > > Hopefully he (or another of the Git for Windows contributors) can add > more specifics. > > Thanks, > Kevin > > [^6]: https://github.com/git-for-windows/git/issues/3177#issuecomment-82= 8507812 > [^7]: https://github.com/git-for-windows/git/issues/3177#issuecomment-82= 6834976 >