public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Workaround to screen writing over restored buffer on detach/exit
@ 2019-04-09  5:37 Shaddy Baddah
  2019-04-09  6:07 ` *spoke to soon to a* " Shaddy Baddah
  0 siblings, 1 reply; 11+ messages in thread
From: Shaddy Baddah @ 2019-04-09  5:37 UTC (permalink / raw)
  To: cygwin

Hi,

So I've had an issue with screen for some years now. I do remember
noticing its introduction, but I no longer can remember when that
actually happened.

As per the subject, I find that when I detach or exit a screen session
the cursor ends up part way up the restored buffer, intermingled with
previous lines.

I'd resolved to try and get to the bottom of it ages ago, but lost the
initiative too easily. I noticed from ages ago that the terminal window
title bar would flash this message:

Utmp slot not found -> not removed

And this didn't surprise me, as I wouldn't expect Cygwin to have
conventional utmp implementation. But it looks like screen sending
xterm control sequences for this additional message (on detach/exit, a
final restoration of your buffer involves updating the terminal title
with previous message) causes havoc with the screen session.

I confirmed this by turning off the default "login" mode for a new
session, which averted attempts to manage utmp entries, and therefore
avoided the "utmp slot not found" message. I did this by launching a
session via:

screen -ln

You can also set login off in your .screenrc.

Doing this, screen session plays nicely now. Probably, the error in utmp
should be actually fixed, or permanently turned off if not workable in
Cygwin. But for now, I'm so relieved to be able to workaround a daily
pain in the proverbial.

-- 
Regards,
Shaddy

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: *spoke to soon to a* Workaround to screen writing over restored buffer on detach/exit
  2019-04-09  5:37 Workaround to screen writing over restored buffer on detach/exit Shaddy Baddah
@ 2019-04-09  6:07 ` Shaddy Baddah
  2019-04-10  3:18   ` *cause of* " Shaddy Baddah
  0 siblings, 1 reply; 11+ messages in thread
From: Shaddy Baddah @ 2019-04-09  6:07 UTC (permalink / raw)
  To: cygwin

Hi,

On 9/4/19 3:37 pm, Shaddy Baddah wrote:
> I confirmed this by turning off the default "login" mode for a new
> session, which averted attempts to manage utmp entries, and therefore
> avoided the "utmp slot not found" message. I did this by launching a
> session via:
> 
> screen -ln
> 
> You can also set login off in your .screenrc.
> 
> Doing this, screen session plays nicely now. Probably, the error in utmp
> should be actually fixed, or permanently turned off if not workable in
> Cygwin. But for now, I'm so relieved to be able to workaround a daily
> pain in the proverbial.

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.


-- 
Regards,
Shaddy

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: *cause of* screen writing over restored buffer on detach/exit
  2019-04-09  6:07 ` *spoke to soon to a* " Shaddy Baddah
@ 2019-04-10  3:18   ` Shaddy Baddah
  2019-04-10 15:04     ` Andrew Schulman
  2019-04-10 20:03     ` Thomas Dickey
  0 siblings, 2 replies; 11+ messages in thread
From: Shaddy Baddah @ 2019-04-10  3:18 UTC (permalink / raw)
  To: cygwin

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?

In any case, I am glad to have found this workaround.

-- 
Regards,
Shaddy

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: *cause of* screen writing over restored buffer on detach/exit
  2019-04-10  3:18   ` *cause of* " Shaddy Baddah
@ 2019-04-10 15:04     ` Andrew Schulman
  2019-04-10 17:12       ` Thomas Wolff
  2019-04-10 20:03     ` Thomas Dickey
  1 sibling, 1 reply; 11+ messages in thread
From: Andrew Schulman @ 2019-04-10 15:04 UTC (permalink / raw)
  To: cygwin

Hi Shaddy. There you go again.

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

I haven't seen the screen corruption you describe - not sure why. So it's
hard for me to test the fix. But I did comment out those 2 entries, start a
new screen, and attach and detach several times, and it doesn't seem to
cause any harm.

I don't know whose fault the problem is either, but it's probably a
particularity of Cygwin. So I'm happy to package the fix as long as it
doesn't create any problems.

So I'll upload a test release, to see if we can get some other people to
test.

Andrew


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: *cause of* screen writing over restored buffer on detach/exit
  2019-04-10 15:04     ` Andrew Schulman
@ 2019-04-10 17:12       ` Thomas Wolff
  2019-04-11 12:12         ` Andrew Schulman
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas Wolff @ 2019-04-10 17:12 UTC (permalink / raw)
  To: cygwin

Am 10.04.2019 um 17:04 schrieb Andrew Schulman:
> Hi Shaddy. There you go again.
>
>> 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?
>                      
> I haven't seen the screen corruption you describe - not sure why. So it's
> hard for me to test the fix. But I did comment out those 2 entries, start a
> new screen, and attach and detach several times, and it doesn't seem to
> cause any harm.
>
> I don't know whose fault the problem is either, but it's probably a
> particularity of Cygwin. So I'm happy to package the fix as long as it
> doesn't create any problems.
screen sends CSI ? 1049l on exit which restores the cursor to the 
position where it was previously saved.
It's the "te" (not ti) terminfo sequence for xterm on cygwin.
Thomas

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: *cause of* screen writing over restored buffer on detach/exit
  2019-04-10  3:18   ` *cause of* " Shaddy Baddah
  2019-04-10 15:04     ` Andrew Schulman
