restore cursor to its previous place when cleaning up white spaces