diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 846178db14..00c769c211 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -350,12 +350,18 @@ Editor::move_range_selection_start_or_end_to_region_boundary (bool move_end, boo int dir = next ? 1 : -1; /* so we don't find the current region again */ - if (dir > 0 || pos.is_positive()) { + if (dir > 0) { pos = pos.increment (); + } else { + if (!pos.is_zero()) { + pos = pos.decrement (); + } else { + return; + } } timepos_t const target = get_region_boundary (pos, dir, true, false); - if (target.is_negative ()) { + if (target == timepos_t::max (target.time_domain())) { return; } @@ -976,11 +982,17 @@ Editor::cursor_to_region_boundary (bool with_selection, int32_t dir) } // so we don't find the current region again.. - if (dir > 0 || pos > 0) { + if (dir > 0) { pos = pos.increment(); + } else { + if (!pos.is_zero()) { + pos = pos.decrement (); + } else { + return; + } } - if ((target = get_region_boundary (pos, dir, with_selection, false)) < 0) { + if ((target = get_region_boundary (pos, dir, with_selection, false)) == timepos_t::max (target.time_domain())) { return; } @@ -1012,8 +1024,15 @@ Editor::cursor_to_region_point (EditorCursor* cursor, RegionPoint point, int32_t TimeAxisView *ontrack = 0; // so we don't find the current region again.. - if (dir > 0 || pos.is_positive()) + if (dir > 0) { pos = pos.increment(); + } else { + if (!pos.is_zero ()) { + pos = pos.decrement (); + } else { + return; + } + } if (!selection->tracks.empty()) { @@ -1155,11 +1174,17 @@ Editor::selected_marker_to_region_boundary (bool with_selection, int32_t dir) timepos_t pos = loc->start(); // so we don't find the current region again.. - if (dir > 0 || pos.is_positive()) { + if (dir > 0) { pos = pos.increment(); + } else { + if (!pos.is_zero()) { + pos = pos.decrement (); + } else { + return; + } } - if ((target = get_region_boundary (pos, dir, with_selection, false)) < 0) { + if ((target = get_region_boundary (pos, dir, with_selection, false)) == timepos_t::max (target.time_domain())) { return; } @@ -1199,8 +1224,14 @@ Editor::selected_marker_to_region_point (RegionPoint point, int32_t dir) pos = loc->start(); // so we don't find the current region again.. - if (dir > 0 || pos > 0) { + if (dir > 0) { pos = pos.increment(); + } else { + if (!pos.is_zero()) { + pos = pos.decrement (); + } else { + return; + } } if (!selection->tracks.empty()) {