mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix scroll in return to a channel I'm not in.
This commit is contained in:
parent
a6484e6131
commit
fcfacf1f9d
2 changed files with 11 additions and 2 deletions
|
@ -2189,7 +2189,8 @@ void HistoryWidget::showHistory(
|
||||||
_chooseForReport = nullptr;
|
_chooseForReport = nullptr;
|
||||||
}
|
}
|
||||||
if (_showAtMsgId == ShowAtUnreadMsgId
|
if (_showAtMsgId == ShowAtUnreadMsgId
|
||||||
&& !_history->trackUnreadMessages()) {
|
&& !_history->trackUnreadMessages()
|
||||||
|
&& !hasSavedScroll()) {
|
||||||
_showAtMsgId = ShowAtTheEndMsgId;
|
_showAtMsgId = ShowAtTheEndMsgId;
|
||||||
}
|
}
|
||||||
refreshTopBarActiveChat();
|
refreshTopBarActiveChat();
|
||||||
|
@ -5394,8 +5395,15 @@ MsgId HistoryWidget::replyToId() const {
|
||||||
return _replyToId ? _replyToId : (_kbReplyTo ? _kbReplyTo->id : 0);
|
return _replyToId ? _replyToId : (_kbReplyTo ? _kbReplyTo->id : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HistoryWidget::hasSavedScroll() const {
|
||||||
|
Expects(_history != nullptr);
|
||||||
|
|
||||||
|
return _history->scrollTopItem
|
||||||
|
|| (_migrated && _migrated->scrollTopItem);
|
||||||
|
}
|
||||||
|
|
||||||
int HistoryWidget::countInitialScrollTop() {
|
int HistoryWidget::countInitialScrollTop() {
|
||||||
if (_history->scrollTopItem || (_migrated && _migrated->scrollTopItem)) {
|
if (hasSavedScroll()) {
|
||||||
return _list->historyScrollTop();
|
return _list->historyScrollTop();
|
||||||
} else if (_showAtMsgId
|
} else if (_showAtMsgId
|
||||||
&& (IsServerMsgId(_showAtMsgId)
|
&& (IsServerMsgId(_showAtMsgId)
|
||||||
|
|
|
@ -573,6 +573,7 @@ private:
|
||||||
|
|
||||||
// when scroll position or scroll area size changed this method
|
// when scroll position or scroll area size changed this method
|
||||||
// updates the boundings of the visible area in HistoryInner
|
// updates the boundings of the visible area in HistoryInner
|
||||||
|
[[nodiscard]] bool hasSavedScroll() const;
|
||||||
void visibleAreaUpdated();
|
void visibleAreaUpdated();
|
||||||
int countInitialScrollTop();
|
int countInitialScrollTop();
|
||||||
int countAutomaticScrollTop();
|
int countAutomaticScrollTop();
|
||||||
|
|
Loading…
Add table
Reference in a new issue