Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #24742: Lost cursor style when moving to next syllable, verse, etc. #24792

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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