Problem: Cursor visibility test may fail if the :sleep lasts too long. Solution: Wait for the TermLeave autocommand to finish. (cherry picked from commit b95e0a8d20)
b95e0a8d20