From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from conssluserg-02.nifty.com (conssluserg-02.nifty.com [210.131.2.81]) by sourceware.org (Postfix) with ESMTPS id F0D4D3858001 for ; Fri, 30 Apr 2021 17:11:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F0D4D3858001 Received: from Express5800-S70 (v050190.dynamic.ppp.asahi-net.or.jp [124.155.50.190]) (authenticated) by conssluserg-02.nifty.com with ESMTP id 13UHBBaF028829 for ; Sat, 1 May 2021 02:11:12 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com 13UHBBaF028829 X-Nifty-SrcIP: [124.155.50.190] Date: Sat, 1 May 2021 02:11:16 +0900 From: Takashi Yano To: cygwin@cygwin.com Subject: Re: Screen clearing in CMD without "Legacy Console Mode" Message-Id: <20210501021116.ef3c1dbaa6bd100bd7611c26@nifty.ne.jp> In-Reply-To: References: <20210430235358.2ae6daa41e3f0b6cb0daa173@nifty.ne.jp> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, 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: Fri, 30 Apr 2021 17:11:45 -0000 On Fri, 30 Apr 2021 10:40:33 -0600 Brian Inglis wrote: > On 2021-04-30 08:53, Takashi Yano via Cygwin wrote: > > 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. > > Was this a change made to Cygwin and from which version? IIRC, from cygwin 3.1.0. -- Takashi Yano