@ 2019-04-10 20:03     ` Thomas Dickey
  2019-04-10 21:51       ` Thomas Wolff
  1 sibling, 1 reply; 11+ messages in thread
From: Thomas Dickey @ 2019-04-10 20:03 UTC (permalink / raw)
  To: Shaddy Baddah; +Cc: cygwin



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

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: *cause of* screen writing over restored buffer on detach/exit
  2019-04-10 20:03     ` Thomas Dickey
@ 2019-04-10 21:51       ` Thomas Wolff
  2019-04-11 23:06         ` Thomas Dickey
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas Wolff @ 2019-04-10 21:51 UTC (permalink / raw)
  To: cygwin

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 
cases, do you have a list?
Thanks
Thomas

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: *cause of* screen writing over restored buffer on detach/exit
  2019-04-10 17:12       ` Thomas Wolff
@ 2019-04-11 12:12         ` Andrew Schulman
  2019-04-11 17:24           ` Thomas Wolff
  0 siblings, 1 reply; 11+ messages in thread
From: Andrew Schulman @ 2019-04-11 12:12 UTC (permalink / raw)
  To: cygwin

> Am 10.04.2019 um 17:04 schrieb Andrew Schulman:
> > Hi Shaddy. There you go again.
> >
> >> 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 don't know whose fault the problem is either, but it's probably a
> > particularity of Cygwin. So I'm happy to package the fix as long as it
> > doesn't create any problems.
> screen sends CSI ? 1049l on exit which restores the cursor to the 
> position where it was previously saved.
> It's the "te" (not ti) terminfo sequence for xterm on cygwin.

Thomas, can you please clarify: Are you suggesting changing ti to te in the
above entries? Or do you have another suggested patch?

Although I'm the screen maintainer, I've never learned the intricacies of
termcapinfo.

Thanks,
Andrew


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: *cause of* screen writing over restored buffer on detach/exit
  2019-04-11 12:12         ` Andrew Schulman
@ 2019-04-11 17:24           ` Thomas Wolff
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Wolff @ 2019-04-11 17:24 UTC (permalink / raw)
  To: cygwin

Am 11.04.2019 um 14:12 schrieb Andrew Schulman:
>> Am 10.04.2019 um 17:04 schrieb Andrew Schulman:
>>> Hi Shaddy. There you go again.
>>>
>>>> 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 don't know whose fault the problem is either, but it's probably a
>>> particularity of Cygwin. So I'm happy to package the fix as long as it
>>> doesn't create any problems.
>> screen sends CSI ? 1049l on exit which restores the cursor to the
>> position where it was previously saved.
>> It's the "te" (not ti) terminfo sequence for xterm on cygwin.
> Thomas, can you please clarify: Are you suggesting changing ti to te in the above entries?
I was just reporting what I had discovered. The above settings do not 
seem to make sense, though, as they would restore the cursor (to what?) 
when screen is started.
On the other hand, screen behaviour when the settings are disabled do 
not make much sense, either. It sends a Restore Cursor sequence without 
having sent a Save Cursor before. Very weird.
> Or do you have another suggested patch?
Any change I tried seems to make screen exit behaviour better, sometimes 
leaving at the bottom, sometimes at the top (after clearing the screen).
>
> Although I'm the screen maintainer, I've never learned the intricacies of termcapinfo.
The screen manual is a bit fuzzy about this. Apparently you can tweak 
screen's assumptions about your terminal. But normally you shouldn't 
need to.
Thomas

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: *cause of* screen writing over restored buffer on detach/exit
  2019-04-10 21:51       ` Thomas Wolff
@ 2019-04-11 23:06         ` Thomas Dickey
  2019-04-11 23:50           ` Thomas Dickey
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas Dickey @ 2019-04-11 23:06 UTC (permalink / raw)
  To: Thomas Wolff; +Cc: cygwin

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

| Thanks
| Thomas

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: *cause of* screen writing over restored buffer on detach/exit
  2019-04-11 23:06         ` Thomas Dickey
@ 2019-04-11 23:50           ` Thomas Dickey
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Dickey @ 2019-04-11 23:50 UTC (permalink / raw)
  To: Thomas Wolff; +Cc: cygwin



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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-04-11 23:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-09  5:37 Workaround to screen writing over restored buffer on detach/exit Shaddy Baddah
2019-04-09  6:07 ` *spoke to soon to a* " Shaddy Baddah
2019-04-10  3:18   ` *cause of* " Shaddy Baddah
2019-04-10 15:04     ` Andrew Schulman
2019-04-10 17:12       ` Thomas Wolff
2019-04-11 12:12         ` Andrew Schulman
2019-04-11 17:24           ` Thomas Wolff
2019-04-10 20:03     ` Thomas Dickey
2019-04-10 21:51       ` Thomas Wolff
2019-04-11 23:06         ` Thomas Dickey
2019-04-11 23:50           ` Thomas Dickey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).