public long getCaretPos()
    {
        if (caretStickToStart)
            return startPosition;
        else
            return endPosition;
    }
Get caret position in file, which can be out of view

@return the current caret position
plugins/org.jkiss.dbeaver.ui.editors.hex/src/org/jkiss/dbeaver/ui/editors/binary/HexEditControl.java