Implemented ensureCursorVisible