oid_caret_offset
oid_caret_offset ([oid])
This function returns the position of the cursor in characters from the specified oid, or oid_caret if oid is not supplied. This function is the same as oid_caret_pos except that it always returns a character offset. Each non-text object (that is, markup, equations, tables, graphics) counts as one character. oid_caret_pos will return -1 as a special case if the cursor is positioned before the end tag of the object, since this is more efficient than calculating the offset. The offset is sometimes needed, however, if characters or other objects are inserted after the cursor.
Related Topics