Skip to content

Commit

Permalink
Fix GH#13243: Respect system fill threshold if measure is followed b…
Browse files Browse the repository at this point in the history
…y vertical frame

Backport of musescore#21455
  • Loading branch information
XiaoMigros authored and Jojo-Schmitz committed May 14, 2024
1 parent 66e6840 commit 4428042
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions libmscore/layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4218,8 +4218,30 @@ System* Score::collectSystem(LayoutContext& lc)
// don’t stretch last system of a section (or the last of the piece),
// if accumulated minWidth is <= lastSystemFillLimit
//
if ((lc.curMeasure == 0 || (lm && lm->sectionBreak()))
&& ((minWidth / systemWidth) <= styleD(Sid::lastSystemFillLimit))) {
bool shouldJustify = true;
if ((minWidth / systemWidth) <= styleD(Sid::lastSystemFillLimit)) {
shouldJustify = false;
const MeasureBase* lastMb = lc.curMeasure;

// For systems with a section break, don't justify
if (lm && lm->sectionBreak())
lastMb = nullptr;

// Justify if system is followed by a measure or HBox
while (lastMb) {
if (lastMb->isMeasure() || lastMb->isHBox()) {
shouldJustify = true;
break;
}
// Frames can contain section breaks too, account for that here
if (lastMb->sectionBreak()) {
shouldJustify = false;
break;
}
lastMb = lastMb->nextMeasure();
}
}
if (shouldJustify && !MScore::noHorizontalStretch) { // debug feature
if (minWidth > rest)
rest = rest * .5;
else
Expand Down

0 comments on commit 4428042

Please sign in to comment.