Bug 1428337

Summary: screen: apply "alternate window buffer" setting to xterm-256color terminals
Product: [Fedora] Fedora Reporter: Tomas Hoger <thoger>
Component: screenAssignee: Josef Ridky <jridky>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: jridky, lnykryn, phracek, whydoubt
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: screen-4.5.1-2.fc25 screen-4.5.1-2.fc24 screen-4.5.1-2.fc26 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-01 05:11:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tomas Hoger 2017-03-02 10:53:52 UTC
Description of problem:

The default /etc/screenrc contains:

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

This setting is not applied to modern terminals that identify themselves as xterm-256color (such as vte-based terminals like gnome and xfce terminal).  At the same time, all other settings for xterm that are not commented out by default are written as either "xterm*" or "xterm|xterm-*" and hence cover 256 color terminals.  That's apparently thanks to our downstream patch screen-4.3.1-screenrc.patch.

Please change the above configuration to also cover xterm-* terminals.

Version-Release number of selected component (if applicable):

screen-4.5.1-1

Comment 1 Fedora Update System 2017-05-26 07:20:16 UTC
screen-4.5.1-2.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2017-8c6caaf851

Comment 2 Fedora Update System 2017-05-26 07:20:34 UTC
screen-4.5.1-2.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-a41e73423b

Comment 3 Fedora Update System 2017-05-26 07:20:50 UTC
screen-4.5.1-2.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-114a8b0635

Comment 4 Fedora Update System 2017-05-26 19:35:46 UTC
screen-4.5.1-2.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-114a8b0635

Comment 5 Fedora Update System 2017-05-27 04:36:54 UTC
screen-4.5.1-2.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-8c6caaf851

Comment 6 Fedora Update System 2017-05-27 04:39:40 UTC
screen-4.5.1-2.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-a41e73423b

Comment 7 Fedora Update System 2017-06-01 05:11:55 UTC
screen-4.5.1-2.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 8 Jeff Smith 2017-06-05 21:38:52 UTC
Just yesterday, I was investigating why leaving a screen session in PuTTY (on Windows box, ssh'd into Fedora box) leaves junk on the window and determined the issue was with TERM=xterm and thus 'ti' was being overridden. Then today I ran across this issue, and realized that now all terminal emulators with TERM=xterm-256color could experience similar problems.

By default, ti=\E[?1049h and te=\E[?1049l.  The default 'te' is for returning to the main window buffer after being on the alternate window buffer.  However, if already on the main window buffer (as is the case when 'ti' is overridden), at least with some terminal emulators, ----> the window contents are NOT cleared and the cursor is returned to the location previously saved by \E7 <----.

When 'ti' is overridden, 'te' needs to be overridden as well.  I see two reasonable choices:
 1: te=
 2: te=\E[H\E[2J

In choice 1 (set to empty), the result of leaving a screen session is the cursor is sent to the bottom of the window where both the terminate/detach  message and the prompt are printed.

In choice 2 (which matches termcap 'cl' or terminfo 'clear' for xterm), the result of leaving a screen session is the window is cleared and the cursor is sent to the top of the window where both the terminate/detach message and the prompt are printed.

Choice 2 would be my recommendation as I believe it looks and feels cleaner.

Comment 9 Jeff Smith 2017-06-06 00:19:27 UTC
On further research, I discovered that xterm (the program, not the env setting) mangles the backbuffer worse with choice 2 than with choice 1.  That said, xterm is bad about mangling the backbuffer in plenty of other cases, so if you care that much, you're probably not going to be using xterm.

Comment 10 Fedora Update System 2017-06-09 09:24:29 UTC
screen-4.5.1-2.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2017-06-09 19:12:51 UTC
screen-4.5.1-2.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.