IDEA-115756 Caret is moved on the start of line after formatting, if positioned not on the end of line [CR-IC-2978]
(cherry picked from commit df823d6)