When I close a 'pager' (like 'less', 'vim', 'emacs -nw', 'man bash' etc) I would like its text content within the terminal to *disappear*, and the terminal to show the content it had before the pager was invoked. I guess these programs print to the so called "alternate terminal buffer", and when the program is exited, the terminal goes back to show the default terminal buffer. When not involving GNU-screen, this is the usual behaviour (if the underlying terminal is modern enough and has an "alternate terminal buffer" at all). I hope I am being reasonably right so far..?
But when using GNU-screen a problem appears. Since GNU-screen is already using that "alternate terminal buffer", this desired effect is not achieved: When I close the 'pager' and go back to GNU-screen view, the terminal remains in the "alternate terminal buffer", so the pagers text content remains visible.
Ok, so I can tell GNU-screen to use the "default terminal buffer" by adding to ~/.screenrc a line like this:
termcapinfo xterm|xterms|xs|rxvt ti@:te@
But that info seems to extend to the pagers so that they, as well, refuse to use that "alternate terminal buffer".
To summarize: When I close a 'pager' I would like its text content within the terminal to *disappear*,
and the terminal to show the content it had before the pager was
invoked. How can I resolve this? Is there a way to tell GNU-screen to use the "default terminal buffer" while still letting the programs invoked from within GNU screen use the "alternate terminal buffer"?
$ screen --version Screen version 4.00.03jw4 (FAU) 2-May-06