putty and screen and scroll-back buffer [closed]

When I use screen inside a putty session, I can't seem to use the scrollback buffer of putty to look at whatever just scrolled off the screen. Instead, I just see what was happening in the putty session just prior to my running screen.

What am I missing here? I like being able to scroll back, and I don't want to use the screen functionality to look at the past buffer; the scroll wheel on my mouse doesn't have hooks into screen and I don't expect it ever would.

Thanks!


Solution 1:

You might also check out the Screen FAQ which allows a sort of hybrid behavior:

Summary: add the line to your .screenrc file:

termcapinfo xterm ti@:te@

Reference ( Putty FAQ )

PuTTY's terminal emulator has always had the policy that when the ‘alternate screen’ is in use, nothing is added to the scrollback. This is because the usual sorts of programs which use the alternate screen are things like text editors, which tend to scroll back and forth in the same document a lot; so (a) they would fill up the scrollback with a large amount of unhelpfully disordered text, and (b) they contain their own method for the user to scroll back to the bit they were interested in. We have generally found this policy to do the Right Thing in almost all situations.

Unfortunately, screen is one exception: it uses the alternate screen, but it's still usually helpful to have PuTTY's scrollback continue working. The simplest solution is to go to the Features control panel and tick ‘Disable switching to alternate terminal screen’. (See section 4.6.4 for more details.) Alternatively, you can tell screen itself not to use the alternate screen: the screen FAQ suggests adding the line ‘termcapinfo xterm ti@:te@’ to your .screenrc file.

Solution 2:

To scroll back, press ^A (Ctrl-A, or whatever your screen control sequence is if you remapped it) and then Esc. This will let you move the cursor up and down. PgUp/PgDn will let you scroll up and down inside of screen.

The reason for this is the way that screen handles the scrollback buffer. Screen always draws the full text area, and has its own backbuffer that you must control with screen. This is similar to using programs, like vi or joe, that take up the entire text area and provide their own buffer: scrolling up in your terminal emulator just gives garbage, but scrolling up inside those programs gives your intended result.

Solution 3:

That's because of how screen works. Screen does a dynamic update of your whole text area, rather than pushing new lines at the bottom of the screen which in turn pushes the top line into the scroll-back area. It redraws the whole screen when a new line shows up, which prevents more data going into scroll-back. The same problem exists in 'less' when not using screen.

Solution 4:

Screen with Putty scrollback is working automatically in Solaris 10. It seems to be doing what KnipSter said by default even though I do not have a .screenrc file. The problem with this approach is that, if you detach and re-attach then there is no scrollback buffer in Putty and you must resort to using Screen's scrollback as described by Scagnelli.