From b67ee89edd3c72b9c48d287c83ec7951499765ac Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sun, 31 Dec 2006 12:12:31 +0100 Subject: [PATCH] robustness: handle floating grace attached across line breaks. Fixes #203 --- .../spacing-loose-grace-linebreak.ly | 41 +++++++++++++++++++ lily/spacing-loose-columns.cc | 14 ++++++- 2 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 input/regression/spacing-loose-grace-linebreak.ly diff --git a/input/regression/spacing-loose-grace-linebreak.ly b/input/regression/spacing-loose-grace-linebreak.ly new file mode 100644 index 0000000000..182b8549a2 --- /dev/null +++ b/input/regression/spacing-loose-grace-linebreak.ly @@ -0,0 +1,41 @@ + + +\header{ + texidoc = "If a floating grace spacing section attaches to a note +across a line break, it gets attached to the end of line." +} + + +\version "2.11.5" + +\new Score \with { + \override SpacingSpanner #'strict-grace-spacing = ##t + \override PaperColumn #'used = ##t +} << + + \new Staff << + + \new Voice { + \time 2/4 s2 + \time 2/4 s2 \break + \time 2/4 s2 + } + + \new Voice { + b'4 + \afterGrace c''4 {b'16} + s4 + s4 + c''4 + } + \new Voice { + c'4 + c'8. + r16 + c'4 + c'4 + c'4 + } + >> +>> + diff --git a/lily/spacing-loose-columns.cc b/lily/spacing-loose-columns.cc index 94bc552e6f..c32b60639c 100644 --- a/lily/spacing-loose-columns.cc +++ b/lily/spacing-loose-columns.cc @@ -66,9 +66,19 @@ set_loose_columns (System *which, Column_x_positions const *posns) loose = right = re->get_column (); } - if (!right->get_system ()) + if (!right->get_system () + && right->find_prebroken_piece (LEFT) + && right->find_prebroken_piece (LEFT)->get_system () == which) right = right->find_prebroken_piece (LEFT); - + else if (Paper_column::get_rank (which->get_bound (RIGHT)) < Paper_column::get_rank (right)) + + right = which->get_bound (RIGHT); + else + { + clique.back ()->programming_error ("Loose column does not have right side to attach to."); + right = which->get_bound (RIGHT); + } + Grob *common = right->common_refpoint (left, X_AXIS); clique.push_back (right); -- 2.39.5