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:cc:message-id:in-reply-to
	:references:subject:mime-version:content-type
	:content-transfer-encoding; q=dns; s=default; b=ODMy2mXipxasSR6t
	2EUBR1+shaey7IUiIdOlkKHNeaeGHyqRdENFDBDLrlE5/DZt885NPXbAOsynPxIU
	lsZ3yyg5LFl2ZXHgpT6AfLaVEzACIogRm85a8pbjXzKX9PswWfN2mC2t9ZAfbDhP
	sw9DZV/4bYRB5R2qPHk8O4Re7/s=
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:cc:message-id:in-reply-to
	:references:subject:mime-version:content-type
	:content-transfer-encoding; s=default; bh=pAlV922+PnFdsycMD2M9fg
	eyBBk=; b=jHw48J/LmBaecd6PPVHzqQYet/Q532AXrGVT8oydL7RSqVvytUjoMp
	pOJX7uC8X9y+7oOZAf+cl48MUjVfXw0EWxDyGhcfxhFupJiGvxRNlCvNyWRp0yUD
	7g3PoUFvIWdd6NDIiVl1F7tXcDYJOkhy/oSJbmaedURNIi9x8N87o=
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.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy=H*f:sk:1555023, H*MI:sk:1555023, screen
X-HELO: smtp-nf-201.his.com
Date: Thu, 11 Apr 2019 19:50:22 -0400 (EDT)
From: Thomas Dickey <dickey@his.com>
To: Thomas Wolff <towo@towo.net>
Cc: cygwin <cygwin@cygwin.com>
Message-ID: <1750415886.9092694.1555026622274.JavaMail.zimbra@his.com>
In-Reply-To: <276979345.9055306.1555023982346.JavaMail.zimbra@his.com>
References: <1555023988.95356.ezmlm@cygwin.com>
Subject: Re: *cause of* screen writing over restored buffer on detach/exit
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit



----- Original Message -----
| From: "Thomas Dickey" <dickey@his.com>
| To: "Thomas Wolff" <towo@towo.net>
| Cc: "cygwin" <cygwin@cygwin.com>
| Sent: Thursday, April 11, 2019 7:06:22 PM
| Subject: Re: *cause of* screen writing over restored buffer on detach/exit

| ----- Original Message -----
|| From: "Thomas Wolff" <towo@towo.net>
|| To: "cygwin" <cygwin@cygwin.com>
|| Sent: Wednesday, April 10, 2019 5:51:34 PM
|| Subject: Re: *cause of* screen writing over restored buffer on detach/exit
| 
|| Hi Thomas,
|| 
|| Thomas Dickey wrote:
||> ----- Original Message -----
||> | From: "Shaddy Baddah" <lithium-cygwin@shaddybaddah.name>
||> | To: "cygwin" <cygwin@cygwin.com>
||> | Sent: Tuesday, April 9, 2019 11:18:19 PM
||> | Subject: Re: *cause of* screen writing over restored buffer on detach/exit
||>
||> | On 9/4/19 4:07 pm, Shaddy Baddah wrote:
||> |>
||> |> This helped with screen when using Putty to a Cygwin ssh session. For
||> |> some reason, it isn't helping for running screen locally in a mintty
||> |> session. And it's not mintty either, because I can ssh to a Debian
||> |> stretch server within mintty and I can use its screen without this
||> |> issue happening. Back to the drawing board for me.
||> |
||> | I understand the cause of the issue now, by capturing and comparing the
||> | escape characters used to control the terminal by screen on Cygwin and
||> | Debian.
||> |
||> | It is not so much the detach/exit is the issue, although the escape
||> | sequence for Cygwin includes a couple of extra xterm OSC Set Text
||> | Parameters -> Change Icon Name and Window Title outputs. I misdiagnosed
||> | this somehow. I can suppress the extra utmp error one of these OSC
||> | outputs, but it didn't/doesn't really make a difference.
||> |
||> | The issue is in the escape sequences sent to the terminal by Cygwin
||> | screen to switch to new windows buffer, as compared to Debian.
||> |
||> | Debian uses xterm sequence DECSET / ESC[?1049h in the switch to the new
||> | window. Cygwin uses the two sequences ESC7 / Save Cursor (DECSC) and
||> | ESC[?47l / DEC Private Mode Reset (DECRST) -> Use Normal Screen Buffer.
||> |
||> |
||> | The reason seems to be that the Debian screen package packages a custom
||> | /etc/screenrc that does not include this explicit term capability:
||> |
||> |
||> | #
||> | # Do not use xterms alternate window buffer.
||> | # This one would not add lines to the scrollback buffer.
||> | termcap xterm|xterms|xs ti=\E7\E[?47l
||> | terminfo xterm|xterms|xs ti=\E7\E[?47l
||> |
||> |
||> |
||> | If I comment these out, my screen issue is resolved.
||> |
||> | I'm not suggesting this is a problem with Cygwin screen... it is using
||> | the upstream settings. In fact, I am not confident to say where the
||> | fault lies. Perhaps screen is right to use these sequences, but the
||> | xterms used (putty and mintty) aren't doing the right thing?
||>
||> yes - that's one of a half-dozen cases where PuTTY has never matched xterm's
||> behavior.
|| I've tested the CSI?1049h and CSI?1049l pair on xterm, pterm, mintty and
|| see no difference. In what way would it not match? And what are the
| 
| I mentioned it here:
| 
| https://stackoverflow.com/questions/24613237/terminal-retains-bg-color-after-closing-vim-using-color-scheme-and-putty-256co/37869114#37869114
| 
|| cases, do you have a list?
| 
| no - I've a few notes which aren't incorporated into the terminal description
| 
| https://invisible-island.net/ncurses/terminfo.src.html#tic-putty
| 
| offhand, there's differences in wrapping, as well as how modifiers affect
| cursor-keys.

...though now that I'm reading it, that one deals with color.
(I do have a note about cursor-position problems with the interim 1047/1048,
but suppose PuttY doesn't do that).

-- 
Thomas E. Dickey <dickey@invisible-island.net>
http://invisible-island.net
ftp://ftp.invisible-island.net

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

