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

mouse_support prevents scrollwheel from working on Linux #224

Open
mixmastamyk opened this issue Jan 22, 2016 · 9 comments
Open

mouse_support prevents scrollwheel from working on Linux #224

mixmastamyk opened this issue Jan 22, 2016 · 9 comments

Comments

@mixmastamyk
Copy link

Awesome toolkit !!!

Can't use the scrollwheel on my mouse after setting this on Linux:

mouse_support=True

Latest pptk on Ubuntu Wily.

@jonathanslenders
Copy link
Member

Hi @mixmastamyk,
This depends on the terminal. Could you try holding the shift key while scrolling? It could be that the terminal doesn't send scroll events to the application running in the terminal if shift was pressed.

Jonathan

@mixmastamyk
Copy link
Author

Hmm, nope, shift does allow pasting etc, but scroll-wheel is not working with or without the shift key. It is mate (gnome2) terminal, btw.

I've disabled the feature for now since the benefits are not huge and the drawbacks significant. Perhaps it is just the nature of mouse support, if I had a menu or something I might re-enable.

@abarnert
Copy link

abarnert commented Feb 9, 2016

I don't think this has anything to do with which terminal you're using. I see the same thing with gnome-terminal on linux, iTerm2 on Mac, and rxvt on linux talking to X server on Mac--the terminal only seems to get mouse-2 and mouse-3 events; everything else gets eaten by prompt-toolkit.

It would be really nice if I could use mouse clicks to move the cursor in ptpython, while still being able to scroll up and select history for copying in iTerm2. I'm not sure if there's an obvious design to make that work (how do you pass through mouse-1 drags and double-clicks needed for select, while handling mouse-1 clicks?), but if there is, I'd be happy. :)

@zpincus
Copy link

zpincus commented Jul 29, 2016

I can confirm this on a Mac as well, using the default Apple terminal: mouse integration completely prevents the scrollwheel from scrolling the terminal.

It would be great of prompt_toolkit only eats scrollwheel events in contexts where that is applicable (e.g. scrolling through completions or similar), but I have no idea if this is easy to distinguish or not.

@jonathanslenders
Copy link
Member

jonathanslenders commented Jul 30, 2016

This is normal. Either the terminal can use the mouse to handle text selection or scrolling through the history lines, or the mouse events are sent to the application running in the terminal.

But most terminals will still handle the mouse when the application requests mouse events, if you hold alt, option, control or shift while scrolling or selecting text.

edit: handling mouse events only in a certain context in unfortunately not possible. This is a limitation of how terminals work.

@zpincus
Copy link

zpincus commented Jul 30, 2016

Sadly, both in ptpython and IPython 5 on my mac, using the latest pip version of prompt_toolkit (on OS X 10.11.5, using standard apple terminal):

  • With mouse support enabled, the scroll wheel does not appear to scroll through history or do anything at all except when a menu is open.
  • none of alt, option, control or shift while scrolling send the mouse event back to the terminal.

It's a pity because otherwise the mouse support is super awesome! (It's pretty impressive that any of that can work in a terminal in the first place.)

@mangecoeur
Copy link

Ran into this issue on macOS 10.12 when using Xonsh ( xonsh/xonsh#1930 (comment) ). Is a solution possible (apart from turning off mouse supprt in ptk) ?

@jonathanslenders
Copy link
Member

@mangecoeur: Which terminal are you using? Some terminals handle scrolling if you press shift or alt.

@daisylb
Copy link

daisylb commented May 16, 2020

If you're using iTerm, you can tell it not to pass scroll events through to prompt_toolkit by unchecking this checkbox in your profile, under the Terminal tab:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants