fix #19897 and others

fix #19897
I tried to fix a series of problems related to the repeat measure sign (%):
-1- the one explained in http://musescore.org/en/node/19897
-2- the fact that by selecting a repeat measure sign alone (not the whole measure as in point -1-) and deleting creates a corrupted empty measure
-3- the fact that trying to add a fermata to a repeat measure sign results into a crash.
For point -3-, in particular, the code I added to rest.cpp prevents a priori the possibility of adding a fermata onto a repeat measure sign.