I’m trying to use
TextEditor::getTextIndexAt() to figure out which character has been clicked on. The index that is returned is rounded off to either side of the character, which is perfect for figuring out e.g. caret positioning, as the TextEditor does. In other words, clicking on the left side of a character gives index i, clicking on the right side of it gives ( + 1.
However, I’d expect a call to
TextEditor::getTextIndexAt() to give the actual character underneath the position I’ve clicked on, truncated as it were. Or preferably as a floating point instead of int position.
Now, I understand changing the interface of
getTextIndexAt() is going to destroy any backwards compatibility with old code, but is there a way to simulate/add the behaviour I need? The glyph and iterator internals of the
TextEditor class are hidden for users, unfortunately.