1

I used to be able to scroll using the trackpad through git diff or man pages which both use less when the output doesn't fit on screen. Today I restarted my computer and that behaviour is gone and I can no longer scroll down and if I scroll up it scrolls the terminal scrollbar showing previous commands. However in vim scrolling still works as expected.

The first thing I checked is the "Scroll alternate screen" Terminal setting and it is checked as expected. I also tried with iTerm2 and have the same issue even with the "Scroll wheel sends arrow keys when in alternate screen mode" setting enabled.

My default shell is zsh so I tried with bash and then sh. Both have the same behaviour and I can't scroll through the output.

Because scrolling still works with some commands like vim it seems like the issue might be that less is no longer recognized as an "alternate screen" but I have no idea why. Updating to the latest less version available on brew did not help.

4

it is weird, I had the exact issue this morning with iterm2.

I ended up adding the following to my ~/.zshrc:

export LESS=-R

Important: you might want to take a look at the flags you are using before running this command and understanding what each of them do.

Sources I looked at to arrive to this conclusion:

  1. https://askubuntu.com/questions/803486/can-i-scroll-to-new-lines-using-mouse-wheel-inside-git-diff
  2. https://superuser.com/questions/455212/how-to-make-mouse-wheel-scroll-the-less-pager-using-bash-and-gnome-terminal

Let me know if this helped.

  • echo $LESS returns -FRX at the moment for me. Looks like the -X might be the issue. – Chris911 Jul 31 '18 at 2:04
  • I tried removing X as well, didn't fix it for me. I also had the same flags enabled. – pgarciacamou Jul 31 '18 at 17:49
  • 2
    Adding export LESS=-FR to my .zshrc fixed it for me. In iTerm do you have the "Scroll wheel sends arrow keys when in alternate screen mode" setting set to Yes? – Chris911 Jul 31 '18 at 18:25
  • That is correct. "Scroll wheel sends arrow keys when in alternate screen mode" is on. – pgarciacamou Aug 3 '18 at 20:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .