Fix #27279: Preserve accidental brackets when copying and pasting#32814
Open
shnCanos wants to merge 1 commit intomusescore:masterfrom
Open
Fix #27279: Preserve accidental brackets when copying and pasting#32814shnCanos wants to merge 1 commit intomusescore:masterfrom
shnCanos wants to merge 1 commit intomusescore:masterfrom
Conversation
…sting add optional bracket parameter to Score::changeAccidental update related Score::changeAccidental call add unit test "changeAccidentalWithBracket"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
add optional bracket parameter to Score::changeAccidental
update related Score::changeAccidental call
add unit test "changeAccidentalWithBracket"
Resolves: #27279
Cause of the bug
From what I could gather, an accidental is added to a note in two steps:
Score::changeAccidentalis called and changes the tpcNote::updateAccidentalis called, looks at the tpc, determines that an accidental is required and adds it accordinglySince the accidental is computed from the ground up,
Note::updateAccidental, doesn’t have enough information to determine whether or not it had brackets, leading to the bug.Fix
Simply force-add the accidental directly in the
Score::changeAccidentalwith the brackets.Notes
I added the brackets as an optional argument because the function was called in other places without a known bracket.
I only added the bracket argument in the call that lead to the bug.
I added a default argument so as to change as little code as possible, but simply adding std::nullopt to all the calls is also a choice.
I signed the CLA
The title of the PR describes the problem it addresses
Each commit's message describes its purpose and effects, and references the issue it resolves
If changes are extensive, there is a sequence of easily reviewable commits
The code in the PR follows the coding rules
There are no unnecessary changes
The code compiles and runs on my machine, preferably after each commit individually
I created a unit test or vtest to verify the changes I made (if applicable)