Index: lily/rest-collision.cc |
diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc |
index 8ba647e2019d8201d3698dbaa39cdd74f6671e90..0e7a01c5a7a204ec05f51f38cf0cd4af9a294884 100644 |
--- a/lily/rest-collision.cc |
+++ b/lily/rest-collision.cc |
@@ -250,19 +250,14 @@ Rest_collision::calc_positioning_done (SCM smob) |
Real y = dir * max (0.0, |
-dir * restdim[-dir] + dir * notedim[dir] + minimum_dist); |
- int stafflines = Staff_symbol_referencer::line_count (me); |
- if (!stafflines) |
- { |
- programming_error ("no staff line count"); |
- stafflines = 5; |
- } |
- |
// move discretely by half spaces. |
int discrete_y = dir * int (ceil (y / (0.5 * dir * staff_space))); |
+ Interval staff_span = Staff_symbol_referencer::staff_span (rest); |
+ staff_span.widen (1); |
// move by whole spaces inside the staff. |
- if (fabs (Staff_symbol_referencer::get_position (rest) |
- + discrete_y) < stafflines + 1) |
+ if (staff_span.contains |
+ (Staff_symbol_referencer::get_position (rest) + discrete_y)) |
{ |
discrete_y = dir * int (ceil (dir * discrete_y / 2.0) * 2.0); |
} |