\autoChange behaves inconsistently when rests are present

Gilberto Agostinho via bug-lilypond <[email protected]>
Newsgroups gmane.comp.gnu.lilypond.bugs
Message-ID <[email protected]>
Hi all,

I've came across a strange bug with \autoChange which was not present in 
version 2.22.2 but is present in version 2.24.1 (and was probably 
introduced somewhere in between these two versions). Basically, 
autoChange will sometimes change staves inconsistently and display some 
notes in the wrong staff depending on whether a)rests are present in the 
preceding music, or b) whether the affected note is the last one of the 
staff, in which case it seems to behave normally. It seems like a 
complex behaviour and I haven't been able to pin it down completely, but 
here are two screenshots showing the output of the two versions.

Version 2.22.2: https://i.postimg.cc/bvnV7JKG/ly2-22-2.png
Version 2.24.1: https://i.postimg.cc/B6G7430m/ly2-24-1.png

The example used is:

    \new PianoStaff {
       \autoChange {
         g4 a b c'
         d'4 r a g
         g4 c' d' e'
       }
     }
     \new PianoStaff {
       \autoChange {
         g4 a b c'
         d'4 r a g
         g4 c' d' e'
         g4 c' d' e'
       }
     }
     \new PianoStaff {
       \autoChange {
         g4 a b c'
         d'4 g a g
         g4 c' d' e'
         g4 c' d' e'
       }
     }
     \new PianoStaff {
       \autoChange {
         g4 a b c'
         d'4 r a g
         g4 c' d' e'
         R1
         g4 c' d' e'
       }
     }

The behaviour in 2.22.2 is exactly as expected, with changes happening 
around middle C by default; C4's stay in the current staff of previous 
notes, and rests are placed in the staff corresponding to the next 
pitched note.

The list of issues in version 2.24.1 in my minimal example are:

  * Stave 1: due to the presence blue rest, the next C4 is placed in the
    wrong staff. Notice how the last E4 is correctly place for now
  * Stave 2: once again, due to the rest present, the C4s are
    incorrectly placed, and so is now the E4 (which is not the last note
    of the staff any longer)
  * Stave 3: there are no rests any more, so the behaviour is as
    expected and identical to version 2.22.2
  * Stave 4: once again, the presence of rests messes some notes up,
    this time also affecting the G4 in the final bar


Best wishes,
Gilberto
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.