From 90d2021f4d310ae045b5f4d00b51ae5d12b04384 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 8 Aug 2022 18:28:36 +0300 Subject: [PATCH] Jump to keyboard top on FullMsgId change. --- Telegram/SourceFiles/history/history_widget.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index a0f7d240a..7606fec3c 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -5719,8 +5719,9 @@ void HistoryWidget::updateBotKeyboard(History *h, bool force) { return; } - bool changed = false; - bool wasVisible = _kbShown || _kbReplyTo; + const auto wasVisible = _kbShown || _kbReplyTo; + const auto wasMsgId = _keyboard->forMsgId(); + auto changed = false; if ((_replyToId && !_replyEditMsg) || _editMsgId || !_history) { changed = _keyboard->updateMarkup(nullptr, force); } else if (_replyToId && _replyEditMsg) { @@ -5736,6 +5737,8 @@ void HistoryWidget::updateBotKeyboard(History *h, bool force) { updateCmdStartShown(); if (!changed) { return; + } else if (_keyboard->forMsgId() != wasMsgId) { + _kbScroll->scrollTo({ 0, 0 }); } bool hasMarkup = _keyboard->hasMarkup(), forceReply = _keyboard->forceReply() && (!_replyToId || !_replyEditMsg);