# HG changeset patch # User Chris Cannam # Date 1432213580 -3600 # Node ID e297b7d752f20ad91bf14efd99f4e7faba07ab15 # Parent 73b0dc7d6ec1e1053017b498e49b15a5a226b037 Prevent selection being dragged beyond start/end of content diff -r 73b0dc7d6ec1 -r e297b7d752f2 view/Pane.cpp --- a/view/Pane.cpp Thu May 21 13:55:06 2015 +0100 +++ b/view/Pane.cpp Thu May 21 14:06:20 2015 +0100 @@ -388,10 +388,10 @@ Pane::selectionIsBeingEdited() const { if (!m_editingSelection.isEmpty()) { - if (m_mousePos != m_clickPos && - getFrameForX(m_mousePos.x()) != getFrameForX(m_clickPos.x())) { - return true; - } + if (m_mousePos != m_clickPos && + getFrameForX(m_mousePos.x()) != getFrameForX(m_clickPos.x())) { + return true; + } } return false; } @@ -2111,14 +2111,25 @@ max = snapFrameRight; } + sv_frame_t end = getModelsEndFrame(); + if (min > end) min = end; + if (max > end) max = end; + if (m_manager) { - m_manager->setInProgressSelection(Selection(alignToReference(min), - alignToReference(max)), - !m_resizing && !m_ctrlPressed); + + Selection sel(alignToReference(min), alignToReference(max)); + + bool exc; + bool same = (m_manager->haveInProgressSelection() && + m_manager->getInProgressSelection(exc) == sel); + + m_manager->setInProgressSelection(sel, !m_resizing && !m_ctrlPressed); + + if (!same) { + edgeScrollMaybe(e->x()); + } } - edgeScrollMaybe(e->x()); - update(); if (min != max) {