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

NSTextAttachment: make double click handling more robust #157

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

onflapp
Copy link
Contributor

@onflapp onflapp commented Sep 17, 2022

the existing implementation of doubleClickedOnCell will not be called because the click count is likely to more more than 2 by that point. I suspect it has to do with double click being interpreted as select word first.

I propose to change the condition to work after 2 or more clicks to make it more robust.

@fredkiefer
Copy link
Member

The change itself looks fine, could you please remove the unrelated change from the other merge request so that this could be merged?

@onflapp
Copy link
Contributor Author

onflapp commented Oct 16, 2022

The change itself looks fine, could you please remove the unrelated change from the other merge request so that this could be merged?

OK, done

@fredkiefer
Copy link
Member

In the meantime Riccardo set up another pull request #160 and claims that this might resolve your issues as well. I am unsure and your code looks fine to me. Could you please give his changes a try and report back?

@onflapp
Copy link
Contributor Author

onflapp commented Oct 19, 2022

In the meantime Riccardo set up another pull request #160 and claims that this might resolve your issues as well. I am unsure and your code looks fine to me. Could you please give his changes a try and report back?

No, my problem is still there. For example: TextEdit fork with support for attachments (https://github.com/onflapp/gs-textedit). The delegate will simply not be called because 2 clicks will select text instead.

Interestingly enough, Cocoa doesn't do that. Clicks on attachments are not handled as selection at all - I guess they are being tracked separately. But this might be very recent change because I do vaguely remember that attachments were handled as special characters in the past.

My suggesting would be to go ahead with this change as it has minimal impact on anything else and it fixes problem that would normally have to be fixed or worked around in the application code.

@rmottola
Copy link
Member

As far as I could test with clicks on cocoa regarding attachments and GNUmail, a single click is correct to invoke the delegate for the save action, multiple click make a select, since it is a character that can be selected, after all. On GNUstep we had an issue with attachment finding depending on the click position, I fixed that.

I am somehow unsure that a "multiple click" should be handled like a double-click, it would be like eating other clicks away.

@onflapp
Copy link
Contributor Author

onflapp commented Oct 25, 2022

I don't dispute that GNUmail is working correctly.
What doesn't work is "textView:doubleClickedOnCell:inRect:atIndex:"
https://developer.apple.com/documentation/appkit/nstextviewdelegate/1449333-textview?language=objc

The delegate is not called.

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

Successfully merging this pull request may close these issues.

3 participants