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

Double/triple click does not take position into account #1093

Closed
bndbsh opened this issue Oct 25, 2018 · 9 comments
Closed

Double/triple click does not take position into account #1093

bndbsh opened this issue Oct 25, 2018 · 9 comments

Comments

@bndbsh
Copy link

bndbsh commented Oct 25, 2018

The double/triple click to select word/line feature does not take position into account. For example:

line A
line B
line C

If you click on line on each line in quick succession in kitty, you will select line on B and then all of line C.

The expected behavior (e.g. as standard in other terminals, browsers) is that you would have to double/triple click without moving the cursor for the selection to work.

@martinetd
Copy link
Contributor

I had noticed this, it's not part of what I intended to fix with the rework.
If the solution is just "click again without changing cells" it's not too difficult, but I've actually come to appreciate this a bit and would like it to work as long as the next click is still within the selection (e.g. second click would work if in same cell, and the third click would work as long as it is inside 'line' in the second click) -- that's more work and would be better after I'm done. . . on which note I'm really sorry for the delay, should get back to it around next week ish; I stumbled on some issues and have been delaying doing a proper fix but I should just get on with it.

I guess we can do the easy way in mouse.c now and the rest later if it's annoying folks, up to others.

@kovidgoyal
Copy link
Owner

I certainly would not expect double/triple clicking to work without moving the cursor at all. That would be very painful since the cursor can often move accidentally while clicking, expecially with touchpads or sensitive mice.

What actual problem does this behavior cause? If you move the mouse on multiple lines while double clicking, the worst thing that happens is you get a wrong selection. In other terminals you get no selection. In either case you have to go back and fix the selection.

@martinetd
Copy link
Contributor

I can agree it's annoying when you don't expect it to, e.g. click once on the wrong line by mistake, move up a line then click twice to get a word and you didn't get what you expected to.

"Not moving at all" could very easily be same cell with the current code, I'd think that's fine even with sensitive touchpads/mice ?
I was talking of 'within selection' earlier, technically what I would consider ideal is "within where the selection would be extended with one more click", so within word on 2nd click or line on 3rd click, but I don't think that's worth the hassle of computing where selection would end up and discard the result if cursor was too far...

@kovidgoyal
Copy link
Owner

Unless you click by mistake and then click twice again very fast, that should not be happening, since sequenced clicks are discarded if there is too long of an interval between them.

I dont know if same cell would be enough, what if the click starts out at the edge of the cell instead of the middle? Seems more sensible to define a "radius" of sensitivity instead. Simply store the x and y values in addition to the cell values.

@martinetd
Copy link
Contributor

Happened to me a couple of times in the past few months with my very crappy touchpad, so it can happen :)

And sure, radius would probably be more reliable. Does the mouse code know how tall a line is for example? line height would be a good diameter maybe?

@kovidgoyal
Copy link
Owner

The mouse code has access to OSWindow which has fonts_data which has cell width and cell height. I'd probably choose some multiple of cell height, maybe 1.5 or similar. Hard to say without trying out a few numbers.

@michaelkix
Copy link

Just adding here - I'm a new kitty user/fan but have run into this issue several times.

An example of when this might happen: I double click to select a word but miss. Then I reposition the cursor and double click again, but I get triple click behavior instead.

I support the sensitivity radius idea and think it can be configurable (because why not). Something like double_click_threshold or multi_click_threshold.

@maximbaz
Copy link
Contributor

maximbaz commented Nov 5, 2018

Agree, here's a demo of extreme case (double click, move cursor, single click):

kitty-selection2

And this is quite a realistic scenario that was already mentioned above (double click, notice wrong word is selected, reposition cursor, another double click):

kitty-selection-3

Not sure if the radius here is the actual issue, or simply the waiting interval for the third click being too large.

@kovidgoyal
Copy link
Owner

Feel free to adjust the wait interval to whatever you like, it is in
kitty.conf IIrC called click_interval

zchee pushed a commit to zchee/kitty that referenced this issue Nov 25, 2018
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

5 participants