From 9fd81cd1fbc2935e1c69842ed9f41294af62f504 Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Thu, 4 Sep 2014 17:23:51 +0200 Subject: [PATCH] Issue 4092: Limit tuplet bracket length to actual tuplet length See the regtest for an example of the problem. Without the patch, the tuplet bracket extends over all of \tuplet 3/2 4 { g16 a b } c8 including c8, resulting in visual lengths not adding up. --- input/regression/tuplet-long-spanner.ly | 21 +++++++++++++++++++++ lily/tuplet-iterator.cc | 14 ++++++-------- 2 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 input/regression/tuplet-long-spanner.ly diff --git a/input/regression/tuplet-long-spanner.ly b/input/regression/tuplet-long-spanner.ly new file mode 100644 index 0000000000..d79ac54700 --- /dev/null +++ b/input/regression/tuplet-long-spanner.ly @@ -0,0 +1,21 @@ +\version "2.19.14" + +\header { + texidoc = "Overlong tuplet span specifications are reduced +to the actual length." +} + +\layout { ragged-right = ##t } + +\relative \new Staff \with { subdivideBeams = ##t + baseMoment = #(ly:make-moment 1/8) + } +{ + \tuplet 3/2 4 { g16 a b } c8 d e f2 | + \set baseMoment = #(ly:make-moment 1/12) + \tuplet 3/2 4 + { d16 e f g a b c,16 d e f g a + \unset baseMoment + b, c d } + \tuplet 3/2 { e16 f8 } g4 | +} diff --git a/lily/tuplet-iterator.cc b/lily/tuplet-iterator.cc index e04a0e9de8..20d04e651b 100644 --- a/lily/tuplet-iterator.cc +++ b/lily/tuplet-iterator.cc @@ -109,6 +109,8 @@ Tuplet_iterator::process (Moment m) if (m.main_part_ < music_get_length ().main_part_) { + spanner_duration_ = + min (music_get_length () - next_split_mom_, spanner_duration_); tuplet_handler_.set_context (get_outlet ()); report_event (create_event (START)); @@ -128,15 +130,11 @@ Tuplet_iterator::construct_children () { if (Duration *d = Duration::unsmob (get_music ()->get_property ("duration"))) spanner_duration_ = d->get_length (); + else if (Moment *mp + = Moment::unsmob (get_outlet ()->get_property ("tupletSpannerDuration"))) + spanner_duration_ = mp->main_part_; else - { - spanner_duration_ = music_get_length (); - - Moment *mp - = Moment::unsmob (get_outlet ()->get_property ("tupletSpannerDuration")); - if (mp) - spanner_duration_ = min (mp->main_part_, spanner_duration_); - } + spanner_duration_.set_infinite (1); Music_wrapper_iterator::construct_children (); -- 2.39.5