Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

I've recently had an odd experience when using Bash. When I used the mouse wheel to scroll up/down the Terminal window (in OSX) all I got was some control characters being printed out. It looked similar to this...
 Terminal
^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OB^[OB^[OB^[OB^[OB^[OB^[OA^[OA^[OA^[OA


At the time I was sudo'ed as another user so I exited that shell and tried the mouse wheel again only to have it scroll through the Bash command history instead.

After a bit of reading around this turns out to be related to something called 'cursor addressing' mode that programs like vi and less use. Usually this is turned off after you exit the program, unless something going wrong. There is a way to turn it back off by doing this:
 Terminal
tput rmcup


After running the above command I was able to scroll with the the mouse wheel again!



This most likely happened to me due to a VPN disconnection while being logged in on the remote server and having less open. No matter the cause the above fixes it.

-i

A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. Use of any information from my blog posts should be at own risk and I do not hold any liability towards any information misuse or damages caused by following any of my posts.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
Hi! You can search my blog here ⤵
NOTE: (2022) This Blog is no longer maintained and I will not be answering any emails or comments.

I am now focusing on Atari Gamer.