From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from conssluserg-05.nifty.com (conssluserg-05.nifty.com [210.131.2.90]) by sourceware.org (Postfix) with ESMTPS id 2EF323858C2C for ; Thu, 3 Feb 2022 12:09:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2EF323858C2C Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=nifty.ne.jp Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=nifty.ne.jp Received: from Express5800-S70 (v036249.dynamic.ppp.asahi-net.or.jp [124.155.36.249]) (authenticated) by conssluserg-05.nifty.com with ESMTP id 213C9WoJ002751 for ; Thu, 3 Feb 2022 21:09:33 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-05.nifty.com 213C9WoJ002751 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.ne.jp; s=dec2015msa; t=1643890173; bh=h/LrWauWGRZ/pTvel5jsc8ycdCpDj8nEsdEqQiug/UE=; h=Date:From:To:Subject:In-Reply-To:References:From; b=VGQicdjuoQcoUH4w27T9qJDVGTD7sTkXDI7PXvQzASFk9xirBAVEvYd8Ylr2fPhpm Y9WS2fiPClsn5dkvnsmU4oi/3atzHzLO20Y5XDsIcZ/Mk23yUwUPiW2cgaeFg4u0nG ECM2NB5GoWq0ADXTbIVQg39qMTRIdSjFzf4Q6Axo3igp11qKmJYgdMDqo8Ar7glk7i MZYofaiLsxFd6FPHpk6HEA/EXHDtmyIkPC2vyzasYfR+8W+ErB0uIFIJiggY1mQ9p9 B0t3voA/8AqusNNEBt0kwfrSSxvFweroafJLq/41qxZ0g139YSKmzWL79+E3/re5qX TldlpYjy5pLHQ== X-Nifty-SrcIP: [124.155.36.249] Date: Thu, 3 Feb 2022 21:09:34 +0900 From: Takashi Yano To: cygwin@cygwin.com Subject: Re: In Cygwin console (not Mintty), escape sequences DL/IL at the last line misbehave Message-Id: <20220203210934.1d4ee5e81144994f92a51d2f@nifty.ne.jp> In-Reply-To: References: 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.4 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, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Thu, 03 Feb 2022 12:09:54 -0000 On Thu, 3 Feb 2022 19:02:14 +0900 Koichi Murase wrote: > I'm not sure what this exactly is related to, but I guess pcon is > closely related. No, this is not related to pseudo console. > Cygwin version: > > I can reproduce it in Cygwin 3.2.0 and the latest 3.3.4 for both > 64-bit and 32-bit versions. I usually set CYGWIN=disable_pcon, but > this reproduces for both cases with and without disable_pcon. > > I think I observed this behavior even earlier but don't exactly > remember in which Cygwin version I first noticed this broken behavior. > At least, this behavior has existed for a very long time. I have been > thinking that there are a few people using the Cygwin console > directly, but I recently noticed that it matters when I connect to > Cygwin from Windows Terminal. This puts very hard limitations on > implementing a line editor where the line editor does not know the > absolute vertical position in the terminal screen so cannot predict > the consequences of using DL/IL. > > Repeat-by: > > 1. First open a Cygwin console (not to be confused with Mintty) by > double-clicking bash.exe in C:\cygwin64\bin or by executing "cygstart > bash". > 2a. run the following command at the last line of the terminal: > > $ printf '\e[5M' > > 2b. run the following command at the last line of the terminal > > $ printf '\e[5L' > > The control sequence \e[M (CSI M) is the ANSI escape sequence > DL (DELETE LINE), which is supposed to delete the current line and the > following -1 lines and scrolls up the subsequence lines. This > control function functions correctly when it is not at the last line > in the Cygwin console. However, if the current cursor position is > located at the last line, DL() of the Cygwin console wrongly > scrolls up the entire screen by lines (instead of the subsequent > lines after the delete lines). > > Likely, \e[L is the ANSI escape sequence IL (INSERT LINE), which > is supposed to insert new lines at the current line and to scroll > down the subsequent lines. However, when the cursor is at the last > line, IL of the Cygwin console again scrolls down the entire screen. > > This behavior is also reproduced in Windows Terminal with a profile of > Cygwin executing bash.exe --login -i. This doesn't happen when we use > Mintty or other terminal emulators relying on the genuine Cygwin PTY. > > Fix: > > Any other terminals do not behave in this unintuitive way. When the > cursor is located at the last line, DL/IL should not scroll any lines > but should just clear only the last line. Thanks for the report. I can reproduce the problem. I will submit a patch for this issue shortly. -- Takashi Yano