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

Handle non-zero frame origin and selection position onChange #20

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

Conversation

relevante
Copy link

In my application the EGOTextView is offset from the left edge of the screen. This was causing alignment issues with the magnifier, which I've fixed here. I tested this in the demo application by creating the EGOTextView with a frame with origin.x and origin.y set to positive non-zero values.

Before:
EGOTextView-weathermob-before

After:
EGOTextView-weathermob-after

In addition, when the text field was edited, the selection information (_selectedRange) was being updated after the attributedString was set. This caused the selection position as monitored in the delegate -egoTextViewDidChange: method to always lag by one character. In -insertText: and -deleteBackward I'm not calling the two steps from -setSelectionRange separately, as the range needs to be set before -setAttributedString: calls the delegate function, but -selectionChanged needs to be called after the string is set. Maybe not the most elegant solution, but it works.

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

Successfully merging this pull request may close these issues.

1 participant