ide/CodeEditor: Fixed mislocated caret when resetting caret position outside of range