Subject: Screen, xterm, initialization strings.

From: Micah Cowan <[email-masked]>
Date: Sun, 10 Aug 2008 19:42:22 -0700

So, the other day, I suddenly found that screen was no longer using the
alternate screen buffer as it usually does. Worse, screen _thought_ it
was operating under the alternate screen buffer, so left a dirty screen
upon exit. Thinking it was a recently-introduced but, I spent pretty
much the whole day tracking down the problem, which turned out to be
that after blowing away /opt/screen and reinstalling, I neglected to
copy etcscreenrc to /opt/screen/etc/screenrc, which has the following:

  # Long time I had this in my private screenrc file. But many people
  # seem to want it (jw):
  # we do not want the width to change to 80 characters on startup:
  # on suns, /etc/termcap has :is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l:
  termcap xterm 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'
  terminfo xterm 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'

I use gnome-terminal (which advertises as xterm), which has the
following ("is2" is terminfo for termcap's "is"):

  $ tput is2 | cat -v; echo
  ^[[!p^[[?3;4l^[[4l^[>

Note the initial ^[[!p, which is the sequence for DECSTR, the soft
reset. In vte (gnome-terminal, xfce4-terminal), this has the effect
(among others), of bringing the terminal back into the normal screen
buffer. (Ironically, it does not have this effect in an actual xterm.)

My question is: is screen even right to issue the initialization string,
at all? And particularly _after_ issuing smkx. My understanding is that
is2 and friends should be sent on user login. One could, perhaps, argue
that using screen _does_ amount to a login of sorts; but considering
that nowhere else does one find it issued _after_ entering application
keypad mode (which it could reasonably be expected to reverse, alternate
buffer or no), and that terminfo(5) specifically states that it would
normally set 80-column mode (which, according to the comment above, we'd
want to avoid)... it seems extremely likely to me that issuing the init
string gives a lot more potential for causing problems than solving
them. Sure, we can just go on entering custom termcap settings in
screenrc whenever we encounter a problem, but should that really be the
answer?

I propose that screen not send the initialization string. Probably with
a command-line option that specifies it should be sent (though, IMO it
should be sent before smkx, and not after). Any thoughts on this?

- --
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer.
GNU Maintainer: wget, screen, teseq
http://micah.cowan.name/

_______________________________________________
screen-users mailing list
[email-masked]
http://lists.gnu.org/mailman/listinfo/screen-users

---

From: Micah Cowan <[email-masked]>
Date: Sun, 10 Aug 2008 19:51:46 -0700

Micah Cowan wrote:
> at all? And particularly _after_ issuing smkx.

(Sorry, here and elsewhere, I mean smcup (termcap "ti"), not smkx.)

- --
Micah J. Cowan

---

From: Stephane Chazelas <[email-masked]>
Date: Mon, 11 Aug 2008 11:16:18 +0100

On Sun, Aug 10, 2008 at 07:42:22PM -0700, Micah Cowan wrote:
[...]
> should be sent before smkx, and not after). Any thoughts on this?
[...]

On the other hand, it seems to me that sending the init sequence
would be the best way to ensure the terminal is in the state we
expect it to be in.

But I agree doing the smcup and switching to alternate screen
*before* doing the "init" sounds wrong.

-- 
Stéphane

---

From: Micah Cowan <[email-masked]>
Date: Mon, 11 Aug 2008 11:28:19 -0700

> would be the best way to ensure the terminal is in the state we

Probably; except that we _don't_ expect it to be switched to 80-col
mode, which is apparently one of the things is2 is expected to do.

If is2 is expected to be sent at a user's login, then perhaps we should
simply expect that it's already been taken care of, as a large variety
(most? all?) of other terminal apps appear to do (with the obvious
exception of "tput init" :) ).

> *before* doing the "init" sounds wrong.

Okay, so I'm not crazy there, then. :)

- --
Micah J. Cowan