Jump to last cursor position unless it's invalid or in an event handler