- ChatLine *line = chatLine(msgId, false);
- if(line) {
- // if this was the last line, we won't see it because it's outside the sceneRect
- // .. which is exactly what we want :)
- _markerLine->setPos(line->pos() + QPointF(0, line->height()));
-
- // DayChange messages might have been hidden outside the scene rect, don't make the markerline visible then!
- if(_markerLine->pos().y() >= sceneRect().y()) {
- _markerLineValid = true;
- if(_markerLineVisible)
- _markerLine->setVisible(true);
- return;
+void ChatScene::jumpToMarkerLine(bool requestBacklog) {
+ if(!isSingleBufferScene())
+ return;
+
+ if(markerLine()->isVisible()) {
+ markerLine()->ensureVisible(QRectF(), 50, 50);
+ return;
+ }
+ if(!_markerLineValid && requestBacklog) {
+ MsgId msgId = Client::markerLine(singleBufferId());
+ if(msgId.isValid()) {
+ _markerLineJumpPending = true;
+ Client::backlogManager()->requestBacklog(singleBufferId(), msgId, -1, -1, 0);
+
+ // If we filtered out the lastSeenMsg (by changing filters after setting it), we'd never jump because the above request
+ // won't fetch any prior lines. Thus, trigger a dynamic backlog request just in case, so repeated
+ // jump tries will eventually cause enough backlog to be fetched.
+ // This is a bit hackish, but not wasteful, as jumping to the top of the ChatView would trigger a dynamic fetch anyway.
+ this->requestBacklog();