fix #51866: enharmonic changes made with J lost on save #1914
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.
My change does two things:
For the "J" command (but not "Ctrl+J", which remains otherwise identical to "J"), the spelling change made is transposed as appropriate and push to the "other" tpc, so the tpc'1 stay in sync when using "J". If you want to have different spellings for concert pitch and transposed mode, you will need "Ctrl+J".
I reverted the change to only write tpc2 for transposing instruments. That was the cause of this bug. I do understand the reasons that change was made but feel it caused worse problems than it fixed. However, if we did want to somehow force concert pitch instruments to always have the same tpc for both modes, I would propose a different fix. First, for concert pitch instruments only, change my code above to do the same thing for "Ctrl+J" that it currently does only for "J", so you cannot force tpc1 and tpc2 to be out of sync that way. Second, rather than always writing tpc1 and ignoring tpc2 for concert pitch instruments, instead, write the current tpc value for concert pitch instruments. Not sure if code elsewhere expects tpc1 to always be written; if so, then copy tpc2 to tpc1 before writing if we are not in concert pitch mode and it is a concert pitch instrument.