gpui: Prevent crash on macOS by adding characterIndexForPoint on GPUIView #23469
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
Release Notes: