Element offset does not resume responding to style changes after reset from manual adjustment

• Dec 28, 2020 - 17:59
Reported version
3.5
Type
Functional
Frequency
Once
Severity
S3 - Major
Reproducibility
Always
Status
closed
Regression
No
Workaround
No
Project

This seems to have been broken ever since the original 3.0 release, but the problematic code is perhaps hit more often now with some of the recent changes to drag behavior. Here is how to reproduce it in any 3.x version:

1) add fermata to rest in measure 1 of empty score
2) double-click to put in edit mode
3) nudge with arrow keys any amount/direction
4) Esc to leave Edit mode
5) Ctrl+R to reset
6) Format / Style / Fermata
7) change offset

Result: nothing happens. The fermata has been reset to its original offset, but it is now marked NOSTYLE and will no longer respond to changes to the style value. Deleting it and re-adding it will cause it to start responding normally again.

The problem is in Element::endEditDrag(), where we set the new offset with undoChangeProperty() but don't pass in anything as the flags parameter, which causes it to be set to NOSTYLE. Whereas the corresponding code in Element::endDrag() does. So, dragging directly instead of double-clicking then using the arrow keys works. But double-clicking then dragging does not, because that too goes through endEditDrag().

There are other side effects of this problem, such as the fact that the offset now may now get written unnecessarily to the score, and other places in the code that rely on checking isStyled() will fail.


Comments

Status PR created fixed

Fixed in branch 3.x, commit 4084486f4f

_fix #314854: element offset marked nostyle after edit

Resolves: https://musescore.org/en/node/314854

Currently, on any drag operation in edit mode
(including "drag" via arrow keys, which uses the same code),
the offset is set to NOSTYLE, whereas it should be UNSTYLED
(if it was previously styled).
The result is that after such an edit, the offset can no longer
be reset to its original STYLED state,
so it even after a reset of the offset itself,
it remains marked as NOSTYLE and will not respond to style changes,

There is code in the ordinary drag case (Element::endDrag())
to handle this, but it is missing from the edit mode version.
The fix here is to simply reproduce that code in Element::endEditDrag()._

Fix version
3.6.0