0

GUI terminal emulators like xfce4-terminal have several ways of scrolling through the terminal's buffer. Primarily:

  1. shift-(pgup/pgdown, home/end, up/down)
  2. mouse wheel
  3. clicking and dragging button on the scroll bar

I want a way for all three to work within tmux.

I know 3 won't work in split screens. I'm OK with that. I won't be using split screens.

I know there's set -g mouse on. That only does number 2 in the above list. I really really want all three in that list.

GNU screen actually has this ability. You use the line

termcapinfo xterm* ti@:te@

in .screenrc. I'd like this kind of behaviour. I am not using GNU screen because it handles terminal resizing extremely poorly.

1 Answer 1

0

I don't believe it's possible for this to work - in much the same way that this approach for scrolling won't work in applications like vim / nano.

It is possible for mouse clicks to be passed to the applications running on a terminal, but this is an extension of the terminal that you're using... as you've stated, it is also possible for some terminal emulators to convey mouse wheel events, but the application must also support such events.


It's not immediately possible because the applications are moving the cursor to absolute coordinates on the terminal and drawing their output. This is an extension - old terminals could only print new information at the bottom of the screen (or paper... xterm and friends are direct descendants from teletypes). As technology has progressed, features like moving the cursor around the screen were introduced. Now we use "Terminal Emulators" (that's what xterm is) rather than physical "Terminals".

When you use Shift + PgUp/PgDn or drag the scroll bar, you are scrolling back through the terminal emulator's "scrollback buffer" - count yourself lucky there is such a thing!

As new lines are output at the bottom, old lines are pushed off the top of the screen and are then available by reviewing the terminal's scrollback buffer. This is static, and does not change (immutable).

It would make zero sense to try to review the scrollback buffer, and observe applications correctly re-draw themselves.

Don't forget that the terminal's buffer, and the application are two very different things!


In tmux you can use Ctrl+B then PgUp/PgDn to review one pane's scrollback buffer (remember, tmux is effectively a terminal emulator running inside a terminal emulator). At this point tmux will "freeze" that pane, and you will be able to scroll up/down, and search backward/forward using ? and / (the same as vim and less).

Press Return or Ctrl+C to return to the bottom and interact with the application / shell again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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