diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index bf49c85cf..3395155fa 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -241,6 +241,14 @@ void ChannelView::unpause(PauseReason reason) this->pauses_.erase(reason); this->updatePauseTimer(); + + /// Move selection + this->selection_.selectionMin.messageIndex -= this->pauseSelectionOffset_; + this->selection_.selectionMax.messageIndex -= this->pauseSelectionOffset_; + this->selection_.start.messageIndex -= this->pauseSelectionOffset_; + this->selection_.end.messageIndex -= this->pauseSelectionOffset_; + + this->pauseSelectionOffset_ = 0; } void ChannelView::updatePauseTimer() @@ -697,10 +705,17 @@ void ChannelView::messageAddedAtStart(std::vector &messages) void ChannelView::messageRemoveFromStart(MessagePtr &message) { - this->selection_.selectionMin.messageIndex--; - this->selection_.selectionMax.messageIndex--; - this->selection_.start.messageIndex--; - this->selection_.end.messageIndex--; + if (this->paused()) + { + this->pauseSelectionOffset_ += 1; + } + else + { + this->selection_.selectionMin.messageIndex--; + this->selection_.selectionMax.messageIndex--; + this->selection_.start.messageIndex--; + this->selection_.end.messageIndex--; + } this->queueLayout(); } diff --git a/src/widgets/helper/ChannelView.hpp b/src/widgets/helper/ChannelView.hpp index 6e5893319..0aed55a5c 100644 --- a/src/widgets/helper/ChannelView.hpp +++ b/src/widgets/helper/ChannelView.hpp @@ -163,6 +163,7 @@ private: pauses_; boost::optional pauseEnd_; int pauseScrollOffset_ = 0; + int pauseSelectionOffset_ = 0; boost::optional overrideFlags_; MessageLayoutPtr lastReadMessage_;