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

prevent stuck scrollbar #2003

Merged
merged 4 commits into from
Mar 9, 2023
Merged

prevent stuck scrollbar #2003

merged 4 commits into from
Mar 9, 2023

Conversation

willmcgugan
Copy link
Collaborator

@willmcgugan willmcgugan commented Mar 9, 2023

Fixes the issue when you grab a scrollbar, move outside the terminal, and release the mouse button. The scrollbar would get attached to the mouse until you clicked the button again.

There was a previous attempt at this in #1968 but it didn't quite do the job.

and not event.button
and self._last_move_event is not None
):
buttons = list(dict.fromkeys(self._down_buttons).keys())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this the same as list(self._down_buttons)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, it will additionally unique-ify them. Wether that is strictly necessary, I'm not certain.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right. In that case, why not just buttons = set(self._down_buttons) and then iterate over the set?
Or do we need to preserve order?

It makes a bit more sense, it is probably faster, and doesn't require a comment explaining the hoops you are going over.
Otherwise, I think this warrants a comment.

Depending on what you reply to this comment, I don't mind PR'ing the change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is intended to preserve order. So that any button ups, arrive in the same order as they went down. Feel free to add a comment.

@willmcgugan willmcgugan merged commit f61a50b into main Mar 9, 2023
@willmcgugan willmcgugan deleted the scroll-outside-fix branch March 9, 2023 14:13
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

Successfully merging this pull request may close these issues.

2 participants