IDEA-79312 text cursor gets lost
(cherry picked from commit 310e294ba2b059e7f36f378a4bf2a8f45de40370)