From 423ef19c8fa7c645efd6aac5f0a212ffaf9f4fde Mon Sep 17 00:00:00 2001 From: Cranken Date: Sat, 6 Oct 2018 14:38:17 +0200 Subject: [PATCH] Fixed a bug appearing when selecting over multiple lines in different directions. --- src/widgets/helper/ChannelView.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index 700b90b8f..1a85a9132 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -899,12 +899,22 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event) if (wordStart < this->selection_.start.charIndex && !this->dCSelection_.selectingRight) { this->dCSelection_.selectingLeft = true; - this->setSelection(newStart, this->selection_.end); + if (wordStart > this->dCSelection_.originalEnd) { + this->setSelection(this->dCSelection_.origStartItem, + newEnd); + } else { + this->setSelection(newStart, this->selection_.end); + } // Selecting to the right } else if (wordEnd > this->selection_.end.charIndex && !this->dCSelection_.selectingLeft) { this->dCSelection_.selectingRight = true; - this->setSelection(this->selection_.start, newEnd); + if (wordEnd < this->dCSelection_.originalStart) { + this->setSelection(newStart, + this->dCSelection_.origEndItem); + } else { + this->setSelection(this->selection_.start, newEnd); + } } // Swapping from selecting left to selecting right if (wordStart > this->selection_.start.charIndex &&