From 6d69a78a0572181348474f5cd905d4239eec09f2 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 24 Jul 2023 17:51:22 +0300 Subject: [PATCH] Fixed width updating of message field with hidden right buttons. --- .../SourceFiles/history/history_widget.cpp | 37 +++++++++++++++---- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 321c1227c1..cc9e0d0e49 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -2848,14 +2848,35 @@ void HistoryWidget::updateControlsVisibility() { if (_botMenuButton) { _botMenuButton->show(); } - if (_silent) { - _silent->setVisible(!_editMsgId); - } - if (_scheduled) { - _scheduled->setVisible(!_editMsgId); - } - if (_ttlInfo) { - _ttlInfo->setVisible(!_editMsgId); + { + auto rightButtonsChanged = false; + if (_silent) { + const auto was = _silent->isVisible(); + const auto now = (!_editMsgId); + if (was != now) { + _silent->setVisible(now); + rightButtonsChanged = true; + } + } + if (_scheduled) { + const auto was = _scheduled->isVisible(); + const auto now = (!_editMsgId); + if (was != now) { + _scheduled->setVisible(now); + rightButtonsChanged = true; + } + } + if (_ttlInfo) { + const auto was = _ttlInfo->isVisible(); + const auto now = (!_editMsgId); + if (was != now) { + _ttlInfo->setVisible(now); + rightButtonsChanged = true; + } + } + if (rightButtonsChanged) { + updateFieldSize(); + } } if (_sendAs) { _sendAs->show();