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:in-reply-to
	:references:mime-version:content-type:content-transfer-encoding;
	 q=dns; s=default; b=XicDXMh9nmkuWk+5AAKkp4XunAgOFX6MXxpbJ/Ue3IK
	SPSpCd6xQy8Lm2cUJKfwULUsO1wvNdvveiljPenAvQ33brk8UhytD3ePIla3T+04
	Ua4AfBAEmg/LRREfuAa+kWaPjXQuGDmG6a5Wyt6YK2T+janUdV7MMnUWwwOt73ZQ
	=
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:in-reply-to
	:references:mime-version:content-type:content-transfer-encoding;
	 s=default; bh=ULnDz9HCuub8Xylc6xQ+vTQ/NQU=; b=mozwnk+2VrOFdomEv
	zZDZf8Gg2EUkRsL75PEOOij8ELuLqdsrg+iMgl8MuLN/w1eyFriTNNPT42KraYTO
	krDbdFRAS6JaV7LWnQTZm1q7TAomQeKeW+ZRRfO2C8m2fpCaBp9FrUi/68y1B2No
	RtOXZMIB8XX5R73amSdXAsoOEk=
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-Spam-SWARE-Status: No, score=-5.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=H*f:sk:h4eiWge, H*i:sk:h4eiWge, sends, H*i:sk:ffMnW6z
X-HELO: conssluserg-06.nifty.com
DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com 018Mf4MO010966
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.ne.jp;	s=dec2015msa; t=1581201664;	bh=0CVOMwdffBKvqaTDXEGWdi+0dNIEJz9iwd2ORKY+59s=;	h=Date:From:To:Subject:In-Reply-To:References:From;	b=QGGDTFmcCyrCS1Sg9Be/h12Hlw6axbxGxmlnmeguvG7yvgqWsmCWdcgvS0BH0Pp8A	 N6BEW9GrmMyVv3lm35ZMIllX2FIScKdlbvbktsFuvl2Ackp65e742M1fl3CY5bASBk	 65dmML3PxFn4uWklBUkZTZ5mPPIh7QWskZdkxaou41IQb4kXgK6/IYfHhMTe4l6asn	 MZ1TrX69yRpPSSF1k1susKmEZeC5HAcFiMRCylUPO1NjWgyZhltOMe8+0KsEF9i9SB	 VE2eRFbwD8hya6av/z8KZih1UThd3PV/uJVCOfCAL97sOAKKX1iZe/LPKLojRgiVFd	 dzok0q+Wnx9Dg==
Date: Sun, 9 Feb 2020 07:41:05 +0900
From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin@cygwin.com
Subject: Re: Cygwin-3.1.3: Terminal contents are overwritten by less graphical ones on the start of non-Cygwin programs
Message-Id: <20200209074105.a75c917c8ea1e85305fc9e50@nifty.ne.jp>
In-Reply-To: <CAFLRLk9uE=ffMnW6zWpCAGkq4SzhzZpp=h4eiWgeyGaLPsnWOA@mail.gmail.com>
References: <CAFLRLk-GK_kCL6Wdf=TSR-fNwsuf3BDv-C465S6RFX0hNRqQFw@mail.gmail.com>	<20200208232500.8d938b55f031316e196a1e84@nifty.ne.jp>	<CAFLRLk9uE=ffMnW6zWpCAGkq4SzhzZpp=h4eiWgeyGaLPsnWOA@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

On Sat, 8 Feb 2020 23:29:09 +0800
Koichi Murase wrote:
> > The pseudo console has its own screen buffer behind, and redraws the
> > screen based on the screen buffer at undetermined timing.
> 
> I'm not sure if I correctly understand the situation, but does this
> mean we cannot prevent the pseudo console from redrawing the screen
> (i.e., sending some texts and escape sequences to the terminal
> emulators) based on its background screen buffer?  For that reason do
> we need to keep the terminal contents of both the terminal emulator
> and the background screen consistent with each other?

I think you understand correctly. Due to the reason above, pty
sends data written by slave to both native screen and pseudo
console. However, the interpretation of escapce sequence does
not match perfectly between the real native screen and pseudo
console, therefore, screen is changed when redraw screen is
triggered.

> > > * The problem is not restricted in just clearing graphic styles of
> > >   characters.  For GNU Screen I use Screen-specific terminal sequences
> > > (snip)
> >
> > How can I reproduce this?
> 
> For example, in GNU screen,
> 
>   [user@hostname 0 ~]$ PS1='\[\ek[\u@\h \j \w]$
> $BASH_COMMAND\e\\\][\u@\h \j \W]\$ '
>   [user@hostname 0 ~]$
>   [user@hostname 0 ~]$
>   [user@hostname 0 ~]$
>   [user@hostname 0 ~]$
>   [user@hostname 0 ~]$
>   [user@hostname 0 ~]$
>   [user@hostname 0 ~]$
>   [user@hostname 0 ~]$ ./nocyg
> 
> where ./nocyg is the program in the original mail.  Then it turnes
> into something like:
> 
>   [user@hostname 0 ~]$ PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h
> \[\e[33m\]\w\[\e[[user
>   @hostname 0 ~]$ PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[
>   [user@hostname 0 ~]$ PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[
>   0m\]\n\$ '[user@hostname 0 ~]$
> 
>   [user@hostname 0 ~]$ PS1='\[\ek[\u@\h \j \w]$ $BASH_COMMAND\e\\\][\u@\h \j
>    \W]\$ '[user@hostname 0 ~]$
>   [user@hostname 0 ~]$ PS1='\[\ek[\u@\h \j \w]$ $BASH_COMMAND\e\\\][\u@\h \j
>    \W]\$ '[user@hostname 0 ~]$
>   [user@hostname 0 ~]$ PS1='\[\ek[\u@\h \j \w]$ $BASH_COMMAND\e\\\][\u@\h \j
>    \W]\$ '[user@hostname 0 ~]$
>   [user@hostname 0 ~]$ PS1='\[\ek[\u@\h \j \w]$ $BASH_COMMAND\e\\\][\u@\h \j
>    \W]\$ '[user@hostname 0 ~]$
>   [user@hostname 0 ~]$ PS1='\[\ek[\u@\h \j \w]$ $BASH_COMMAND\e\\\][\u@\h \j
>    \W]\$ '[user@hostname 0 ~]$
>   [user@hostname 0 ~]$ PS1='\[\ek[\u@\h \j \w]$ $BASH_COMMAND\e\\\][\u@\h \j
>    \W]\$ '[user@hostname 0 ~]$ ./nocyg
>   [user@hostname 0 ~]$

Hmmm, this is terrible indeed...
I hope there could be a solution.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

--
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

