15

In contrast to this question I want the clearing of the screen re-enabled for less. It works fine in my xterm terminal under Cygwin/mintty or Gnome Terminal (both xterms).

However, when inside a screen session, the clearing of the screen is somehow disabled. I tried several things, like

screen -T xterm

or putting the autonuke statement in my ~/.screenrc. Also, inside the screen session

export TERM=xterm
tset

has no effect. So, now I'm out of ideas. Any help appreciated.

Boldewyn
  • 4,328
  • 5
  • 38
  • 52
  • hmm, i'm seeing the same thing, on Cygwin/mintty, Debian/putty, Ubuntu/putty. in putty i use *putty* as the TERM instead of *xterm* but that's the only real difference. – quack quixote May 05 '10 at 08:21

1 Answers1

21

You probably want to avoid screen -T or resetting TERM away from its default value while inside screen sessions (it should probably be screen or at least something that starts with screen).

Try putting the following line in your .screenrc:

altscreen on

To activate it on a per-session basis, you can do Control+a:altscreen onReturn.

My manpage says:

altscreen on|off

If set to on, "alternate screen" support is enabled in virtual termi- nals, just like in xterm. Initial setting is `off'.

BTW, I have explained the root cause of the “screen clearing” (actually alternate/normal screen swapping) in another answer. It is possible that your screen terminfo entry is missing smcup/rmcup or that your screen does not support alternate screens. Both of those seem less likely that altscreen being off.

Chris Johnsen
  • 39,401
  • 6
  • 111
  • 111
  • I'm using Mac and I don't have an altscreen command. Any other way of doing this? – Dana Jun 30 '11 at 17:22
  • 2
    @Dana: What version of *screen* (`screen --version`)? It seems that `altscreen` has been around since *screen* 3.9.13. Based on [opensource.apple.com](http://www.opensource.apple.com/), it seems like the Apple-bundled version of *screen* has been newer than 3.9.13 since 10.3. Just as a reminder, it is not a regular “shell command”, but a command that is specific to *screen*; it must be entered at the *screen* “colon prompt” (Control+a, then `:altscreen on`, then Return). – Chris Johnsen Jun 30 '11 at 22:54