fix: scroll to bottom when setting a channel (#5748)

This commit is contained in:
nerix
2024-12-02 16:59:17 +01:00
committed by GitHub
parent 8faf243e3e
commit 3c2a422243
4 changed files with 14 additions and 6 deletions
+1 -1
View File
@@ -142,7 +142,7 @@
- Dev: 7TV's `entitlement.reset` is now explicitly ignored. (#5685)
- Dev: Qt 6.8 and later now default to the GDI fontengine. (#5710)
- Dev: Moved to condition variables when shutting down worker threads. (#5721, #5733)
- Dev: Reduced layouts in channel views when setting a channel. (#5737)
- Dev: Reduced layouts in channel views when setting a channel. (#5737, #5748)
## 2.5.1
+3 -2
View File
@@ -168,10 +168,11 @@ void addTwitchEmoteSets(const std::shared_ptr<const EmoteMap> &local,
void loadEmojis(ChannelView &view, const std::vector<EmojiPtr> &emojiMap)
{
ChannelPtr emojiChannel(new Channel("", Channel::Type::None));
// set the channel first to make sure the scrollbar is at the top
view.setChannel(emojiChannel);
emojiChannel->addMessage(makeEmojiMessage(emojiMap),
MessageContext::Original);
view.setChannel(emojiChannel);
}
void loadEmojis(Channel &channel, const std::vector<EmojiPtr> &emojiMap,
+3 -3
View File
@@ -237,9 +237,6 @@ void ReplyThreadPopup::addMessagesFromThread()
sourceChannel->getName(), Channel::Type::None);
}
this->ui_.threadView->setChannel(this->virtualChannel_);
this->ui_.threadView->setSourceChannel(sourceChannel);
auto rootOverrideFlags =
std::optional<MessageFlags>(this->thread_->root()->flags);
rootOverrideFlags->set(MessageFlag::DoNotLog);
@@ -258,6 +255,9 @@ void ReplyThreadPopup::addMessagesFromThread()
}
}
this->ui_.threadView->setChannel(this->virtualChannel_);
this->ui_.threadView->setSourceChannel(sourceChannel);
this->messageConnection_ =
std::make_unique<pajlada::Signals::ScopedConnection>(
sourceChannel->messageAppended.connect(
+7
View File
@@ -1074,6 +1074,13 @@ void ChannelView::setChannel(const ChannelPtr &underlyingChannel)
this->updateID();
this->queueLayout();
if (!this->isVisible() && !this->scrollBar_->isVisible())
{
// If we're not visible and the scrollbar is not (yet) visible,
// we need to make sure that it's at the bottom when this view is laid
// out later.
this->scrollBar_->scrollToBottom();
}
this->queueUpdate();
// Notifications