cover case where caret position disappears due to cutting.
jsbeautified