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

Mac OS X: Mouse Scrolling triggers command history instead of scrolling the window #517

Closed
dwt opened this Issue Apr 2, 2015 · 27 comments

Comments

Projects
None yet
@dwt

dwt commented Apr 2, 2015

Hi there,

I have to say that this is a bit annoying, as bpython (the shell variant) is one of the very few applications that redefine scroll wheel events in this way.

I am quite sure that this is a setting that can be changed - but the point of this bug report is that the default for that setting should really be to let the scroll wheel, well, scroll the window.

Instead what happens is that I scroll through the history of the commands I have invoked previously. True, that can also be interesting, but I am already perfectly capable of doing that with the up down arrows on my keyboard, which I need to use anyway when I want to execute commands.

So please change the default for the scroll wheel to actually scrolling the window.

@thomasballinger

This comment has been minimized.

Show comment
Hide comment
@thomasballinger

thomasballinger Apr 2, 2015

Member

I can't replicate this - what terminal are you using? Is this inside of a terminal multiplexer like screen or tmux perhaps? When you say "the shell variant", which executable are you using, and which version of bpython?

Member

thomasballinger commented Apr 2, 2015

I can't replicate this - what terminal are you using? Is this inside of a terminal multiplexer like screen or tmux perhaps? When you say "the shell variant", which executable are you using, and which version of bpython?

@dwt

This comment has been minimized.

Show comment
Hide comment
@dwt

dwt Apr 2, 2015

Sorry, for more detail: This is the standard terminal on os X, no terminal multiplexer, zsh, bpython (without extra arguments).

$ bpython --version
bpython version 0.13.2 on top of Python 2.7.6

Do you need more information?

dwt commented Apr 2, 2015

Sorry, for more detail: This is the standard terminal on os X, no terminal multiplexer, zsh, bpython (without extra arguments).

$ bpython --version
bpython version 0.13.2 on top of Python 2.7.6

Do you need more information?

@dwt

This comment has been minimized.

Show comment
Hide comment
@dwt

dwt Apr 4, 2015

I've created a short movie to see the issue in action, as it seems I can't upload it to github, I uploaded it to youtube https://www.youtube.com/watch?v=IHo-UVa8k8k

dwt commented Apr 4, 2015

I've created a short movie to see the issue in action, as it seems I can't upload it to github, I uploaded it to youtube https://www.youtube.com/watch?v=IHo-UVa8k8k

@thomasballinger

This comment has been minimized.

Show comment
Hide comment
@thomasballinger

thomasballinger Apr 4, 2015

Member

The video seems to be private, I can't view it.

Member

thomasballinger commented Apr 4, 2015

The video seems to be private, I can't view it.

@dwt

This comment has been minimized.

Show comment
Hide comment
@dwt

dwt Apr 7, 2015

Sorry, it seems I upload too rarely. It should now be visible. :)

dwt commented Apr 7, 2015

Sorry, it seems I upload too rarely. It should now be visible. :)

@thomasballinger

This comment has been minimized.

Show comment
Hide comment
@thomasballinger

thomasballinger Apr 15, 2015

Member

I finally located a mouse, but I still can't replicate this - the scroll wheel seems to scroll into the scrollback buffer in Terminal.app for me. Does the scroll wheel work for you when you use the terminal for other things? Is it possible you have something special set up make the scroll wheel work in vim or similar?

Member

thomasballinger commented Apr 15, 2015

I finally located a mouse, but I still can't replicate this - the scroll wheel seems to scroll into the scrollback buffer in Terminal.app for me. Does the scroll wheel work for you when you use the terminal for other things? Is it possible you have something special set up make the scroll wheel work in vim or similar?

@dwt

This comment has been minimized.

Show comment
Hide comment
@dwt

dwt Apr 16, 2015

I still can't replicate this, the scroll wheel seems to scroll into the scrollback buffer in Terminal.app for me. Does the scroll wheel work for you when you use the terminal for other things? Is it possible you have something special set up make the scroll wheel work in vim or similar?

I may have in LESS - but other than that my setup is normal - and outside of bpython scrolling works normally. Do you have any Idea what kind of setting could influence this or how the libraries you use for input are configured?

I would be fine to add some logging to the code to figure out what kind of input signal it receives if you can give me a pointer where to look in the code.

