From fbc48bdf3423a9d325f7b7275cff509915ae98e7 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 5 Apr 2020 20:19:26 +0200 Subject: Fix end vs. length bug when creating regions - #7978 set_length() includes the end. A Region starting at 0 and ending at 0, has a length of 1 (think counting fence-posts, or video-frames). --- gtk2_ardour/editor_drag.cc | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'gtk2_ardour/editor_drag.cc') diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 8670910216..81d3bae02d 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -2484,15 +2484,9 @@ RegionCreateDrag::motion (GdkEvent* event, bool first_move) _region->set_initial_position (f); } - /* Don't use a zero-length region, and subtract 1 sample from the snapped length - so that if this region is duplicated, its duplicate starts on - a snap point rather than 1 sample after a snap point. Otherwise things get - a bit confusing as if a region starts 1 sample after a snap point, one cannot - place snapped notes at the start of the region. - */ if (f != grab_sample()) { - samplecnt_t const len = (samplecnt_t) fabs ((double)(f - grab_sample () - 1)); - _region->set_length (len < 1 ? 1 : len, _editor->get_grid_music_divisions (event->button.state)); + samplecnt_t const len = ::llabs (f - grab_sample ()); + _region->set_length (len, _editor->get_grid_music_divisions (event->button.state)); } } } -- cgit v1.2.3