fix #18693 : Cut-n-paste of a measure containing a slur causes a crash

Added support for finding the nth grace note (or grace level as defined by getGraceSegment). Using this to test for grace notes in undo.cpp. This fixes the bug. The bug is not really related to cut and paste but the two grace notes in the beginning. findSegment() will always find the first grace note in a series of grace notes because of the tick of grace notes. Therefore we need an explicit check for grace notes.

This pull request only fixes the slur problem with several grace notes, but e.g. tie has the same problem, so I will fix that also if this is the right way to go.