diff options
-rw-r--r-- | input/regression/hairpin-barline-break.ly | 15 | ||||
-rw-r--r-- | lily/hairpin.cc | 24 |
2 files changed, 29 insertions, 10 deletions
diff --git a/input/regression/hairpin-barline-break.ly b/input/regression/hairpin-barline-break.ly new file mode 100644 index 0000000000..3f783dbbe5 --- /dev/null +++ b/input/regression/hairpin-barline-break.ly @@ -0,0 +1,15 @@ +\header { + + texidoc ="If a hairpin ends on the first note of a new stave, we +don't print that ending. But on the previous line, this hairpin +should not be left open, and should end at the barline. " +} + +\version "2.9.26" +\layout { ragged-right = ##t } +\relative c' { + \set hairpinToBarline = ##t + c1\> + \break + c1\! +} diff --git a/lily/hairpin.cc b/lily/hairpin.cc index 4b9c215e2e..ca5a7c050d 100644 --- a/lily/hairpin.cc +++ b/lily/hairpin.cc @@ -58,7 +58,12 @@ Hairpin::print (SCM smob) { Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (smob)); - consider_suicide (me); + if (Spanner *orig = dynamic_cast<Spanner*> (me->original ())) + { + for (vsize i = 0; i < orig->broken_intos_.size (); i++) + Hairpin::consider_suicide (orig->broken_intos_[i]); + } + SCM s = me->get_property ("grow-direction"); if (!is_direction (s)) { @@ -78,17 +83,16 @@ Hairpin::print (SCM smob) broken[d] = bounds[d]->break_status_dir () != CENTER; } while (flip (&d) != LEFT); + + broken[RIGHT] = broken[RIGHT] && me->broken_neighbor (RIGHT); + broken[RIGHT] = broken[RIGHT] && me->broken_neighbor (RIGHT)->is_live (); + if (broken[RIGHT]) { - Spanner *orig = dynamic_cast<Spanner*> (me->original ()); - if (me->get_break_index () - < orig->broken_intos_.size () - 1) - { - Spanner *next = orig->broken_intos_[me->get_break_index () + 1]; - Stencil *s = next->get_stencil (); - if (!s || s->is_empty ()) - broken[RIGHT] = false; - } + Spanner *next = me->broken_neighbor (RIGHT); + Stencil *s = next->get_stencil (); + if (!s || s->is_empty ()) + broken[RIGHT] = false; } Grob *common = bounds[LEFT]->common_refpoint (bounds[RIGHT], X_AXIS); |