From: Neil Puttock Date: Fri, 16 May 2008 23:39:37 +0000 (+1000) Subject: Fix 463. X-Git-Tag: release/2.11.46-1~16^2~3 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=b5362bb4f3c8eb130eb451b60d98271dff79f444;p=lilypond.git Fix 463. Keep better track of the previous staff for a voice. --- diff --git a/input/regression/follow-voice-consecutive.ly b/input/regression/follow-voice-consecutive.ly new file mode 100644 index 0000000000..97ffc41739 --- /dev/null +++ b/input/regression/follow-voice-consecutive.ly @@ -0,0 +1,23 @@ +\version "2.11.46" + +\header { + texidoc= "The voice follower is not confused when set for consecutive +sets of staff switches." +} + +\new PianoStaff \relative c' << + \new Staff = "one" { + c4 + \showStaffSwitch + \change Staff = two + a4 + \hideStaffSwitch + \change Staff = one + c4 + \showStaffSwitch + \change Staff = two + a4 + \hideStaffSwitch + } + \new Staff = "two" { \clef bass s1 } +>> diff --git a/lily/note-head-line-engraver.cc b/lily/note-head-line-engraver.cc index 152297d985..a499905d62 100644 --- a/lily/note-head-line-engraver.cc +++ b/lily/note-head-line-engraver.cc @@ -54,20 +54,19 @@ void Note_head_line_engraver::acknowledge_rhythmic_head (Grob_info info) { head_ = info.grob (); - if (to_boolean (get_property ("followVoice"))) + Context *tr = context (); + + while (tr && !tr->is_alias (ly_symbol2scm ("Staff"))) + tr = tr->get_parent_context (); + + if (tr + && tr->is_alias (ly_symbol2scm ("Staff")) && tr != last_staff_ + && to_boolean (get_property ("followVoice"))) { - Context *tr = context (); - while (tr && !tr->is_alias (ly_symbol2scm ("Staff"))) - tr = tr->get_parent_context (); - - if (tr - && tr->is_alias (ly_symbol2scm ("Staff")) && tr != last_staff_) - { - if (last_head_) - follow_ = true; - last_staff_ = tr; - } + if (last_head_) + follow_ = true; } + last_staff_ = tr; } void