Ensure that caret is in viewport after editing