Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Terminal.app resize bug?

I use the Terminal.app to log into a Linux machine. I usually open up multiple tabs per window, and I run emacs in some of the terminal window. The problem is that when I resize the windows, often the window can not remember what size it's supposed to be, and sometimes switching from one tab to another triggers the window to resize to previous dimensions. It's particularly annoying when I start emacs in a tab that's confused in this way, because the window width that emacs thinks it is is incorrect, so emacs can not format the display properly. If I manually resize the window with emacs running, it snaps into place, but then the other tab gets confused.


I didn't have this problem, or it wasn't as noticeable on OSX 10.6.


Is there something I can do about this? This problem is really annoying, and Apple hasn't fixed the other Terminal.app bug I reported to them yet.

Posted on Jan 27, 2012 5:39 PM

Reply
17 replies

Jan 28, 2012 6:45 AM in response to quantamos

Perhaps it is an emacs bug. Have you tried installing the latest version? I'm guessing that since emacs is Stallman's baby it is another GPLv3 program that hasn't been updated on MacOSX since 2007 and never will be.


What other bug are you referring to? The 256 color issue? I believe that was fixed in Lion with the 256 color terminal emulator.

Jan 28, 2012 7:33 AM in response to quantamos

You could try iterm or iterm2

<http://iterm.sourceforge.net/>

<http://www.iterm2.com/>


You can always ssh -Y (or ssh -X) into your Linux system and export xterm's back to your Mac (although I'm not personally a fan of xterm, some people like it).


And of course there is always the gui version of emacs and have it export its X11 windows back to your Mac.


NOTE: I am not an emacs user, so anything I say about emacs is based on things I read on the intertubes :-)


You could VNC to your Linux box (although that generally speaking requires a rather fast network corrected to be anywhere usable for an editing session), also the build-in Mac OS X VNC client (Screen Sharing) does not always play nice outside the Mac family, so you should consider alternative VNC clients, such as Chicken (formally Chicken of the VNC), JollysFastVNC, tightvnc (via MacPorts.org), to name a few.


Finally, if you feel there is a real bug in Terminal that needs to be addressed, please file a bug report with Apple so they will have a chance to see and maybe fix it


BugReporter

<http://bugreporter.apple.com>

Free ADC (Apple Developer Connection) account needed for BugReporter.

Anyone can get a free account at:

<http://developer.apple.com/programs/register/>

Jan 28, 2012 5:15 PM in response to etresoft

I'm not on my work computer at the moment, so I can't verify these details, but here are a few points.


1) the problem is not specific to emacs. I know this because the terminal window can resize itself spontaneously without emacs running. emacs is just where the problem manifests itself the worst. that said, emacs was executing non-locally (i.e. on red hat), and I was running the latest version which I installed myself. i should verify that the problem happens if I run locally...


2) the problem only happens, as far as i know, if I have at least 2 tabs in a one window. i'm not sure which sequence of events will duplicate the problem, but it is some combination of resizing the window with my mouse, switching tabs, opening and quitting emacs. i'll try to get a reproducible sequence on monday.


3) The other bug also had to do with window sizes. i don't have a record here so i'm not 100% sure i'm repeating myself accurately, but i specified steps which could reproduce it. i usually like to have 3 windows sized exactly so that they fit perfectly on my monitor (Terminal will open them at those dimensions when it is started up). however, if I quit Terminal and then restart it, lion will reopen old windows, but make them like 2 columns wider (and they no longer fit). if I quit and reopen repeatedly, they get bigger every time. this means that i must close all my tabs/windows before quitting terminal, which is annoying.

Jan 28, 2012 7:21 PM in response to quantamos

quantamos wrote:


I believe it is a bug, I'm just wondering whether other people have noticed and/or figured out exactly what to put in a bug report.

One thing you will definitely need is a sequence of steps to reproduce the error. Advanced tools like Terminal, Xcode, etc. don't get much attention from Apple. Apple seems to feel that these are professional tools and professionals can be expected to put up with things and work around them. Unless you have a bug that can be easily reproduced, they aren't likely to bother with Terminal.

Jan 30, 2012 12:10 PM in response to etresoft

Ok, I've got some steps. I can get this to work in both emacs and vi, and I'm doing this all on my local machine (i.e. ignore my earlier references to logging into a Linux machine).


1) Open Terminal

2) ⌘t to make new tab

3) vi

4) drag window smaller

5) :quit<enter>


The result is that when vi quits, the window pops back to the original size. This is a problem.


6) now open emacs


Emacs can't display correctly because it doesn't know what size the window is supposed to be. This is another problem.


