Reattaching screen (having irssi running) forces window resize
Whenever I reattach to my detached screen (containing Irssi), my Putty screen is resized to something it has been at startup. If I change the window size after this, detach the screen and resize it back, window will be again resized to the original size. By window I mean the Putty window on my windows box. How can I turn this feature off?
Using Windows XP as my local and CentOS 6.0 as the remote OS. Putty 0.61.
You can also prevent screen from resizing any remote sessions. The other answer prevents this in your one local putty installation - but what if you come to another workstation?
Anyway, to prevent screen from resizing xterms, you need to:
- Edit
/etc/screenrc
- Find this this bit of text
# 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'
- Uncomment those two termcap lines and screen will behave from now on.
I just ran into this problem, googled, found the answer here, tested and thought it might be useful for others.
Note that if you are unable or do not want to edit the global screenrc configuration, ~/.screenrc
will do just fine for your current user.
Found the answer. The feature is called "remote terminal resizing", and it can be disabled at Configuration -> Terminal -> Features -> Disable remote-controlled terminal resizing, as described in PuTTY configuration.
Don't really know why reattaching screen does window resize remote request, though.
The accepted answer lacks an explanation for the phenomena. Here is one:
- The long string for
is
is an initialization string for the terminal, which usually is the same asrs
(used byreset
). - The example given contains a control sequence which resets the terminal from 132 to 80 columns. Just that part is the "3" in
\E[?1;3;4;6l
, which could be split up into four controls. The one that affects the width is\E[?3l
(see XTerm Control Sequences for"132 Column Mode (DECCOLM)"
). - That happens to be a VT100 sequence, which was used in the X11R5 xterm terminal description.
- When screen starts (or attaches), it initializes the terminal, just in case. That changes the terminal's width.
- CentOS 6 is a little old now; the current upstream
xterm
description has used a shorter sequence for quite a while, which initializes more things. - The newer/shorter sequence looks like this:
is2=\E[!p\E[?3;4l\E[4l\E>
(defined inxterm-basic
). The\E[!p
part isDECSTR
, which resets character sets, color and video attributes. The older sequence did not do that; tellingscreen
to use it works, but is not as clean. - If you use a different
TERM
setting, then the customization in.screenrc
will have no effect (because it usesTERM
to match the particular setting). - In particular, if you use something like
xterm-256color
, you may notice the same behavior again.