Regarding less
, it is done all in the terminal emulator, because less
is unaware of the mouse.
The way it works with gnome-terminal is that it sees that the program switches to the alternate screen (an xterm feature) and since normal wheel mouse scrolling would be pointless (the alternate screen does not scroll), the developer chose to send up/down cursor-key escape sequences. That works with less
, just as if you pressed those keys on the keyboard.
PuTTY does not have this feature; its development has been glacial for several years. A comparable feature was added to xterm
in 2012, called alternateScroll
.
Before (or if the feature is not used), xterm
(which Putty imitates) would send a different escape sequence for the wheel mouse, but only if the program sends an escape sequence to turn on the mouse protocol. less
does not do this (and actually does not expect to read xterm
mouse escape-sequences).
Because the feature in gnome-terminal relies upon the terminal description using the alternate screen, that means that it will work on say half of the various systems, since people liking or disliking the feature seem to be fairly evenly split.