Best Regards,
Martin

dwt commented Apr 16, 2015

I still can't replicate this, the scroll wheel seems to scroll into the scrollback buffer in Terminal.app for me. Does the scroll wheel work for you when you use the terminal for other things? Is it possible you have something special set up make the scroll wheel work in vim or similar?

I may have in LESS - but other than that my setup is normal - and outside of bpython scrolling works normally. Do you have any Idea what kind of setting could influence this or how the libraries you use for input are configured?

I would be fine to add some logging to the code to figure out what kind of input signal it receives if you can give me a pointer where to look in the code.

Best Regards,
Martin

@adamzap

This comment has been minimized.

Show comment
Hide comment
@adamzap

adamzap Apr 16, 2015

@dwt I think the issue is with your Terminal.app settings, this one in particular:

The default is the behavior that you desire, and you can hold Shift to temporarily test the opposite behavior.

I hope you don't mind me jumping in on this issue, @thomasballinger

adamzap commented Apr 16, 2015

@dwt I think the issue is with your Terminal.app settings, this one in particular:

The default is the behavior that you desire, and you can hold Shift to temporarily test the opposite behavior.

I hope you don't mind me jumping in on this issue, @thomasballinger

@thomasballinger

This comment has been minimized.

Show comment
Hide comment
@thomasballinger

thomasballinger Apr 16, 2015

Member

Not at all, thanks @adamzap!

If this is indeed the case @dwt, then there's nothing I'd want to change - we probably can't tell the different between up arrow and the character the scroll wheel sends. I can't tell what bytes it sends because my terminal.app doesn't have this option - try running the program below and using your scroll wheel a bit during the blank screen, then hitting enter:

tput smcup; tmp=$(python -c 'import sys; print repr(sys.stdin.read(20))'); tput rmcup; echo $tmp

I'm guessing that the bytes displayed will be the same as using the arrow keys, so we won't be able to differentiate - but if they're different it's possible we could. All we could do in bpython though would be to trigger the pager or ignore them.

Therefore I'd further suggest that you update bpython - in the old version you're using you may be disappointed with scrolling behavior even if this were fixed, but in the new bpython scrolling works great! (and it doesn't use the alternate screen, so this won't be an issue)

Member

thomasballinger commented Apr 16, 2015

Not at all, thanks @adamzap!

If this is indeed the case @dwt, then there's nothing I'd want to change - we probably can't tell the different between up arrow and the character the scroll wheel sends. I can't tell what bytes it sends because my terminal.app doesn't have this option - try running the program below and using your scroll wheel a bit during the blank screen, then hitting enter:

tput smcup; tmp=$(python -c 'import sys; print repr(sys.stdin.read(20))'); tput rmcup; echo $tmp

I'm guessing that the bytes displayed will be the same as using the arrow keys, so we won't be able to differentiate - but if they're different it's possible we could. All we could do in bpython though would be to trigger the pager or ignore them.

Therefore I'd further suggest that you update bpython - in the old version you're using you may be disappointed with scrolling behavior even if this were fixed, but in the new bpython scrolling works great! (and it doesn't use the alternate screen, so this won't be an issue)

@thomasballinger

This comment has been minimized.

Show comment
Hide comment
@thomasballinger

thomasballinger Apr 26, 2015

Member

I'm going to assume @adamzap was correct and there's nothing to change here.

Member

thomasballinger commented Apr 26, 2015

I'm going to assume @adamzap was correct and there's nothing to change here.

@dwt

This comment has been minimized.

Show comment
Hide comment
@dwt

dwt Aug 17, 2015

yes, the new version does fix the behaviour for me. Many thanks!

dwt commented Aug 17, 2015

yes, the new version does fix the behaviour for me. Many thanks!

@gpinnaan

This comment has been minimized.

Show comment
Hide comment
@gpinnaan

gpinnaan Mar 17, 2016

At least in El Capitan and probably also in Yosemite you can move from scrolling the history to scrolling the window with cmd R

gpinnaan commented Mar 17, 2016

At least in El Capitan and probably also in Yosemite you can move from scrolling the history to scrolling the window with cmd R

@ayatollah

This comment has been minimized.

Show comment
Hide comment
@ayatollah

ayatollah Sep 15, 2016

