Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #272403: Corruption on pasting a range with a truncated note that requires a tie #3688

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions libmscore/paste.cpp
Expand Up @@ -34,6 +34,7 @@
#include "tremolo.h"
#include "slur.h"
#include "articulation.h"
#include "sig.h"

namespace Ms {

Expand Down Expand Up @@ -530,7 +531,7 @@ void Score::pasteChordRest(ChordRest* cr, int tick, const Interval& srcTranspose
// we have already disallowed a tuplet from crossing the barline, so there is no problem here
// but due to rounding, it might appear from actualTicks() that the last note is too long by a couple of ticks

if (!isGrace && !cr->tuplet() && (tick + cr->actualTicks() > measureEnd || convertMeasureRest)) {
if (!isGrace && !cr->tuplet() && (tick + cr->actualTicks() > measureEnd || (cr->durationTypeTicks() != cr->actualTicks()) || convertMeasureRest)) {
if (cr->isChord()) {
// split Chord
Chord* c = toChord(cr);
Expand All @@ -543,7 +544,7 @@ void Score::pasteChordRest(ChordRest* cr, int tick, const Interval& srcTranspose
c2->removeMarkings(true);
int mlen = measure->tick() + measure->ticks() - tick;
int len = mlen > rest ? rest : mlen;
std::vector<TDuration> dl = toDurationList(Fraction::fromTicks(len), true);
std::vector<TDuration> dl = toRhythmicDurationList(Fraction::fromTicks(len), false, tick - measure->tick(), sigmap()->timesig(tick).nominal(), measure, MAX_DOTS);
TDuration d = dl[0];
c2->setDurationType(d);
c2->setDuration(d.fraction());
Expand Down Expand Up @@ -583,7 +584,7 @@ void Score::pasteChordRest(ChordRest* cr, int tick, const Interval& srcTranspose
measure = tick2measure(tick);
Fraction mlen = Fraction::fromTicks(measure->tick() + measure->ticks() - tick);
Fraction len = rest > mlen ? mlen : rest;
std::vector<TDuration> dl = toDurationList(len, false);
std::vector<TDuration> dl = toRhythmicDurationList(len, true, tick - measure->tick(), sigmap()->timesig(tick).nominal(), measure, MAX_DOTS);
TDuration d = dl[0];
r2->setDuration(d.fraction());
r2->setDurationType(d);
Expand Down
4 changes: 2 additions & 2 deletions mtest/libmscore/copypaste/copypaste17-ref.mscx
Expand Up @@ -165,10 +165,10 @@
<durationType>eighth</durationType>
</Rest>
<Rest>
<durationType>quarter</durationType>
<durationType>eighth</durationType>
</Rest>
<Rest>
<durationType>eighth</durationType>
<durationType>quarter</durationType>
</Rest>
</voice>
</Measure>
Expand Down
4 changes: 1 addition & 3 deletions mtest/libmscore/copypaste/copypaste20-ref.mscx
Expand Up @@ -150,11 +150,9 @@
<durationType>16th</durationType>
</Rest>
<Rest>
<dots>1</dots>
<durationType>eighth</durationType>
</Rest>
<Rest>
<durationType>16th</durationType>
</Rest>
</voice>
<voice>
<Chord>
Expand Down