Skip to content

Commit

Permalink
Don't add duplicate segs to the end of measure
Browse files Browse the repository at this point in the history
  • Loading branch information
miiizen committed Feb 28, 2025
1 parent 2c0b17f commit 5a12294
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/engraving/rendering/score/modifydom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ void ModifyDom::sortMeasureSegments(Measure* measure, LayoutContext& ctx)
}

std::vector<Segment*> segsToMoveToThisMeasure;
std::vector<Segment*> segsToRemove;
for (Segment& seg : nextMeasure->segments()) {
if (seg.tick() != nextMeasure->tick() || seg.isChordRestType()) {
continue;
Expand Down Expand Up @@ -361,10 +362,19 @@ void ModifyDom::sortMeasureSegments(Measure* measure, LayoutContext& ctx)
// Move key sigs and time sigs at the start of the next measure to the end of this measure
if ((seg.isTimeSigType() || seg.isKeySigType()) && !seg.header() && !seg.trailer()
&& sigsShouldBeInThisMeasure && changeAppliesToRepeatAndContinuation(seg)) {
if (measure->findSegmentR(seg.segmentType(), measure->ticks())) {
segsToRemove.push_back(&seg);
continue;
}
segsToMoveToThisMeasure.push_back(&seg);
}
}

for (Segment* seg : segsToRemove) {
// Don't add duplicate segs to the end of a measure
ctx.mutDom().doUndoRemoveElement(seg);
}

for (Segment* seg : segsToMoveToNextMeasure) {
seg->setRtick(Fraction(0, 1));
seg->setEndOfMeasureChange(false);
Expand Down

0 comments on commit 5a12294

Please sign in to comment.