Fix iterator off-by-one: Allow to move top-most track. via ctrl up/down
[ardour.git] / gtk2_ardour / editor_routes.cc
index 67f15e8a3aa272df6bd92b6192128ab0649c23a2..abdd3f47b1c651b70d35467d1e35e1d96a7a92c5 100644 (file)
@@ -1663,9 +1663,9 @@ EditorRoutes::move_selected_tracks (bool up)
                PresentationInfo::ChangeSuspender cs;
 
                if (up) {
-                       unselected_neighbour = view_stripables.end ();
+                       unselected_neighbour = view_stripables.begin ();
+                       ++unselected_neighbour;
                        vsi = view_stripables.begin();
-                       ++vsi;
 
                        while (vsi != view_stripables.end()) {
 
@@ -1699,10 +1699,11 @@ EditorRoutes::move_selected_tracks (bool up)
 
                        unselected_neighbour = view_stripables.end();
                        vsi = unselected_neighbour;
-                       --vsi;
 
                        do {
 
+                               --vsi;
+
                                if (vsi->stripable->presentation_info().selected()) {
 
                                        if (unselected_neighbour != view_stripables.end()) {
@@ -1726,8 +1727,6 @@ EditorRoutes::move_selected_tracks (bool up)
 
                                }
 
-                               --vsi;
-
                        } while (vsi != view_stripables.begin());
                }
        }