-1

man itself shouldn't know anything about mouse wheel, and the scroll bar of the xfce4-terminal window doesn't change, so...

Did xfce4-terminal send something to the pty master fd when the window captures mouse wheel event from X server?

If yes, what does it write to the pty device to act like I pressed the Down Key?

Or am I completely missing something?

  • This is more a question about the pager that is used by man (probably less?). For example, try man -P cat [manpage] to use cat as a pager. – red_trumpet Mar 21 at 7:53
  • On the other hand, less claims that it does not support mouse wheel scrolling (search for wheel on that page), but it works for me. Strange... – red_trumpet Mar 21 at 7:55
5

Your pager displays its contents in the alternate screen buffer, which selects “alternate scroll mode” (which you can see because the vertical scroll bar changes — it no longer allows scrolling the window contents), and in that mode, the terminal translates mouse wheel movement to cursor up/down controls. This was introduced in XTerm a long time ago and is widely supported in current terminals.

To see what sequence is used to switch to the alternate screen buffer, run

tput smcup | od -a

You should see esc [ ? 1 0 4 9 h. This is what the pager sends to the terminal. is represented by CSI B which the terminal sends to the running application.

If your pager is less, you can disable this by exporting LESS=X to the environment (this skips terminal initialisation).

  • So I am right, when the terminal window receive a key event it DOES write something to the master pty fd? And the programs(the pager) running in the terminal DOESN'T know anything about mouse but just bytes received from pty slave. – 炸鱼薯条德里克 Mar 21 at 11:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.