Fix #24742: Lost cursor style when moving to next syllable, verse, etc. #24792
+24
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves: #24742
The underlying problem here is that we're calling
TextCursor::set
when we really shouldn't. This method is used to set the cursor based on a point (set by the mouse) which we don't have when we're adding lyrics with the keyboard. This initially became a problem with #22209 (after this we callupdateCursorFormat
every timeset
is called), and the problem evolved with #23627 (changes to font metrics caused an early return inside set, leading to aresetFormatting
call).The first part of this fix is a change to
bindCursorPosToText
as this was spitting out garbage values whencursorPos
was null. After this we can check whetherstartMove
is null and avoid unwanted calls toTextCursor::set
.After making these changes everything is fine for syllables, melisma, etc. - but I discovered that verses were still broken. This is for an entirely different reason - these were broken in #23868 when some
setIsEven
calls were removed. The problem here is thatstyleDidChange
will evaluate to true inLyricsLayout::layout
due to a mismatch betweenisEven
and theTextStyleType
.