System divider goes away

• Dec 8, 2019 - 09:05
Reported version
S4 - Minor
PR created

When inserting a staff spacer fixed down (between two systems, to reduce the distance slightly), the system divider goes away.


Weird, I can reproduce on this score, but not easily in a score I create from scratch. If I keep adding and deleting the spacer in my own score, it works and works and works and works and works then suddenly fails, Maybe autosave is involved? Not really clear.

Here is why it's why happening:…

For some reason, the check to add system dividers is skipped if there if the top system hasFixedDownDistance(), which makes zero sense to me. The reason the spacer works at first is the system isn't actually laid out again when adding the spacer, which is potentially fine because there really shouldn't be a need to. But not laying out the system means the fixedDownDistance flag never gets set, which also means some other things that depend on it don't work right (including the position of the divider). So really, we need to trigger a layout when a fixed divider is added, or at least set that flag. But there is still more to this, we never even reach that point in the code for scores where these are the only systems on the page, because if the only system gaps on the page are controlled by fixed spacers, sList is empty and we return earlier, having first deleted the divers. Not sure when that early return is appropriate, but it isn't here.

Bottom line, I see three things that need to happen to fix this, the first (removing the bad check for hasFixedDownDistance) is probably safe, the second (making sure that flag is set in the first place) is almost certainly good, but I'm not so sure about removing the early return - I won't be surprised if something breaks, very possibly with a crash - if that is actually needed.

The early return happens in single page view, so indeed, system dividers don't work there. Can't think of a good reason for that. But here, I can see the early makes sense, we don;t need to do much of the process that follows - but we do need dividers. So instead of removing them unconditionally, probably we need a call to checkDivider.

So I think I now understand enough to do a fix.