Entree_Eater · 2022-11-01 07:23
Hi, sorry for the noob question, but I've been starting to use the terminal for the first time and emacs as the text editor for that. I wanted to enable the mouse, so I turned on Xterm Mouse Mode, but once I did that, scrolling seemed to be completely turned off. Whenever I try to scroll, it just says mouse 4/5 are undefined.
I tried to find a solution online, but the solutions I came across seemed very hack-y. It feels like this kind of thing is just a setting I missed, especially because scrolling was working perfectly fine before. If there is no "direct" solution, I am curious why this is the case. Thanks!
eli-zaretskii · 2022-11-01 07:34
Xterm Mouse mode doesn't support scrolling with the mouse-wheel, I think.
However, if Emacs perceives the wheel turns as `mouse-4` and `mouse-5` keys, you can bind those to `scroll-up-command` and `scroll-down-command`, and see if that works for you.
JohnDoe365 · 2022-11-01 12:57
Are you on wayland? If so, it's a known bug.
Entree_Eater · 2022-11-02 03:03
Dang, that's unfortunate. That's pretty much the answer I was finding from Google, but I wanted to make sure I wasn't missing something. Thank you though!
For anyone seeing this in the future, neither `scroll-up-command` nor `scroll-up-line` actually gave the behavior I was looking for. After a bit (more than I'd like to admit) of Googling, `previous-line` and `next-line` were the ones that worked for me. Thus, my init file now looks like:
`(xterm-mouse-mode t)`
`(global-set-key (kbd "<mouse-4>") 'previous-line)`
`(global-set-key (kbd "<mouse-5>") 'next-line)`
JohnDoe365 · 2022-11-02 11:23
For reference, this was the issue with wayland and pgtk-build
[https://emacs.stackexchange.com/questions/64935/mwheel-scroll-bindings-between-gui-and-terminal](https://emacs.stackexchange.com/questions/64935/mwheel-scroll-bindings-between-gui-and-terminal)
but according to [https://debbugs.gnu.org/cgi/bugreport.cgi?bug=50321](https://debbugs.gnu.org/cgi/bugreport.cgi?bug=50321) it has been fixed