Keep correct cursor pos when resizing. Fixes #2018.
Merge pull request #2331 from matham/cursor

Keep correct cursor pos when resizing. Fixes #2018.