fixed _getCursorIndexForMousePosition