X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:subject:mime-version:content-type :content-transfer-encoding:date:from:cc:in-reply-to:references :message-id; q=dns; s=default; b=lYdjgbFWn4OmocTYb5miQFJhwXQsZsX skhzCJ0RzCwf5yzPmlWMayqNBp5DGkOHHSF0rkWRSS8kxzzJ9CAe5OMfuKtPuf4P 6Kr+wNo19kggyYbQymeVCFlzMEpID4j/KtE30nyMXZ3AP7CMa9qA36T/augZ4Cw9 LYKeZwjX3a4U= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:subject:mime-version:content-type :content-transfer-encoding:date:from:cc:in-reply-to:references :message-id; s=default; bh=9kt5iWGpO08q8Jde+bCEgeExOC4=; b=eKGJ4 7j7Ic9ppI2UL48+noATP4XHR8HgYPFhSarpT1pvHzmTFBtlQgFdRFc1/BCfNPRUr 1mJduA91kzrFuhI1zd1mtqKkUoNM0nIELu6NkKIKIHpFlN+Kdw4N0dkNJQ3u9VPd zZpI6LmvugBxFsF0BI3GrZgl+s7S1XoMMYiLRg= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL,BAYES_05,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=5000000, sleep, Hx-languages-length:2622, coordinates X-Spam-User: qpsmtpd, 2 recipients X-HELO: smtp-out-no.shaw.ca X-Authority-Analysis: v=2.2 cv=GdZVpkfL c=1 sm=1 tr=0 a=WiYoHcCliNeVponEdG0Ckg==:117 a=WiYoHcCliNeVponEdG0Ckg==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=cAmyUtKerLwA:10 a=Xp3UbGaphxvqOyUXiKsA:9 To: Corinna Vinschen Subject: Re: [PATCH] Strange behavior of cmd.exe when hammered with clear screen operations from Cygwin program. X-PHP-Originating-Script: 501:rcmail.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Date: Fri, 29 Jul 2016 08:59:50 -0700 From: Kaz Kylheku Cc: cygwin AT cygwin DOT com In-Reply-To: <20160729103927.GB5963@calimero.vinschen.de> References: <0ee6699f198b7b0f588054ba2f829db5 AT mail DOT kylheku DOT com> <20160728195135 DOT GC26311 AT calimero DOT vinschen DOT de> <20160729103927 DOT GB5963 AT calimero DOT vinschen DOT de> Message-ID: X-Sender: kaz AT kylheku DOT com User-Agent: Roundcube Webmail/0.9.2 X-CMAE-Envelope: MS4wfOhUg/B3xJGQgQFgEo0L+0AyQjVvMfkXmNJsCMfDqCCD/Xsy9dRxL3bWqxEPVyEkb+8Y/YEDjDxbI04goRTejbGfjy/1GnY+hjSB7JRTD82wnR7c8od+ HAvjF8ABa+7LFxKLEiVZYz1q+QuD6YzSvuw3JPwKaHrEscx6j68UrG70Mo4MPBe4+LQwMPeex9MNxw== Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id u6TG0amq005923 On 29.07.2016 03:39, Corinna Vinschen wrote: > On Jul 28 21:51, Corinna Vinschen wrote: >> However, the former cursor position in the buffer is still known >> at clear screen time. It's stored in dev_console::dwEnd. So what >> I was thinking about is to check the above situation and then, rather >> then to just keep it as is, move the console window and the cursor >> position up to the line right after the former cursor position, i.e: >> >> After (desired?): >> >> buffer >> +--- >> | nonblank >> | nonblank >> | blank >> | blank window >> | > ---+ >> | > [] cursor | >> | blank | >> | blank ---+ >> | blank >> | blank >> | blank >> | blank >> +--- >> >> Does that make sense or am I still missing something? > > I applied a patch to perform this action. It's in the latest > 2.6.0-0.5 test release I just announced. I've done some interactive testing with this using the interpreter for a Lisp dialect. I would evaluate this expression to generate a 5 second delay and then a clear screen VT100 sequence: (progn (usleep 5000000) (put-string "\e[2J")) during this time, I would scroll the buffer somewhere. I also tested with a cursor position somewhere in the middle of the window, having issued: (put-string "\e[12H") The programming language details don't matter; we could do this with bash echo $'\e...' and sleep 5. In terms of the final appearance of the terminal window, the best results are obtained using the naive newline ejection method! The screen is clear, and the cursor is at the proper *window* position. (That's what we care about in VT100-land; we don't care about Windows console buffer semantics, and the position in the abstract buffer; position means screen position.) Your first patch has the effect that the physical screen position is not always restored. The window is clear, but the cursor is sometimes at the bottom, even though it was somewhere in the middle of the window before the operation. In the abstract buffer coordinates, it is correct; it's just that the window viewport is not all the way down. With the third patch, I've run into behavior in which the display isn't cleared at all if the clear is issued in a scrolled-back state. The naive newline ejection, in spite of its flaw of adding more blank lines to the history than one would like, achieves the best visual results in all cases because the viewport jumps to the bottom of the buffer when the newlines are being emitted, and then the cursor position is restored in that viewport position. Cheers ... -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple