Skip to content

Commit

Permalink
Fix GH#19483: Correct staff for editing instrument after instrumentCh…
Browse files Browse the repository at this point in the history
…ange

Backport of musescore#19566
  • Loading branch information
sammik authored and Jojo-Schmitz committed Sep 30, 2023
1 parent fef847e commit ac3843a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mscore/editstaff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ void EditStaff::apply()
score->undo(new ChangePart(part, new Instrument(*part->instrument()), newPartName)); //tick?
if (instrumentFieldChanged) {
Segment* s = score->tick2segment(_tickStart, true, SegmentType::ChordRest);
const std::vector<Element*> elist = s ? s->findAnnotations(ElementType::INSTRUMENT_CHANGE, part->startTrack(), part->endTrack()) : std::vector<Element*>();
const std::vector<Element*> elist = s ? s->findAnnotations(ElementType::INSTRUMENT_CHANGE, part->startTrack(), part->endTrack() - 1) : std::vector<Element*>();
if (elist.size())
for (Element* e : elist) // Change instrument in all Instrument Changes (for linked staves)
score->undo(new ChangeInstrument(toInstrumentChange(e), new Instrument(instrument)));
Expand Down

0 comments on commit ac3843a

Please sign in to comment.