Skip to content

Commit

Permalink
Fix #321227: Problems with removing empty trailing measures
Browse files Browse the repository at this point in the history
  • Loading branch information
Jojo-Schmitz authored and igorkorsukov committed Jul 28, 2021
1 parent 37cdda0 commit 8bf1381
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/engraving/libmscore/measure.cpp
Expand Up @@ -2915,7 +2915,6 @@ bool Measure::isEmpty(int staffIdx) const
{
int strack;
int etrack;
bool hasStaves = score()->staff(staffIdx)->part()->staves()->size() > 1;
if (staffIdx < 0) {
strack = 0;
etrack = score()->nstaves() * VOICES;
Expand All @@ -2930,6 +2929,7 @@ bool Measure::isEmpty(int staffIdx) const
return false;
}
// Check for cross-staff chords
bool hasStaves = score()->staff(track / VOICES)->part()->staves()->size() > 1;
if (hasStaves) {
if (strack >= VOICES) {
e = s->element(track - VOICES);
Expand All @@ -2946,6 +2946,9 @@ bool Measure::isEmpty(int staffIdx) const
}
}
for (Element* a : s->annotations()) {
if (a && staffIdx < 0) {
return false;
}
if (!a || a->systemFlag() || !a->visible() || a->isFermata()) {
continue;
}
Expand Down
4 changes: 3 additions & 1 deletion src/engraving/libmscore/score.cpp
Expand Up @@ -4436,7 +4436,9 @@ Measure* Score::firstTrailingMeasure(ChordRest** cr)

if (!cr) {
// No active selection: prepare first empty trailing measure of entire score
for (; m && m->isFullMeasureRest(); firstMeasure = m, m = m->prevMeasure()) {
while (m && m->isEmpty(-1)) {
firstMeasure = m;
m = m->prevMeasure();
}
} else {
// Active selection: select full measure rest of active staff's empty trailing measure
Expand Down

0 comments on commit 8bf1381

Please sign in to comment.