EGOTextView
EGOTextView copied to clipboard
Handle non-zero frame origin and selection position onChange
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:
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.