mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
make sure scrollbar doesn't request messages out of scope
This commit is contained in:
parent
759e0aea50
commit
5dbe6990bd
|
@ -4,6 +4,7 @@
|
|||
#include "messages/limitedqueuesnapshot.h"
|
||||
|
||||
#include <boost/signals2.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
@ -102,7 +103,8 @@ private:
|
|||
int limit;
|
||||
int buffer;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace messages
|
||||
} // namespace chatterino
|
||||
|
||||
#endif // LIMITEDQUEUE_H
|
||||
|
|
|
@ -49,6 +49,17 @@ ChatWidgetView::layoutMessages()
|
|||
|
||||
int start = this->scrollbar.getCurrentValue();
|
||||
|
||||
if (messages.getLength() <= start) {
|
||||
// The scrollbar wants to show more values than we can offer
|
||||
|
||||
// just return for now
|
||||
return false;
|
||||
|
||||
|
||||
// Lower start value to the last message
|
||||
// start = messages.getLength() - 1;
|
||||
}
|
||||
|
||||
int y = -(messages[start].get()->getHeight() *
|
||||
(fmod(this->scrollbar.getCurrentValue(), 1)));
|
||||
|
||||
|
|
Loading…
Reference in a new issue