Offset-to-caret - Function Summary
Returns the offset in the face's text corresponding to the offset pair.
offset-to-caret face offset
face - The face containing the text. (must be: object)
offset - The XY offset relative to the face. (must be: pair)
This function is provided to convert from an X-Y offset within a text face to a character index within a string. It is mainly used for text editing and text mapping operations such as for colored or hyperlinked text.
Here is an interesting example. When you click your mouse on the upper text face, the string from that position forward will be shown in the lower text face.
When the top face is clicked, the event/offset contains the X-Y offset that is converted to a string index position with offset-to-caret. The string from that point forward is copied and displayed in the lower text box (bx).
Note that the string does not have to be displayed for this function to work. Also remember that when making changes to the contents of strings that are longer than 200 characters, you must set the text face line-list to NONE to force the recomputation of all line breaks.
caret-to-offset - Returns the offset position relative to the face of the character position.