Fixing movement of cursor and the text during resize

Fixing movement of cursor and the text during resize