Skip to content

Commit

Permalink
Merge pull request #24792 from mathesoncalum/24742-lost_cursor_style
Browse files Browse the repository at this point in the history
Fix #24742: Lost cursor style when moving to next syllable, verse, etc.
  • Loading branch information
RomanPudashkin committed Sep 18, 2024
2 parents 1f711ac + 0e79cb1 commit 65ac7a5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/engraving/dom/textedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ void TextBase::startEdit(EditData& ed)
if (!ldata || ldata->layoutInvalid) {
renderer()->layoutItem(this);
}
if (!ted->cursor()->set(ed.startMove)) {

//! NOTE: startMove will be null if we didn't use the mouse (e.g. we added a lyric with the spacebar)
if (!ed.startMove.isNull() && !ted->cursor()->set(ed.startMove)) {
resetFormatting();
}
double _spatium = spatium();
Expand Down
22 changes: 21 additions & 1 deletion src/notation/internal/notationinteraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ static qreal nudgeDistance(const mu::engraving::EditData& editData, qreal raster

static PointF bindCursorPosToText(const PointF& cursorPos, const EngravingItem* text)
{
if (!text || !text->isTextBase()) {
if (cursorPos.isNull() || !text || !text->isTextBase()) {
return PointF();
}

Expand Down Expand Up @@ -5020,7 +5020,11 @@ void NotationInteraction::navigateToLyrics(bool back, bool moveOnly, bool end)
nextLyrics->setTrack(track);
cr = toChordRest(nextSegment->element(track));
nextLyrics->setParent(cr);

nextLyrics->setNo(verse);
const mu::engraving::TextStyleType styleType(nextLyrics->isEven() ? TextStyleType::LYRICS_EVEN : TextStyleType::LYRICS_ODD);
nextLyrics->setTextStyleType(styleType);

nextLyrics->setPlacement(placement);
nextLyrics->setPropertyFlags(mu::engraving::Pid::PLACEMENT, pFlags);
nextLyrics->setSyllabic(mu::engraving::LyricsSyllabic::SINGLE);
Expand Down Expand Up @@ -5177,7 +5181,11 @@ void NotationInteraction::navigateToNextSyllable()
toLyrics = Factory::createLyrics(cr);
toLyrics->setTrack(track);
toLyrics->setParent(cr);

toLyrics->setNo(verse);
const mu::engraving::TextStyleType styleType(toLyrics->isEven() ? TextStyleType::LYRICS_EVEN : TextStyleType::LYRICS_ODD);
toLyrics->setTextStyleType(styleType);

toLyrics->setPlacement(placement);
toLyrics->setPropertyFlags(mu::engraving::Pid::PLACEMENT, pFlags);
toLyrics->setSyllabic(mu::engraving::LyricsSyllabic::END);
Expand Down Expand Up @@ -5259,7 +5267,11 @@ void NotationInteraction::navigateToLyricsVerse(MoveDirection direction)
lyrics = Factory::createLyrics(cr);
lyrics->setTrack(track);
lyrics->setParent(cr);

lyrics->setNo(verse);
const mu::engraving::TextStyleType styleType(lyrics->isEven() ? TextStyleType::LYRICS_EVEN : TextStyleType::LYRICS_ODD);
lyrics->setTextStyleType(styleType);

lyrics->setPlacement(placement);
lyrics->setPropertyFlags(mu::engraving::Pid::PLACEMENT, pFlags);
lyrics->setFontStyle(fStyle);
Expand Down Expand Up @@ -5824,7 +5836,11 @@ void NotationInteraction::addMelisma()
toLyrics = Factory::createLyrics(cr);
toLyrics->setTrack(track);
toLyrics->setParent(cr);

toLyrics->setNo(verse);
const mu::engraving::TextStyleType styleType(toLyrics->isEven() ? TextStyleType::LYRICS_EVEN : TextStyleType::LYRICS_ODD);
toLyrics->setTextStyleType(styleType);

toLyrics->setPlacement(placement);
toLyrics->setPropertyFlags(mu::engraving::Pid::PLACEMENT, pFlags);
toLyrics->setSyllabic(mu::engraving::LyricsSyllabic::SINGLE);
Expand Down Expand Up @@ -5885,7 +5901,11 @@ void NotationInteraction::addLyricsVerse()
lyrics->setParent(oldLyrics->chordRest());
lyrics->setPlacement(oldLyrics->placement());
lyrics->setPropertyFlags(mu::engraving::Pid::PLACEMENT, oldLyrics->propertyFlags(mu::engraving::Pid::PLACEMENT));

lyrics->setNo(newVerse);
const mu::engraving::TextStyleType styleType(lyrics->isEven() ? TextStyleType::LYRICS_EVEN : TextStyleType::LYRICS_ODD);
lyrics->setTextStyleType(styleType);

lyrics->setFontStyle(fStyle);
lyrics->setPropertyFlags(mu::engraving::Pid::FONT_STYLE, fFlags);

Expand Down

0 comments on commit 65ac7a5

Please sign in to comment.