Fix a bug with messages jumping if you were scrolled up

The bug appeared every 100 messages (so whenever a chunk was deleted)

To fix this, we only perform the first chunk offset increment if the
item we deleted was not the last item in a chunk
This commit is contained in:
Rasmus Karlsson 2019-06-22 13:04:31 +02:00
parent c631434cee
commit 64dc7f5d73

View file

@ -253,8 +253,6 @@ private:
deleted = this->chunks_->front()->at(this->firstChunkOffset_); deleted = this->chunks_->front()->at(this->firstChunkOffset_);
this->firstChunkOffset_++;
// need to delete the first chunk // need to delete the first chunk
if (this->firstChunkOffset_ == this->chunks_->front()->size() - 1) if (this->firstChunkOffset_ == this->chunks_->front()->size() - 1)
{ {
@ -275,6 +273,11 @@ private:
this->chunks_ = newVector; this->chunks_ = newVector;
this->firstChunkOffset_ = 0; this->firstChunkOffset_ = 0;
} }
else
{
this->firstChunkOffset_++;
}
return true; return true;
} }