X-Recipient: archive-cygwin@delorie.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:date:from:to:subject:message-id:reply-to
	:references:mime-version:content-type:in-reply-to; q=dns; s=
	default; b=UHW34rIhe8nOvMlTNEbSTFFxr/2lF1ecmtvcIYPsKHBIlIx/s78G+
	3DS/bESBdsnR33E3uu12x00y9TKcN9th/ANV3qrLzNU5eQtmFBY0gsu4gpzc3Z3V
	W5aDpxum3DV77XP7XklkWETIoTgLFgOmEa4HKnl3gz+z6/FUShAcqc=
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:date:from:to:subject:message-id:reply-to
	:references:mime-version:content-type:in-reply-to; s=default;
	 bh=nmBI9TvghQWa/XRqu8Bt+cy/gC0=; b=NDhijbTOc/roQD0cLec0AVpdG0nX
	tvdOC5aoGc9QW28q6bdlZLi203aF1C8zVVSOnxZKQM1KDly+N4wQi/ikOR+FbArd
	Aq0b8zrgKoFroLnwXZDswiLIwDDepcVO1wEOfciQ01mKbzhWtB0Vx3uqQhpaEuyu
	9TDuCuHPs5HWzkU=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-94.9 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_BRBL_LASTEXT,RCVD_IN_PBL,RCVD_IN_SORBS_DUL,RDNS_DYNAMIC autolearn=ham version=3.3.2 spammy=H*i:sk:d6d7e30, H*f:sk:d6d7e30, material
X-HELO: calimero.vinschen.de
Date: Thu, 28 Jul 2016 09:08:58 +0200
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: [PATCH] Strange behavior of cmd.exe when hammered with clear  screen operations from Cygwin program.
Message-ID: <20160728070858.GC29214@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <05e87c9326e8bc9a32a5a3cd2511fe98@mail.kylheku.com> <9b05b6502dc0bdba2654069cfa924a50@mail.kylheku.com> <6d026b0ea424481879a89d480730c1f4@mail.kylheku.com> <49c8dca543daed3fa35b29e41ebf449b@mail.kylheku.com> <50bb6b3942d5fb67057465f8b09b7121@mail.kylheku.com> <20160727184511.GA29214@calimero.vinschen.de> <d6d7e303024a420a549756f505ce09f2@mail.kylheku.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;	protocol="application/pgp-signature"; boundary="rMWmSaSbD7nr+du9"
Content-Disposition: inline
In-Reply-To: <d6d7e303024a420a549756f505ce09f2@mail.kylheku.com>
User-Agent: Mutt/1.6.2 (2016-07-01)

--rMWmSaSbD7nr+du9
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Jul 27 13:36, Kaz Kylheku wrote:
> On 27.07.2016 11:45, Corinna Vinschen wrote:
> > Btw, since you're apparently building your own Cygwin DLL I thought just
> > sending the patch for testing is sufficient.  If you prefer to get a
> > developer snapshot with this patch, I can do that, too.  Just say the
> > word.
>=20
> The patch looks good and in many cases avoids padding the history with
> blank lines, compared to the naive newline emission approach.
>=20
> Usually, the clear screen operation is preceded by a homing of the cursor.
> I.e., in VT100 language:  ESC [ H, ESC [ 2 J.  In this case, your approach
> seems to nicely trim the console data at that line. Rather, that is to
> say, when we scroll back, there aren't any blank lines, since none were
> added; the clear was done as a pure scrolling operation without any
> padding data.
>=20
> Blank lines are only generated if the cursor is in the middle of the
> buffer. Since the cursor position is restored after the scrolling,
> that then adds blank lines between the scrolled-away material and the
> cursor position. And if the clear is repeated at that position,
> more blank lines are added for each repetition. Who cares about that case,
> though.

I saw that and disregarded it as not overly important.  On second
thought there should be a matching scrolling operation for this case,
too, which does not waste buffer with empty lines.

> Other implementations behave the same way, if not worse.
>=20
> Case in point: Gnome Terminal (3.4.1.1) behaves like my naive \n
> repetition patch! Every issue of ESC [ 2 J adds a window height's
> worth of blank lines to the history,  regardless of the position
> of the cursor!  That is what I compared to as a "gold standard",
> so I was okay with it.

I checked against xfce4-terminal and konsole and both are rather
disappointing...

Thanks for testing.  I'll check in the patch as is for now, but I'd
still be interested to fix the aforementioned empty lines problem,
even if just for completeness.  If you have an idea, feel free to
propose.


Thanks,
Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--rMWmSaSbD7nr+du9
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIbBAEBCAAGBQJXma+KAAoJEPU2Bp2uRE+gv+UP+JTPxYyuZj29JVznUOA9TOSK
RDi3ZDMr4gHwXXovtJxdIOuwRLObNZElLmCPcCYqQecHS/5/Akv1qjXew62oKsZ8
hnvyHJ3bwuTFOT9fOmBuxQrFS5nT3+ZS6pa7wrfjUTb4w43JlXxAwHTaHa5MZ6Pl
c6q4ZZykiXamYDrbc84dJ1XL9rc712VLUJQoHDZ4rYsuVS13b2A0p1n86KqECOks
a3QqrnChRpOGllHnlXgWQSpwuEvZVPcnRZCNpChgHybGVA9dRHW615gzZyLMamZc
uEMQ1WRZS2ZKZaVq9Run0SUjHXo2E1uiCgmuHVktn1PZJYYU9G9zaSup/pwtmkPz
Irjgsrbrop6mDnkUUrSB7MwFun09cvkNnYJrRuxVVE7yx60cSt1koMFaf4aUm2Bk
F1qg37i/Yar9vTq+oHodyo0YcYrIYC/I7vuUlQRhZV4VlFKlIp7C9wLdAG/jkn+w
+StXZqtPEqa0cAL+FpQM7r4LV/IuWSt06aSqh85H5O8WoxXU42cT3uw2bsTKaNQC
r/TcLOtyvxTZvjvI3SsJHS6DrzSFbQmOXRSe5EB+Qf9LBSBGuzxzHnaYYfDjP7iP
809mdGHfnJRzduORZBYcH21xrJcYKh+dcLrPnVsE32724HiDS+WP9PkzKO5xgSR2
Zczfb3Pf+OqWeTDhNm0=
=JMbm
-----END PGP SIGNATURE-----

--rMWmSaSbD7nr+du9--
