Paul Gideon Dann
2013-11-18 12:39:22 UTC
Hello all,
I've spent so long trying to find a solution to this that I decided to ask the experts, in the
hope that a solution does in fact exist.
In my .tmux file, I have (of relevance):
set -g mouse-select-pane on
set -g mouse-resize-pane on
set -g mouse-select-window on
setw -g mode-mouse on
If none of these options are present, tmux will pass through mouse wheel scroll events as
emulated arrow-key events (as determined by "cat -v"):
^[[A^[[A^[[A^[[B^[[B^[[B
However, if one or more of these options is enabled, tmux enters a "mouse capture" mode,
and doesn't emulate the mouse scroll wheel in this way, and nothing at all is passed to "cat
-v". This all seems well and good, and certain applications (e.g. Vim) work brilliantly,
because they are themselves mouse-aware, and the world is a wonderful place.
However, when it comes to reading man pages, git logs, or indeed anything that uses a
pager (mostly "less", by default), I do not have the ability to scroll with the mouse, and I
REALLY miss this (mainly for man pages). Less pops up, and scrolling the mouse simply
enters copy-mode (if mode-mouse is on), or nothing at all happens (if mode-mouse is off or
copy-mode).
Naturally, this is because tmux is no longer forwarding on an emulated three-up or three-
down sequence that makes the scroll wheel act like the user is pressing the up and down
arrows. However, I've had no luck at all finding a way to make "less" mouse-aware in order
to make mouse scrolling work correctly in tmux.
Interestingly, outside of tmux, Konsole doesn't perform any arrow-key emulation on scroll:
"cat -v" shows nothing when I scroll the mouse, but the scrollbuffer scrolls up (as expected).
This is very similar behaviour to tmux. However, when "less" is used directly in Konsole, I'm
able to use the mouse to scroll up and down. I'm not entirely sure what kind of magic is
going on there, but it gives me hope that the same behaviour might be possible in tmux.
Any thoughts / help would be greatly appreciated.
Paul
I've spent so long trying to find a solution to this that I decided to ask the experts, in the
hope that a solution does in fact exist.
In my .tmux file, I have (of relevance):
set -g mouse-select-pane on
set -g mouse-resize-pane on
set -g mouse-select-window on
setw -g mode-mouse on
If none of these options are present, tmux will pass through mouse wheel scroll events as
emulated arrow-key events (as determined by "cat -v"):
^[[A^[[A^[[A^[[B^[[B^[[B
However, if one or more of these options is enabled, tmux enters a "mouse capture" mode,
and doesn't emulate the mouse scroll wheel in this way, and nothing at all is passed to "cat
-v". This all seems well and good, and certain applications (e.g. Vim) work brilliantly,
because they are themselves mouse-aware, and the world is a wonderful place.
However, when it comes to reading man pages, git logs, or indeed anything that uses a
pager (mostly "less", by default), I do not have the ability to scroll with the mouse, and I
REALLY miss this (mainly for man pages). Less pops up, and scrolling the mouse simply
enters copy-mode (if mode-mouse is on), or nothing at all happens (if mode-mouse is off or
copy-mode).
Naturally, this is because tmux is no longer forwarding on an emulated three-up or three-
down sequence that makes the scroll wheel act like the user is pressing the up and down
arrows. However, I've had no luck at all finding a way to make "less" mouse-aware in order
to make mouse scrolling work correctly in tmux.
Interestingly, outside of tmux, Konsole doesn't perform any arrow-key emulation on scroll:
"cat -v" shows nothing when I scroll the mouse, but the scrollbuffer scrolls up (as expected).
This is very similar behaviour to tmux. However, when "less" is used directly in Konsole, I'm
able to use the mouse to scroll up and down. I'm not entirely sure what kind of magic is
going on there, but it gives me hope that the same behaviour might be possible in tmux.
Any thoughts / help would be greatly appreciated.
Paul