Skip to content

Commit

Permalink
allow lyric entry to interrupt melisma
Browse files Browse the repository at this point in the history
  • Loading branch information
asattely committed May 17, 2023
1 parent ed6d488 commit 77fdb95
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/engraving/libmscore/lyrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ KerningType Lyrics::doComputeKerningType(const EngravingItem* nextItem) const
void Lyrics::removeInvalidSegments()
{
_removeInvalidSegments = false;
if (_separator && isMelisma() && _ticks <= _separator->startCR()->ticks()) {
if (_separator && isMelisma() && _ticks < _separator->startCR()->ticks()) {
setTicks(Fraction(0, 1));
_separator->setTicks(Fraction(0, 1));
_separator->removeUnmanaged();
Expand Down
20 changes: 20 additions & 0 deletions src/engraving/libmscore/textedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,26 @@ void TextBase::endEdit(EditData& ed)
} else {
triggerLayout();
}
if (isLyrics()) {
Lyrics* prev = prevLyrics(toLyrics(this));
if (prev) {
if (prev->tick() + prev->ticks() >= tick()) {
// the previous lyric has a spanner attached that goes through this one
// we need to shorten it
Segment* s = score()->tick2segment(tick());
if (s) {
s = s->prev1(SegmentType::ChordRest);
if (s->tick() > prev->tick()) {
prev->setTicks(s->tick() - prev->tick());
} else {
prev->setTicks(Fraction::fromTicks(1));
}
}
}
prev->setRemoveInvalidSegments();
prev->triggerLayout();
}
}

static const double w = 2.0;
score()->addRefresh(canvasBoundingRect().adjusted(-w, -w, w, w));
Expand Down

0 comments on commit 77fdb95

Please sign in to comment.