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 wheel events during click-drag misdelivered as button events #574

Closed
p-ouellette opened this issue Oct 18, 2022 · 4 comments
Closed

Comments

@p-ouellette
Copy link

To reproduce, run the mouse demo, click and drag to start drawing a box, then scroll up or down.
Also, in the micro editor you can't start a selection with click-drag, them scroll with the mouse wheel (you can in vim).

The problem is here:

tcell/tscreen.go

Lines 1247 to 1251 in ede1dd5

if !t.wasbtn {
button = WheelUp
} else {
button = Button1
}

The wasbtn check seems to be there to work around some terminal bug, but I don't know why. If I remove the check and always report a wheel event the mouse demo and scrolling in micro work as expected.

This can also result in wheel events not during a click-drag being reported as button presses if the tcell application spawns another application on a click event. The child app gets the mouse release event and wasbtn never gets reset.

@gdamore
Copy link
Owner

gdamore commented Oct 19, 2022

Let me think on this -- I am pretty sure that I was seeing drag events that would get misreported. But maybe I've missed something.

@gdamore
Copy link
Owner

gdamore commented Oct 19, 2022

Essentially, I figured that it was not reasonable to scroll while doing drag events - because I was treating the wheel like any other button. That's clearly wrong.

@gdamore
Copy link
Owner

gdamore commented Oct 19, 2022

So I think I must have been confused by the fact that the middle button my mouse (and probably most mice) is also the wheel. The test was wrong, and I'll remove it.

@p-ouellette
Copy link
Author

Thanks! The comment above the switch statement could probably be updated too.

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

2 participants