Attempt to fix undo types length mismatch by recording the type of undo at the
start of the drawing operation, instead of the end.