Skip to content

Commit c9ee447

Browse files
committed
Fix #174111: implode now works when voice 1 has only rests
1 parent 41b7bde commit c9ee447

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/engraving/editing/cmd.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4179,8 +4179,16 @@ bool Score::cmdImplode()
41794179
continue;
41804180
}
41814181
EngravingItem* dst = s->element(dstTrack);
4182-
if (dst && dst->isChord()) {
4183-
Chord* dstChord = toChord(dst);
4182+
// Fix #174111: find first chord across all voices, not just voice 1
4183+
Chord* dstChord = nullptr;
4184+
for (voice_idx_t i = 0; i < VOICES; ++i) {
4185+
EngravingItem* e = s->element(dstTrack + i);
4186+
if (e && e->isChord()) {
4187+
dstChord = toChord(e);
4188+
break;
4189+
}
4190+
}
4191+
if (dstChord) {
41844192
// see if we are tying in to this chord
41854193
Chord* tied = 0;
41864194
for (Note* n : dstChord->notes()) {
@@ -4227,14 +4235,12 @@ bool Score::cmdImplode()
42274235
}
42284236
}
42294237
}
4230-
// delete chordrest from source track if possible
4231-
if (src && src->voice()) {
4238+
// delete rest from source track if possible
4239+
if (src && src != dstChord && src->voice()) {
42324240
undoRemoveElement(src);
42334241
}
42344242
}
42354243
}
4236-
// TODO - use first voice that actually has a note and implode remaining voices on it?
4237-
// see https://musescore.org/en/node/174111
42384244
else if (dst) {
42394245
// destination track has something, but it isn't a chord
42404246
// remove rests from other voices if in "voice mode"

0 commit comments

Comments
 (0)