X-Recipient: archive-cygwin AT delorie DOT com X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D7730383F423 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=SystematicSw.ab.ca Authentication-Results: sourceware.org; spf=none smtp.mailfrom=brian DOT inglis AT systematicsw DOT ab DOT ca X-Authority-Analysis: v=2.4 cv=Nv6yz+RJ c=1 sm=1 tr=0 ts=608c3303 a=T+ovY1NZ+FAi/xYICV7Bgg==:117 a=T+ovY1NZ+FAi/xYICV7Bgg==:17 a=IkcTkHD0fZMA:10 a=aulWLQ49AAAA:20 a=yMhMjlubAAAA:8 a=w_pzkKWiAAAA:8 a=uYT-Tk0qkVT609LjNaIA:9 a=QEXdDO2ut3YA:10 a=sRI3_1zDfAgwuvI8zelB:22 Subject: Re: Screen clearing in CMD without "Legacy Console Mode" To: cygwin AT cygwin DOT com References: <20210430235358 DOT 2ae6daa41e3f0b6cb0daa173 AT nifty DOT ne DOT jp> From: Brian Inglis Organization: Systematic Software Message-ID: Date: Fri, 30 Apr 2021 10:40:33 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <20210430235358.2ae6daa41e3f0b6cb0daa173@nifty.ne.jp> Content-Language: en-CA X-CMAE-Envelope: MS4xfKdpbM5p3Ife3BLwesOJFFqDpsTED52uhdm5qH+z9nwdeA1EsnnAq2RG0JLAQytJW+mEIwfmjegRbLsQ39YAQWOUU1pPFCTNMSIozT1w5vV6IVJh7xfF WrfKsEtUE1kNCcT142IYABIzXUVvjhpfq5bOjMYXBsKVb0ccGbJCSvtqsPcWZMEDeEYVIAZYAUwUoGQWSd1GhunoGF3wN2VzUls= X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no 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 AT cygwin DOT 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: , Reply-To: cygwin AT cygwin DOT com Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: cygwin-bounces AT cygwin DOT com Sender: "Cygwin" 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? -- Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada This email may be disturbing to some readers as it contains too much technical detail. Reader discretion is advised. [Data in binary units and prefixes, physical quantities in SI.] -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple