Use the attached project to reproduce.
- Click the "Go To endPosition" button. The Caret remains on the same line.