#565699 /usr/bin/git-diff: pager ignores mouse wheel

Package:
git
Source:
git
Description:
fast, scalable, distributed revision control system
Submitter:
jasen
Date:
2010-05-15 21:21:27 UTC
Severity:
wishlist
#565699#5
Date:
2010-01-18 00:35:26 UTC
From:
To:
If I do "git-diff" I get the output in what appears to be an instance of less
that ignores scroll-wheel events

If I do "git-diff | less" the wheel works like it normally does in less but
I don't get the colours.

If I do "git-diff --color | less -R" I get the desired behavior.

I hope that helps.

#565699#10
Date:
2010-01-26 20:27:09 UTC
From:
To:
[From my comment on the corresponding Ubuntu bug:
<https://bugs.launchpad.net/bugs/326460>]

git exports LESS=FRSX if the LESS environment variable is not already
set. The -X (--no-init) is required to let -F (--quit-if-one-screen)
work sensibly, but breaks mouse wheel scrolling.

To work around this, you can disable both of those options by exporting
LESS=RS. You will gain mouse wheel scrolling, but the disadvantage is
that you will always have to explicitly quit the pager, even if it is
displaying less than a screenfull.

If you think the default should be changed, consider talking to the
upstream developers: <http://vger.kernel.org/vger-lists.html#git>.

Anders

#565699#15
Date:
2010-02-22 08:16:32 UTC
From:
To:
found 565699 git-core/1:1.7.0-1
tags 565699 + upstream
severity 565699 wishlist
thanks

Anders Kaseorg wrote:

Thanks Anders, that makes a lot of sense.

I should also mention that -X can be useful even without -F, to keep
the last displayed part of a log visible on the terminal for cutting
and pasting into later commands.  So different people would probably
want it different ways.

On the interaction of -F and -X you described, see
<http://bugs.debian.org/51462>.  It is not my itch, but I could imagine
less providing another option to get the best of both worlds by
buffering until it gets a screen’s worth, EOF, or a certain amount of
time passes, or something like that.

For git, the bug here is that in terminals that support scrolling with
a wheel without -X, git is disabling that.  I think a good default
_might_ be to use -RS for such terminals and -FRSX for others.  This
requires a way to detect terminals that support scrolling in ‘less’
with a wheel (xterm doesn’t AFAICT), so it might be hard to implement.

Hope that helps,
Jonathan

#565699#26
Date:
2010-02-22 23:13:03 UTC
From:
To:
xterm does support the feature (vim uses it for instance, on cygwin).
But 'less' doesn't seem to.

#565699#29
Date:
2010-02-22 23:13:03 UTC
From:
To:
xterm does support the feature (vim uses it for instance, on cygwin).
But 'less' doesn't seem to.