Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Every time I start screen (screen -A) or try to connect to an already running screen session (screen -Ax) my terminal is resized to 80 columns. I want to prevent screen from resizing my terminal.

I am using iTerm on Snow Leopard and my screen sessions are on a centos machine (I use bash as my shell).

share|improve this question
up vote 23 down vote accepted

Try adding this (from /etc/screenrc) to your ~/.screenrc:

# Change the xterm initialization string from is2=\E[!p\E[?3;4l\E[4l\E>
# (This fixes the "Aborted because of window size change" konsole symptoms found
#  in bug #134198)
termcapinfo xterm* 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'

You may need to change the "xterm" to match your $TERM.

The termcapinfo line sets is (ininitialization string) for any terminal with a name starting with "xterm" to a sequence of escape codes. \E represents escape and the codes are as follows:

\E[r       - set scrolling region to default (full size of window)
\E[m       - reset all resources (keyboard) to their initial values
\E[2J      - Erase in Display (ED). 2 -> Erase All.
\E[H       - set cursor position to default (1, 1)
\E[?7h     - DEC Private Mode Set. 7 -> Wraparound Mode
\E[?1;4;6l - DEC Private Mode Reset. 1 -> Normal Cursor Keys; 4  -> Jump (Fast) Scroll; 6 -> Normal Cursor Mode

The replaced line had these codes:

\E[!p      - Soft terminal reset
\E[?3;4l   - DEC Private Mode Reset. 3 -> 80 Column Mode; 4 -> Jump (Fast) Scroll
\E[4l      - Reset Mode. 4 -> Replace Mode
\E>        - Normal keypad

(source: XTerm Control Sequences)

share|improve this answer
    
That worked. Thanks a bunch. – blackwing Dec 2 '10 at 18:35
    
thanks! added this answer to serverfault.com/questions/158508/… – Joshua D'Alton Apr 13 '13 at 8:06
    
Would you mind decoding the termcapinfo line? – Huckle Sep 30 '15 at 17:23
2  
@Huckle: I added an explanation of the escape codes. – Dennis Williamson Sep 30 '15 at 18:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.