Skip to content

Fix #27279: Preserve accidental brackets when copying and pasting#32814

Open
shnCanos wants to merge 1 commit intomusescore:masterfrom
shnCanos:accidental-paste-no-brackets
Open

Fix #27279: Preserve accidental brackets when copying and pasting#32814
shnCanos wants to merge 1 commit intomusescore:masterfrom
shnCanos:accidental-paste-no-brackets

Conversation

@shnCanos
Copy link
Copy Markdown

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::changeAccidental is called and changes the tpc
  • Later, Note::updateAccidental is called, looks at the tpc, determines that an accidental is required and adds it accordingly

Since 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::changeAccidental with 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)

…sting

add optional bracket parameter to Score::changeAccidental

update related Score::changeAccidental call

add unit test "changeAccidentalWithBracket"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copying an accidental with brackets pastes without bracket

1 participant