Move cursor restoration into io.c.