fix #297883: multiple chord symbols not copied #5531
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves: https://musescore.org/en/node/297883
We have code to replaced existing chord symbols in the destination
when copying and pasting.
Unfortunately, if there are multiple chord symbols to paste on a tick,
that same code causes each chord symbol to replace the one just pasted.
End result is only the last chord symbol is preserved.
This change uses a container pastedHarmony to track the chords symbols
as we paste them, so we can check and not delete them later.
I have an mtest that is not yet committed, because although my code here fixes this issue, my testing exposed another issue with copy/paste of chord symbols, https://musescore.org/en/node/298541. I would like to see a fix for that in place, and then a test put in place for both cases.
To be clear:
The expected behavior is that pasting chord symbols replaces any chord symbols already present at those ticks, but preserves any other existing chord symbols in the destination. This current PR has to do with the replacing behavior - we have for years not handled this right when there are multiple chord symbols at a tick, But the other issue is a recent regression - the chord symbols that are not being replaced are being deleted instead of being preserved.