Fix bug with pressing "enter" when cursor is in the middle of user's string