Sorry for waking up an old thread.
I have the same problem as @dwt. However, I've found out that this only occures after I've been using ssh and timed out from the session, and only for that specifical window. If I open up a new windows, it works ok.

ayatollah commented Sep 15, 2016

Sorry for waking up an old thread.
I have the same problem as @dwt. However, I've found out that this only occures after I've been using ssh and timed out from the session, and only for that specifical window. If I open up a new windows, it works ok.

@lmichael107

This comment has been minimized.

Show comment
Hide comment
@lmichael107

lmichael107 Oct 5, 2016

I never changed my settings, and just noticed this issue today after many months of expected behavior (scrolling terminal output rather than through command history). So, at some point, my settings were changed (to select the "Scroll alternate screen" box).

lmichael107 commented Oct 5, 2016

I never changed my settings, and just noticed this issue today after many months of expected behavior (scrolling terminal output rather than through command history). So, at some point, my settings were changed (to select the "Scroll alternate screen" box).

@Kornel

This comment has been minimized.

Show comment
Hide comment
@Kornel

Kornel Oct 21, 2016

@ayatollah Exactly this! I've just had that issue. A ssh session (with a screen running if that matters) terminated on my machine and there I was - scrolling through commands instead of the buffer :)

Kornel commented Oct 21, 2016

@ayatollah Exactly this! I've just had that issue. A ssh session (with a screen running if that matters) terminated on my machine and there I was - scrolling through commands instead of the buffer :)

@dvmorris

This comment has been minimized.

Show comment
Hide comment
@dvmorris

dvmorris Oct 28, 2016

I have been experiencing the same issues with iTerm, but it does not seem to be related to bpython. Has anyone found a resolution? It doesn't happen all the time, and the only way I can get rid of the issue is by quitting iTerm and re-launching.

dvmorris commented Oct 28, 2016

I have been experiencing the same issues with iTerm, but it does not seem to be related to bpython. Has anyone found a resolution? It doesn't happen all the time, and the only way I can get rid of the issue is by quitting iTerm and re-launching.

@danieljamesscott

This comment has been minimized.

Show comment
Hide comment
@danieljamesscott

danieljamesscott Nov 1, 2016

I'm having the same issue - ssh session timeout means that scrolling the window cycles the command history instead of scrolling the window

danieljamesscott commented Nov 1, 2016

I'm having the same issue - ssh session timeout means that scrolling the window cycles the command history instead of scrolling the window

@shabadoo75

This comment has been minimized.

Show comment
Hide comment
@shabadoo75

shabadoo75 Nov 15, 2016

This happens to me every now and then and I've not been able to track down the cause. As happened to @Kornel I did have an ssh session terminate on me immediately before it happend this time

shabadoo75 commented Nov 15, 2016

This happens to me every now and then and I've not been able to track down the cause. As happened to @Kornel I did have an ssh session terminate on me immediately before it happend this time

@1superk1

This comment has been minimized.

Show comment
Hide comment
@1superk1

1superk1 Dec 15, 2016

Typing reset at the command prompt solves the issue....

1superk1 commented Dec 15, 2016

Typing reset at the command prompt solves the issue....

@thomasballinger

This comment has been minimized.

Show comment
Hide comment
@thomasballinger

thomasballinger Dec 15, 2016

Member

If anyone can replicate this issue (in bpython, although replicating with a disconnected ssh session could be useful background) I'd love to take a look. If this is fixable with reset then it's some terminal control sequence that bpython is emitting that it shouldn't be.

Let me know what OS, which terminal emulator, and how you can get it to occur.

Alternatively, if we knew what control sequence causes this behavior I could look for that in the code and prevent it. However it's hard to be confident in changes we can't test.

Member

thomasballinger commented Dec 15, 2016

If anyone can replicate this issue (in bpython, although replicating with a disconnected ssh session could be useful background) I'd love to take a look. If this is fixable with reset then it's some terminal control sequence that bpython is emitting that it shouldn't be.

Let me know what OS, which terminal emulator, and how you can get it to occur.

Alternatively, if we knew what control sequence causes this behavior I could look for that in the code and prevent it. However it's hard to be confident in changes we can't test.

@1superk1

This comment has been minimized.

Show comment
Hide comment
@1superk1

