-
Notifications
You must be signed in to change notification settings - Fork 814
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
Implement double/triple/quadruple click in TextArea #5405
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one thing for your consideration
@@ -1612,6 +1642,17 @@ async def _on_hide(self, event: events.Hide) -> None: | |||
"""Finalize the selection that has been made using the mouse when the widget is hidden.""" | |||
self._end_mouse_selection() | |||
|
|||
async def on_click(self, event: events.Click) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this shouldn't use modulus. It doesn't look like vscode wraps the click chain in this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Experimented with this. For now wrapping works better for us for reasons™.
Without the modulus here, when we get to chain == 5
and above, the selection goes back to being a cursor and it appears the click chaining stops working. I think the wrapping behaviour feels better than this, although I think the end-goal should be replicating VSCode's approach of doing nothing on the additional clicks and keeping the whole document selected, but that's just a bit tricky for now...
I think VSCode does chaining on the "mouse down" event. This would let us do a better implementation of this and remove a subtle flicker (between chain 2 and 3, the selection disappears briefly as we set the location in the mouse down handler, then the click handler fires later and selects the line). While we only have it on the click event, it's very difficult to replicate their behaviour exactly.
Note to self: Fix the behaviour when you click on whitespace.
Please review the following checklist.