Odd short-to-long instrument naming behavior, especially when a vertical frame is present

• Dec 3, 2020 - 12:55
Reported version
S4 - Minor

MuseScore 3.5.2, Windows 10
In the attached please see page 106 measure 379. In the first system, notice that the "short" instrument names are used on the left.
1. At measure 380 make an edit to either the System Text at the top or the Staff Text above the Sieglinde staff.
2. As soon as an edit is made to either the System or Staff Text, the instrument names change to the "long" version and the brackets become a bit off, as if a Section Break (instead of a System or Page Break) were inserted at the end of page 105.
3. Save & close the score.
4. On re-opening the score is back to "short" instrument names and the apparent Section Break formatting is no longer present.
The issue is apparently related to the presence of the Vertical Frame at the top of page 106.
It has been reported that not only System and Staff text but chords (Ctrl + K), lyrics (Ctrl + L), figured bass (Ctrl + G) and maybe other items generate the same issue when a Vertical Frame is present.

Attachment Size
Die Walküre, Act III Scene I.mscz 1.25 MB


I can reproduce, but offhand I have no more insight into why this might be happening than anyone else. The code only sets the flag to use long instrument names in some very particular cases, and this shouldn't be one. My best guess is somehow the layout is getting tricked into thinking this is in fact the first system of the piece, perhaps as a result of the code that tries to layout only the portion of the score that has actually changed. Of course that code works in most cases, no idea yet why not here.

So far I can't reproduce with a smaller test score, but cadiz1 can, hopefully he will attach his here.

One other observation - the issue fixes itself if you make any other edit to that section.

Well, one mystery solved, anyhow - I couldn't reproduce with a simple example under the debugger because I'm using a 3.6 build, but I can when using that same example with 3.5.2. But your example shows the problem with both. Very strange. Anyhow, thanks, that will hopefully help!

Note to self: I think I see the problem. At the start of Score::collectSystem(), we set various flags - like whether start with long names - based on whether there is a section break on the last measure of the previous system. But in the case where the previous "system" actually is just a vertical frame (or one or more horizontal frames), we skip this. So firstSystem remains true if it was true going in, which it could be depending on how we got here.

I believe the fix will involve improving this handling - previous system has no measures, only frames. But we need to be careful to do the right thing if there was a section break on the system before that. I suspect there is a bug lurking in this case already, although so far I can't trigger it. I also see #295629: Horizontal frames interrupt section break formatting, which is different, but seems to be a similar issue - there is no section break on the previous measure, only the previous frame. So probably this also should be fixed.

Turns out the bug at hand was reported quite some time ago - see #288098: Long instrument names appear in first system after vertical frame.

No doubt the solution to all this isn't hard, but I will need to think and test more.

Sorry for the delay - in Europe here :)
It was my test file: voice piano.mscz
On the GIF, I was adding text in measure 6, just like that, because I noticed that the text was attached under the vertical frame, in the original file, more or less in the center (again, it's the same with chords, lyrics etc.).
Going further with this test file, I notice that it goes off the rails in measures 6, 7, 8 and 9 - and apparently not the others.