Chord symbols deleted on paste

• Dec 14, 2019 - 21:25
Reported version
P1 - High
S3 - Major

Chord symbols are supposed to be preserved when pasting notes, but this is not happening anymore. I believe it probably broke with, despite an attempt to preserve them. To reproduce the issue:

1) enter four quarter notes into bar 1, chord symbols on each
2) enter four quarter notes into bar 2, no chord symbols
3) copy bar 2 to bar 1

Result: chord symbols are deleted

The intent is that the chord symbols are preserved, unless the source contains a chord symbol at the same place. If the source has a chord symbol in the same place, it is supposed to replace the chord symbol in the destination, but other chord symbols are supposed to remain in place. This was implemented for MuseScore 2 and as far I know worked correctly until recently.

I discovered this working on #297883: Multiple chord symbols attached to same note do not copy as part of range. The fix for that issue be to track which chords we just added, so we don't keep replacing them. This fix works, but in testing I realized that all destination chords were being deleted before we even get started. So actually, the code to replace chords individually isn't even needed right now, but it will be once the bug of deleting all chords is fixed.


I had a quick look at this issue and after a few changes, this is what I get now.
Original situation:
After copy-paste measure 1 into measure 2:
As you see, the first note keeps its Dm, the C7 on the second note is replaced by Bsus4. The third note had not chord ad won't get one. And the Em on the last note is just copied.
Is this what is expected?
I will do some other tests with hairpins, system and staff texts to see nothing else is broken.

Attachment Size
298541-after-paste.png 29.03 KB
298541-before-paste.png 30.24 KB

The full workaround in this case:
1) Copy a range
2) Deselect "Chord symbols" in selection filter
3) Paste a range

This would merge chord symbols from both locations.

Status PR created fixed

Fixed in branch master, commit 66099812d8

_fix #298541 - Chord symbols deleted on paste

Was partial fixed in Score::makeGap() by defining a filter for deleteAnnotationsFromRange()
and deleteSpannersFromRange(). However, a simiar filter was missing in Score::makeGap1()._

Fix version