Barline, switching back from a short 2 span to a normal barline

• Aug 19, 2019 - 09:38
Reported version
P2 - Medium
S4 - Minor

1) When changing a barline to for example "Short 2 span" and then trying to change it back to a normal barline, it cannot be done with the icon in the menu. It is still possible with the inspector menu, or by changing the barline first to a double barline and then changing it back to the normal barline.

2) The same problem occurs with the "Tick 1 span", "Tick 2 span" and "Short 1 span".

3) In all cases, a workaround would be to change the barline style to a double or final barline and then convert it to a normal barline.

Attachment Size
Musescore 3_Test barline.mscz 6.58 KB


Priority P2 - Medium

As I recall, this is kind of by design although as with all designs it is subject to further changes. The rationale I remember is that the point of the normal barline is to set the "type" of barline, not the size. So you could use it to make a dotted "Short 2 span" barline normal while keeping it still short. Except - that doesn't actually work, it does reset to full size in that case. So one way or another there is a bug here to me, but it might not be the bug it first appears to be.

Marc, what do you think of this change?

diff --git a/libmscore/barline.cpp b/libmscore/barline.cpp
index d8d252c02..0b32f049a 100644
--- a/libmscore/barline.cpp
+++ b/libmscore/barline.cpp
@@ -68,7 +68,7 @@ static void undoChangeBarLineType(BarLine* bl, BarLineType barType, bool allStav
                         bool generated;
                         if (bl->barLineType() == barType)
                               generated = bl->generated();  // no change: keep current status
-                        else if (!bl->generated() && (barType == BarLineType::NORMAL))
+                        else if (!bl->generated() && (barType == BarLineType::NORMAL) && (bl->spanFrom() == 0) && (bl->spanTo() == 0))
                               generated = true;             // currently non-generated, changing to normal: assume generated
                               generated = false;            // otherwise assume non-generated

I believe it fixes the bug that you see. As for OP's original concern, we could add another palette item for "Default span".

Workaround No Yes

I haven't tried it, but I assume you have :-), and the change looks right to me. I know there is a fair amount of guesswork in that part of the code - there are probably also places we could be checking for final barline + end of score, or double bar plus generated courtesy signature.

A new palette item could indeed be added, but I wonder what it should look like to differentiate itself from the regular / normal barline? Meanwhile, the Inspector is a fine way of resetting the span, so I wouldn't lose sleep over this.