Add method setCursorPosition to TextEditor