]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/note-spacing.cc
Fix commit de8fda6a51 to only decrease the amount of whitespace.
[lilypond.git] / lily / note-spacing.cc
index af8fb0d6e09f3aff39c97950278f75722a06653d..cd97c179704a9feca75780ed2545215c87b1193d 100644 (file)
@@ -69,7 +69,7 @@ Note_spacing::get_spacing (Grob *me, Item *right_col,
   Drul_array<Skyline> skys = Spacing_interface::skylines (me, right_col);
   Real distance = skys[LEFT].distance (skys[RIGHT]);
   Real min_dist = max (0.0, distance);
-  Real min_desired_space = left_head_end + (min_dist - left_head_end) / 2;
+  Real min_desired_space = left_head_end + (min_dist - left_head_end + base_space - increment) / 2;
   Real ideal = base_space - increment + left_head_end;
 
   /* If we have a NonMusical column on the right, we measure the ideal distance
@@ -81,14 +81,18 @@ Note_spacing::get_spacing (Grob *me, Item *right_col,
                                                      Bar_line::has_interface);
 
       if (bar)
-       ideal -= bar->extent (right_col, X_AXIS)[LEFT];
+       {
+         Real shift = bar->extent (right_col, X_AXIS)[LEFT];
+         ideal -= shift;
+         min_desired_space -= max (shift, 0.0);
+       }
     }
 
   ideal = max (ideal, min_desired_space);
   stem_dir_correction (me, right_col, increment, &ideal, &min_desired_space);
 
-  Spring ret (ideal, min_dist);
-  ret.set_inverse_compress_strength (max (0.0, ideal - max (min_dist, min_desired_space)));
+  Spring ret (max (0.0, ideal), min_dist);
+  ret.set_inverse_compress_strength (max (0.0, ideal - min_desired_space));
   ret.set_inverse_stretch_strength (max (0.1, base_space - increment));
   return ret;
 }
@@ -215,6 +219,8 @@ Note_spacing::stem_dir_correction (Grob *me, Item *rcolumn,
       for (vsize i = 0; i < items.size (); i++)
        {
          Item *it = dynamic_cast<Item *> (items[i]);
+         if (!Note_column::has_interface (it))
+           continue;
 
          /*
            don't correct if accidentals are sticking out of the right side.