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->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()
@ -696,11 +704,18 @@ void ChannelView::messageAddedAtStart(std::vector<MessagePtr> &messages)
}
void ChannelView::messageRemoveFromStart(MessagePtr &message)
{
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();
}

View file

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