Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bat as pager doesnt work on mouse scroll #2860

Closed
dougg0k opened this issue Feb 12, 2024 · 5 comments
Closed

bat as pager doesnt work on mouse scroll #2860

dougg0k opened this issue Feb 12, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@dougg0k
Copy link

dougg0k commented Feb 12, 2024

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.

@dougg0k dougg0k added the bug Something isn't working label Feb 12, 2024
@eth-p
Copy link
Collaborator

eth-p commented Feb 12, 2024

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.

@dougg0k
Copy link
Author

dougg0k commented Feb 13, 2024

I am not using less, but bat in the PAGER and MANPAGER env var.

@dougg0k
Copy link
Author

dougg0k commented Feb 13, 2024

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.

@dougg0k
Copy link
Author

dougg0k commented Feb 13, 2024

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

@dougg0k
Copy link
Author

dougg0k commented Feb 13, 2024

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

@dougg0k dougg0k closed this as completed Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants