Some notes for anyone who wants to research further:
This resets the repaint flag, draws the cursor, and then jumps back to the mouse key loop. I think HL may be the old cursor position on return.