Skip to content

Commit

Permalink
Don't skip gap rests when entering notes (GH#17931 & GH#21355)
Browse files Browse the repository at this point in the history
Backport of musescore#23911
  • Loading branch information
mathesoncalum authored and Jojo-Schmitz committed Aug 10, 2024
1 parent c34326c commit 117668f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
8 changes: 6 additions & 2 deletions libmscore/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2462,7 +2462,9 @@ Element* Score::move(const QString& cmd)
// find next chordrest, which might be a grace note
// this may override note input cursor
el = nextChordRest(cr);
while (el && el->isRest() && toRest(el)->isGap())

// Skip gap rests if we're not in note entry mode...
while (!noteEntryMode() && el && el->isRest() && toRest(el)->isGap())
el = nextChordRest(toChordRest(el));
if (el && noteEntryMode()) {
// do not use if not in original or new measure (don't skip measures)
Expand Down Expand Up @@ -2501,7 +2503,9 @@ Element* Score::move(const QString& cmd)
// find previous chordrest, which might be a grace note
// this may override note input cursor
el = prevChordRest(cr);
while (el && el->isRest() && toRest(el)->isGap())

// Skip gap rests if we're not in note entry mode...
while (!noteEntryMode() && el && el->isRest() && toRest(el)->isGap())
el = prevChordRest(toChordRest(el));
if (el && noteEntryMode()) {
// do not use if not in original or new measure (don't skip measures)
Expand Down
11 changes: 3 additions & 8 deletions libmscore/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,10 @@ Segment* InputState::nextInputPos() const
{
Measure* m = _segment->measure();
Segment* s = _segment->next1(SegmentType::ChordRest);
for (; s; s = s->next1(SegmentType::ChordRest)) {
if (s->element(_track)) {
if (s->element(_track)->isRest() && toRest(s->element(_track))->isGap())
m = s->measure();
else
return s;
}
else if (s->measure() != m)
while (s) {
if (s->element(_track) || s->measure() != m)
return s;
s = s->next1(SegmentType::ChordRest);
}
return 0;
}
Expand Down

0 comments on commit 117668f

Please sign in to comment.