]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4092: Limit tuplet bracket length to actual tuplet length
authorDavid Kastrup <dak@gnu.org>
Thu, 4 Sep 2014 15:23:51 +0000 (17:23 +0200)
committerDavid Kastrup <dak@gnu.org>
Thu, 11 Sep 2014 12:44:51 +0000 (14:44 +0200)
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 [new file with mode: 0644]
lily/tuplet-iterator.cc

diff --git a/input/regression/tuplet-long-spanner.ly b/input/regression/tuplet-long-spanner.ly
new file mode 100644 (file)
index 0000000..d79ac54
--- /dev/null
@@ -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 |
+}
index e04a0e9de8ee57932af9a3587acdc32043e0a865..20d04e651b16c745557a4eab4cb4deb67cec1301 100644 (file)
@@ -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 ();