Save/restore cursor position for removing $cursor$. related issue #162