7) now drag window with emacs still active. emacs now recieves the correct dimensions and displays the intro page correctly.

8) quit emacs


Quiting emacs now pops the window back to the original size. At this point, the tab just seems confused.


Should I send this in as a bug report?


GNU Emacs 22.1.1

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 24 2011 20:00:09)

Terminal 2.2.1 (299)

Jan 30, 2012 12:29 PM in response to quantamos

Should I send this in as a bug report?

Yes, HOWEVER, I cannot reproduce your problem on my Mac OS X 10.7.2 Lion system.


After resizing my new tabbed window with /usr/bin/vi, and :quit, my window remains the same size. stty -a shows the correct after resize rows and columns.


You might want to try an experiment. Create a new account (System Preferences -> Accounts). Does Terminal behave the same in this new account? If it does not, then perhaps there is something in your primary account affecting the behavior of your Terminal session, your vi session, your emacs session.


If you have another Mac available, like maybe a friends that has not shared shell initializations, nor editor initializations, and see if it behaves the same. You could even just visit an Apple Store (if one is near by), and try your test on one of those systems.


But if you want to report this, use BugReporter

<http://bugreporter.apple.com>

Free ADC (Apple Developer Connection) account needed for BugReporter.

Anyone can get a free account at:

<http://developer.apple.com/programs/register/>

Jan 31, 2012 10:59 AM in response to etresoft

etresoft wrote:

I can definitely reproduce it. However, I can just as easily reproduce it in 10.6. I doubt you will get it fixed any time soon. I've had 5-10 terminal sessions open a day for several years and hadn't noticed this.


I suppose that depends on your workflow. I do everything in terminal tabs, and I'm contantly resizing them, so this trips me up all the time. I just never bothered until now to figure out how to reproduce it.

Jan 31, 2012 12:55 PM in response to quantamos

I do that too. But I never run a vi session in a resized window. When I'm working with code, I don't want to have to scroll left and right and up and down. I keep my editing terminal windows at 80 characters, which gives me 76 characters with the line numbers. I run tail -f and all kinds of other commands in resized windows, but never an editor.

Apr 5, 2012 10:29 AM in response to quantamos

This problem can be reproduced on my machine. It seems that running VIM in the second tab, then resizing the window, messes vim up. But sometimes, an action I take cleans things up. Problem seems worse when shelling into a remote machine. stty reports the SAME on all machines.

I'm not seeing the actual window resize... the problem is mostly within VIM, when scrolling through a document, VIM overdraws the wrong file lines on top of other lines.


I've NOT noticed it prior to 10.7.x ... I'm running Terminal 2.2.2 (303) on OSX 10.7.3, so it may be worth keeping track of versions that exhibit the problem. My TERM is rxvt.


# stty -a

speed 9600 baud; rows 60; columns 186; line = 0;

intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O;

min = 1; time = 0;

-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts

-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc ixany imaxbel -iutf8

opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0

isig icanon iexten echo echoe -echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke


# echo $TERM

rxvt

Mar 7, 2013 9:47 AM in response to quantamos

I realize this thread is old but I came across it while trying to chase down a similar problem. Turned out that in my Terminal.app setup I was invoking a script to run when launched that sudo'd me to a different utility account I use for work. With the script I saw that stty -a never kept up with resizes but if I ditched the script and ran the sudo command directly it works just fine. Only posting this in case someone is searching and comes across the thread and this information saves you a headache. 😉

Oct 3, 2013 7:24 AM in response to quantamos

I found one method that seems to work. Typically, when I launch the Terminal application, the window is somehow 2 characters wider than the previous time it was opened/launched, and with every time I launch the application, the window keeps getting wider and wider. The height seems to stay the same. Even though I've set up all the settings to be, and STAY, at 80X24, the application seems to ignore this for some reason. It later opens as 82X24, then later as 84X24, then later as 86X24, etc.

What I do now is a few steps. When it opens in the wrong size, I open a new window in Terminal with command-N and that new window WILL BE at the correct width. I close each window firstthen quit out of Terminal. When I launch it again, THIS TIME, this ONE time, it will have the correct width!

Unfortunately, after quitting out of the application yet again, it reverts back to its buggy width-growing. So I just repeat command-N to open a new correctly-sized window - close each window - then quit - and finally Terminal should open with the correct-sized window for that very next one instance again.

This is useful for me, since some of my scripts won't work if the window grows too wide, and after re-launching Terminal enough times, it can grow clean out of the monitor view!

It's a bit of a clunky solution, but it works for me. I wish I could automate it.

Terminal.app resize bug?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.