bat as pager doesnt work on mouse scroll
dougg0k opened this issue · 5 comments
Hi,
If I use bat
or bat --paging=always
as the pager and do something like git diff
in a repo, the scrolling only happens by using arrow or page down which goes all the way at once.
Bug would be that it does not work on the mouse scroll, only after the scroll happens or passed to a certain line by the arrow or page down.
Do you have the LESS
environment variable set?
less
doesn't enable mouse wheel support by default, and needs to be passed the --mouse
option to enable it. If you do have --mouse
passed to less
, we'll need some more info (e.g. less
version, platform, terminal program) to help reproduce the issue.
I am not using less
, but bat
in the PAGER
and MANPAGER
env var.
Another possible bug I noticed is that when you get to scroll with bat
you can go before the actual beginning of the file in the previous written outputs in the terminal, rather than being isolated in the file as you do with less
.
Also less
do work with mouse scroll by default, without setting anything.
Maybe I am looking to have bat
as also the replacement of less
and that is wrong, even thought it seem to have similar functionality.
I came back to check again on this, bat --paging=always
if used straight in a file, the mouse scroll does work by default correctly, but if put in the those variables I mentioned above.
Also if used in something like man
, the line numbers show and mouse scroll also works.
So, the issue was mostly with git
and now I see why, I had forgotten I was using git delta
as pager. That is the conflict with those pagers env vars. I guess I would need to find a way to have bat
as the pager, yet not have it conflict with git delta
.
It seems that regarless of having delta set on gitconfig, it still use the PAGER
env var.
Also the mouse scroll problem seem to be tied to delta not bat.
Not even setting the DELTA_PAGER to less, solves the problem. https://dandavison.github.io/delta/tips-and-tricks/mouse-scrolling.html?highlight=scroll#mouse-scrolling
I just found the solution right after the other issue were closed.
Setting the DELTA_PAGER
var with the less
command along side all flags mentioned in this answer https://superuser.com/a/1453863 resolved the issue and I was able to still keep the PAGER
var as bat --paging=always
less -F -S -R -i -+X