Re: terminal clear/refresh after detach

Ben Love <[email protected]>
Newsgroups gmane.comp.gnu.screen.user
Message-ID <[email protected]>
* Lonni J Friedman wrote on [2011-09-13 12:36:43 -0700]:
> On Tue, Sep 13, 2011 at 10:56 AM, Ben Love <[email protected]> wrote:
> > * Lonni J Friedman wrote on [2011-09-12 12:17:08 -0700]:
> >> Greetings,
> >> I recently upgraded from Fedora14 to Fedora15.  As part of the
> >> upgrade, I moved from screen-4.0.3 to screen-4.1.0, and inherited an
> >> annoying behavior.  Prior to the upgrade, whenever I detached from a
> >> screen session, everything that was present on my terminal prior to
> >> attaching to a screen session was restored.  Since the upgrade,
> >> whenever I detach, my terminal is automatically cleared, thereby
> >> losing all content that was present.
> >>
> >> I've googled and looked through the screen man page, but I can't find
> >> any mention of this behavior (or a means of preventing it).  Is this
> >> expected behavior, or a bug?
> >
> > I think you are intersted in the altscreen option.  I believe it does
> > what you want.
> 
> This option doesn't seem to have any impact regardless of whether I
> set it to off or on in /etc/screenrc .

I think this means your termcap/terminfo settings have changed.  First,
make sure you aren't using something weird in $TERM (in the shell that
launches screen, not the shell within screen, which should simply have
TERM=screen).  Then, try reading man terminfo and man termcap.
Unfortunately, I've not messed with either enough to know where to
actually look.  And generally, I think it's a bad idea to try
customizing that stuff as I would expect most distributions to already
have sane values for all sane TERM entries.

For comparison, my $TERM prior to launching screen is rxvt-unicode.

> 
> >
> > Alternatively, you could look into hacks as described here:
> >
> > http://wiki.bash-hackers.org/snipplets/screen_saverestore
> >
> > using tput smcup and tput rmcup to save and restore the screen manually,
> > though this is probably not what you're looking for.
> 
> If there was some way to get screen to invoke them automatically, then
> that would likely serve as a good workaround.  However, I can't figure
> out any way to accomplish that.

If you're talking about having this run when you're attaching/detaching,
then I think a simple shell script around screen would be fine:

#!/bin/bash
tput smcup
screen "$@"
tput rmcup

If you're talking about how to do this from within shells that are
started by screen, I would probably put something in .bashrc that tests
for TERM=screen to detemine that it is executing within screen, and make
the tput smcup and tput rmcup entries within there.  There's probably
another way to do this that is more elegant, but all my hacks are in
.bashrc anyway.

Ben

> 
> thanks.
> 

-- 
Ben Love
http://www.kylimar.com/

_______________________________________________
screen-users mailing list
screen-users-mXXj517/[email protected]
https://lists.gnu.org/mailman/listinfo/screen-users
signature.asc (application/pgp-signature, 903 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: http://www.kylimar.com/cryptography/keys/blove.public.asc

iQIcBAEBCgAGBQJOcAeNAAoJEA6c8m/a4yhPCFEP/iHr8QuF4LZxBpsapoQFS8oS
9tR7tkWw6uVIdEUKJjIZLwL13URGhxU8K0SErXZIDCKMMOuWotuUIST1LC6y7Jro
8C2/0VIKEMPRFUUhBTFZuy0lA2pN0sRoNJRXgwAbMIII47wjOfmkxKNMA0DYviMJ
RH7diiLW1rXi9aKeYUeYo2umKIt6Bfvp4Q1yVPKmwPcy5WPwkv+vTDZp1Xd0kn8p
JquAID2cJ3ajewMpOauhjOW6pgG9zAHQOe/kbRJK/J0RT6LmJemZspueOWPhl8ib
CHKEOg72ErxUlLXh43YdExQUzwZwfPUL1tajlf8YfmpBk1I5CKFCrRzBjsckSRwY
tPl7CjLn5TI37e7dsM5d/hUxcJ4+9oL2539R0pd5qWl0DeuONWb4jckfpOYeSNky
gESF3fm/TnWHauEGRe1Yw/UNhiYlD/ZHB4sVmWspd6qIFoXwaOtCL5+biui4CEUP
nkUGk/Kb6jtjKQ515eYabgQAtko5qVpD44oRiVVCvsI7+0iEUp9JKYvmgCy5mx4T
DhGl24IieVHUu6JTTHnKTWKqa0Qcr+AIIamU1uwCi960MzB1GPli3v3sDDuhO8Ik
l8t/EMIcWr4oSB81Y/oqgutLoPJGuAz7FATWOLkn9to1mC4P5mvg6FoGJX84iXAW
rXD52RXBg8X4l2sNGuF8
=VXgw
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.