- Grob * lgr = get_x_bound_grob (columns[0], dir);
- Grob * rgr = get_x_bound_grob (columns.top (), dir);
-
- Real x0 = robust_relative_extent (lgr, commonx, X_AXIS)[LEFT];
- Real x1 = robust_relative_extent (rgr, commonx, X_AXIS)[RIGHT];
- Real w = x1 -x0;
-
+ Drul_array<Item *> bounds;
+ bounds[LEFT] = get_x_bound_item (me, LEFT, dir);
+ bounds[RIGHT] = get_x_bound_item (me, RIGHT, dir);
+
+ Drul_array<bool> connect_to_other;
+ Interval x_span;
+ Direction d = LEFT;
+ do
+ {
+ x_span[d] = robust_relative_extent (bounds[d], commonx, X_AXIS)[d];
+ Direction break_dir = bounds[d]->break_status_dir ();
+ Spanner *orig_spanner = dynamic_cast<Spanner *> (me->original ());
+
+ int neighbor_idx = me->get_break_index () - break_dir;
+
+ if (break_dir
+ && d == RIGHT
+ && neighbor_idx < orig_spanner->broken_intos_.size ())
+ {
+ Grob *neighbor = orig_spanner->broken_intos_[neighbor_idx];
+
+ /* trigger possible suicide*/
+ (void) neighbor->get_property ("positions");
+ }
+
+ connect_to_other[d]
+ = (break_dir
+ && (neighbor_idx < orig_spanner->broken_intos_.size ()
+ && neighbor_idx >= 0)
+ && orig_spanner->broken_intos_[neighbor_idx]->is_live ());
+
+
+ if (connect_to_other[d])
+ {
+ Interval overshoot (robust_scm2drul (me->get_property ("break-overshoot"),
+ Interval (-0.5, 0.0)));
+
+ if (d == RIGHT)
+ x_span[d] += d * overshoot[d];
+ else
+ x_span[d] = robust_relative_extent (bounds[d], commonx, X_AXIS)[RIGHT]
+ - overshoot[LEFT];
+ }
+ else if (d == RIGHT
+ && (columns.is_empty ()
+ || (bounds[d]->get_column ()
+ != dynamic_cast<Item *> (columns.top ())->get_column ())))
+ {
+ /*
+ TODO: make padding tunable?
+ */
+ Real padding = 1.0;
+
+ if (bounds[d]->break_status_dir ())
+ padding = 0.0;
+
+ x_span[d] = robust_relative_extent (bounds[d], commonx, X_AXIS) [LEFT] - padding;
+ }
+ }
+ while (flip (&d) != LEFT);
+
+ Real w = x_span.length ();