From 602a66f5bc8b625686f9e659d067fe472fbac798 Mon Sep 17 00:00:00 2001 From: fourtf Date: Mon, 16 Sep 2019 10:55:54 +0200 Subject: [PATCH] Fixes #963 Highlights move while paused --- src/widgets/helper/ChannelView.cpp | 23 +++++++++++++++++++---- src/widgets/helper/ChannelView.hpp | 1 + 2 files changed, 20 insertions(+), 4 deletions(-) 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_;