1superk1 Dec 15, 2016

1superk1 commented Dec 15, 2016

@thomasballinger

This comment has been minimized.

Show comment
Hide comment
@thomasballinger

thomasballinger Dec 15, 2016

Member

So long as a disconnected ssh session is the only cause of this, then I agree it has nothing to do with bpython. While bpython doesn't use readline, it does spit out all kinds of terminal control sequences and tinker with termios/ioctl settings, which are the things that reset resets, hence my concern about it. If anyone is ever able to replicate causing this problem with bpython I'd be interested to hear.

But since is sounds like this is just a terminal thing unrelated to bpython, I'll keep the issue closed but you're welcome to keep discussing here :)

Member

thomasballinger commented Dec 15, 2016

So long as a disconnected ssh session is the only cause of this, then I agree it has nothing to do with bpython. While bpython doesn't use readline, it does spit out all kinds of terminal control sequences and tinker with termios/ioctl settings, which are the things that reset resets, hence my concern about it. If anyone is ever able to replicate causing this problem with bpython I'd be interested to hear.

But since is sounds like this is just a terminal thing unrelated to bpython, I'll keep the issue closed but you're welcome to keep discussing here :)

@dhoffi

This comment has been minimized.

Show comment
Hide comment
@dhoffi

dhoffi commented Jul 12, 2017

image

@dlamblin

This comment has been minimized.

Show comment
Hide comment
@dlamblin

dlamblin Jul 19, 2017

@dhoffi Is that the MacOS Terminal preferences? How did you get all these options instead of General, Profiles, Window Groups, and Encodings?

Anyway, I replicate this by using ssh, then using less on a file with more lines that the window height, then close the ssh connection (timeout, network issue, or just enter ~.)
It's also possible to just use less locally on a file you can scroll, and then terminate it with SIGKILL/-9 from another shell.
From that point you can use the touchpad scroll to go through the history only.
Less must have setup the alternate screen and scrolling of it.
Command-R will switch you back to the other scrolling, but so will issuing the command reset

It would not be such an annoying problem to encounter if the GUI had any other way to bring up the scroll bar so it could be clicked on other than to start scrolling (which it won't do when it's scrolling the history instead). Suddenly you have to know something specific about the terminal app, E.G. to use command-R, to scroll by page with shift-pgup or to reset the terminal state.

dlamblin commented Jul 19, 2017

@dhoffi Is that the MacOS Terminal preferences? How did you get all these options instead of General, Profiles, Window Groups, and Encodings?

Anyway, I replicate this by using ssh, then using less on a file with more lines that the window height, then close the ssh connection (timeout, network issue, or just enter ~.)
It's also possible to just use less locally on a file you can scroll, and then terminate it with SIGKILL/-9 from another shell.
From that point you can use the touchpad scroll to go through the history only.
Less must have setup the alternate screen and scrolling of it.
Command-R will switch you back to the other scrolling, but so will issuing the command reset

It would not be such an annoying problem to encounter if the GUI had any other way to bring up the scroll bar so it could be clicked on other than to start scrolling (which it won't do when it's scrolling the history instead). Suddenly you have to know something specific about the terminal app, E.G. to use command-R, to scroll by page with shift-pgup or to reset the terminal state.

@Horsty

This comment has been minimized.

Show comment
Hide comment
@Horsty

Horsty Jan 18, 2018

@dlamblin You can see this screen if you go to preferences in iTerm. Not in the normal terminal.

Horsty commented Jan 18, 2018

@dlamblin You can see this screen if you go to preferences in iTerm. Not in the normal terminal.

@caruccio

This comment has been minimized.

Show comment
Hide comment
@caruccio

caruccio Jun 9, 2018

CMD+, -> Advanced -> Search scroll

Thanks A LOT @dhoffi

caruccio commented Jun 9, 2018

CMD+, -> Advanced -> Search scroll

Thanks A LOT @dhoffi

@Manojkumar18

This comment has been minimized.

Show comment
Hide comment
@Manojkumar18

Manojkumar18 Aug 24, 2018

I use Linux for the same problem too I fix it,

scrolling

click enable -> Scroll on Output.

Manojkumar18 commented Aug 24, 2018

I use Linux for the same problem too I fix it,

scrolling

click enable -> Scroll on Output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment