6

This question already has an answer here:

I would like to use screen (from GNOME Terminal, via ssh) like I use GNOME Terminal without screen, or as close as possible to that. Specifically:

In GNOME Terminal, I can scroll back using the mouse wheel, the scrollbar or Shift+PgUp/PgDn. In screen, I have to go to copy mode (Ctrl+A,[) to be able to scroll back (mouse wheel works after that). Scrolling behavior can be changed (see this answer and this answer) but this solution has the following flaws:

  1. When I open a file with less or vim, I can scroll above the editor 'window' with my mouse wheel and see the previous contents of the terminal.
  2. When I close the editor, its contents stay in the scrollback buffer (sometimes in several copies) instead of disappearing.

This behavior can be changed using altscreen on (see this answer) but the only effect is that when the editor is closed, the old terminal contents are appended to the scrollback buffer in my terminal window so I can still see the editor crap when I scroll back using my mouse wheel.

Does this mean it's not possible to have nice scrolling in screen? Basically, all I'd like is being able to scroll just like in copy mode (using the mouse wheel, and scrollbar if possible) but without having to enter copy mode.

marked as duplicate by roaima, cas, cuonglm, Scott, Anthon Apr 19 '16 at 5:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

Perhaps you cannot have what you are asking.

From the terminal's standpoint:

  • screen is a full-screen (no pun) application just like vi or less.
  • the terminal implements scrolling and an alternate screen.
  • when the terminal is in alternate-screen mode, it does not add to its scrollback area as it would in normal mode.
  • in gnome-terminal (and perhaps some others — an option in xterm), the terminal will send up/down arrow keys to the application when it is in alternate-screen mode.
  • when not in alternate screen mode, your terminal will scroll through the visible screen and the terminal's scrollback area without any notification to the application running inside it.

From screen:

  • screen does not know anything about mice or scrolling; it passes that information to the application running inside screen.
  • screen simulates an alternate screen; it has no way to access the alternate screen of the terminal.
  • you can disable the alternate screen feature of the terminal, as indicated in the question.

In short, because screen does not have any way to access the scrollback of the terminal, your available choices are those that the terminal provides.

  • So screen runs in alternate screen mode by default but when I put altscreen on in .screenrc, screen tries to simulate one and turns it off in the terminal, right? And termcapinfo xterm* ti@:te@ tells screen not to capture the mouse wheel so it's caught by the terminal and used for scrolling? – ondra.cifka Apr 18 '16 at 23:56
  • yes - except that screen's altscreen is simulated, whether or not the terminal supports the feature. – Thomas Dickey Apr 18 '16 at 23:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.