Skip to content

Conversation

@Allanvtr
Copy link

Resolves: #30931

Summary

This patch fixes the issue where manually edited instrument change text did not persist when the short instrument name was later modified in the staff properties. Now the user-edited text is retained instead of being overwritten by the default instrument name.

What I changed

  • Added a flag (m_manualText) inside InstrumentChange to detect when the text is explicitly edited by the user

  • Updated the logic in setupInstrument() to avoid resetting the text if the user has manually edited it

  • Modified setProperty() so that when Pid::TEXT is changed, the text is marked as user-defined

  • 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)

@Allanvtr Allanvtr force-pushed the fix-instrumentchange-text-persistence branch from 310aadf to f28be6b Compare November 30, 2025 00:48
@cbjeukendrup
Copy link
Member

Thanks for the PR! Personally, I was actually thinking in a slightly different direction: perhaps setupInstrument should not be called when the "replace instrument" button has not been used. Instead, something more granular should be used, so that only those things that were actually changed are overwritten.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should not have been included

Comment on lines +70 to +79
void setCustomText(const String& s)
{
_customText = s;
_useCustomText = true;
m_manualText = true;
}

String customText() const { return _customText; }

bool hasCustomText() const { return _useCustomText; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although it won't be applicable anymore when you address #31276 (comment), note that setCustomText seems unused, so customText and hasCustomText don't seem very useful either

camiqueen162
camiqueen162 previously approved these changes Nov 30, 2025
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.

Changing short instrument name resets instrument change text

3 participants