Fixes #963 Highlights move while paused

This commit is contained in:
fourtf 2019-09-16 10:55:54 +02:00
parent fd8987cf1b
commit 602a66f5bc
2 changed files with 20 additions and 4 deletions

View file

@ -241,6 +241,14 @@ void ChannelView::unpause(PauseReason reason)
this->pauses_.erase(reason); this->pauses_.erase(reason);
this->updatePauseTimer(); 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() void ChannelView::updatePauseTimer()
@ -697,10 +705,17 @@ void ChannelView::messageAddedAtStart(std::vector<MessagePtr> &messages)
void ChannelView::messageRemoveFromStart(MessagePtr &message) void ChannelView::messageRemoveFromStart(MessagePtr &message)
{ {
this->selection_.selectionMin.messageIndex--; if (this->paused())
this->selection_.selectionMax.messageIndex--; {
this->selection_.start.messageIndex--; this->pauseSelectionOffset_ += 1;
this->selection_.end.messageIndex--; }
else
{
this->selection_.selectionMin.messageIndex--;
this->selection_.selectionMax.messageIndex--;
this->selection_.start.messageIndex--;
this->selection_.end.messageIndex--;
}
this->queueLayout(); this->queueLayout();
} }

View file

@ -163,6 +163,7 @@ private:
pauses_; pauses_;
boost::optional<SteadyClock::time_point> pauseEnd_; boost::optional<SteadyClock::time_point> pauseEnd_;
int pauseScrollOffset_ = 0; int pauseScrollOffset_ = 0;
int pauseSelectionOffset_ = 0;
boost::optional<MessageElementFlags> overrideFlags_; boost::optional<MessageElementFlags> overrideFlags_;
MessageLayoutPtr lastReadMessage_; MessageLayoutPtr lastReadMessage_;