Comment 2 by kumaran.santha... on December 19, 2013 01:19
I figured that I didn't need it since the behavior was inconsistent with the two cases. In other words, no matter what the local settings are, there is a bug since iTerm2 behaves differently depending on which server it's logged into.
If you really need it, I can spend time exporting and sanitizing it, but I'd appreciate if you could try this first since it's relatively quick to test.
Sorry, I misread the report--didn't realize it worked sometimes. So if it works on Terminal and not iTerm, we need to see what's different. The most likely candidate is $TERM on the remote host. Please diff the environment vars post-ssh'ing and see what's changed.
Make sure your profile is set to use a login shell and does not have a custom command set. This can cause your login script not to be run and may be responsible for the difference. The nightly builds of iTerm2 have this issue fixed. (Please back up your preferences file before running a nightly build, though).
Comment 4 by kumaran.santha... on December 30, 2013 20:21
I logged in with iTerm and Terminal and in both cases the environment variables are identical (i.e. diff of the output of /bin/env). The TERM variable is set to xterm-256color for both terminals. If I understand correctly, this would rule out the login shell as the cause.
Can you make a logfile reproducing the problem on centos? Use shell>log>start, do the ls and run emacs and suspend it, then shell>log>stop, and attach the log file to this bug.
Comment 6 by kumaran.santha... on January 01, 2014 22:06
I did that, but the problem wasn't immediately obvious. To make it easier, I have set up a server running CentOS 6. You can use it to reproduce the problem using the steps above. Please send me a private email for login information.
Comment 7 by alexanderli... on February 20, 2014 21:07
I can report the exact same issue with iTerm2 (build 1.0.0.20140112) where emacs (running with the command 'emacs -nw') will erase previous output when closed. I have tested it on two SSH servers and it only work on one of them. Both have the TERM variable set as 'xterm' and I use iTerm2 with a profile where the 'Disable save/restore alternate screen' option in Preferences->Profiles->Terminal is disabled. I also use the login shell and not a custom command set.
The server running Red Hat Enterprise Linux release 5.10 (Tikanga) will give the correct expected behaviour but the server running CentOS release 6.5 (Final) will give the bug behaviour.
Are there any updates on this issue?
Comment 9 by kumaran.santha... on January 08, 2015 23:33
The issue still exists in iTerm2 (build 2.0). It works as expected on Ubuntu 12.04 and exhibits the bug on CentOS 6. Terminal works as expected on both servers. There is no difference in the output of "infocmp" between iTerm2 and Terminal.
From the diff below, it looks like CentOS 6 has "rmm" and "smm" while Ubuntu 12.04 has "setb@" and "setf@". Everything else seems to be the same.
% diff infocmp-centos6.txt infocmp-ubuntu12.txt
1c1
< # Reconstructed via infocmp from file: /usr/share/terminfo/x/xterm-256color
---
Reconstructed via infocmp from file: /lib/terminfo/x/xterm-256color
There are a few control sequences we don't support that they might be using. Could you please create a shell log by doing shell>log>start, suspend emacs, and then shell>log>stop? That'll confirm the hypothesis and let me know what needs to be added.
I'm seeing the same behavior. When I SSH to a Centos6.6 machine via iTerm2, then run emacs -nw, the previously-entered terminal contents are cleared upon exit. When I do the same via Terminal, the screen contents do NOT get cleared (this is the desired behavior). I compared the infocmp output for both the iTerm2 SSH session and the Terminal SSH session, and they are identical. Note that if I run tmux, the 'altscreen' behavior works just fine (in iTerm2 as well). This solves my immediate need, since I usually use tmux anyway, but it would be nice if the normal non-tmuxed iTerm2 worked as expected too.
@stahl.karl, Looks ok, I see DECSET 1049 which is supported. Can you confirm that prefs>profiles>terminal>disable save/restore alterante screen is not on?
Well, good news, @Ishmael , it is fixed in the nightly build. I recommend switching over to it because 2.1.1 is (I dearly hope) the last release prior to 3.0.