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

gpui: Prevent crash on macOS by adding characterIndexForPoint on GPUIView #23469

Closed

Conversation

LouisBrunner
Copy link

Partially resolves #22939

This PR adds the missing selector and makes it return NSNotFound, meaning the cursor is not within a character bounding box. This is not completely correct but it does prevent zed from crashing and doesn't cause any further bug apart from the input method selector disappearing very quickly.

A more thorough check would be to calculate if and where the user has clicked inside the editor and return the offset of the selected character. It seems like a deeper change which also requires ViewInputHandler to calculate Screen mouse position (x, y) to Editor (row, column) which was unclear to me.

For reference, this is the input method selector:
Screenshot 2025-01-22 at 16 14 52

Release Notes:

  • Fix a "unrecognized selector sent to instance" crash on macOS when using different input methods

Copy link

cla-bot bot commented Jan 22, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @LouisBrunner on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@LouisBrunner
Copy link
Author

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jan 22, 2025
Copy link

cla-bot bot commented Jan 22, 2025

The cla-bot has been summoned, and re-checked this pull request!

@maxdeviant maxdeviant changed the title fix(macos): prevent crash by adding characterIndexForPoint on GPUIView gpui: Prevent crash on macOS by adding characterIndexForPoint on GPUIView Jan 22, 2025
@mikayla-maki
Copy link
Contributor

I think I've changed my position on this PR since my previous comment, I'd prefer that we implemented this fully rather than marking it as a TODO :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

macOS crash: -[GPUIView characterIndexForPoint:]: unrecognized selector sent to instance
2 participants