Handle undo line after movement and swap saved line