diff --git a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp index ed62d77e8..5780a1211 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp @@ -921,11 +921,19 @@ void DialogsWidget::updateJumpToDateVisibility(bool fast) { } void DialogsWidget::updateSearchFromVisibility(bool fast) { - auto searchFromUserVisible = _searchInPeer && (_searchInPeer->isChat() || _searchInPeer->isMegagroup()) && !_searchFromUser; + auto visible = _searchInPeer && (_searchInPeer->isChat() || _searchInPeer->isMegagroup()) && !_searchFromUser; + auto changed = (visible == _chooseFromUser->isHiddenOrHiding()); if (fast) { - _chooseFromUser->toggleFast(searchFromUserVisible); + _chooseFromUser->toggleFast(visible); } else { - _chooseFromUser->toggleAnimated(searchFromUserVisible); + _chooseFromUser->toggleAnimated(visible); + } + if (changed) { + auto margins = st::dialogsFilter.textMrg; + if (visible) { + margins.setRight(margins.right() + _chooseFromUser->width()); + } + _filter->setTextMrg(margins); } } diff --git a/Telegram/SourceFiles/ui/widgets/input_fields.cpp b/Telegram/SourceFiles/ui/widgets/input_fields.cpp index c3f1297c8..13ad489d5 100644 --- a/Telegram/SourceFiles/ui/widgets/input_fields.cpp +++ b/Telegram/SourceFiles/ui/widgets/input_fields.cpp @@ -1470,7 +1470,8 @@ FlatInput::FlatInput(QWidget *parent, const style::FlatInput &st, base::lambda placeholderFactory) { } void FlatInput::refreshPlaceholder() { - auto availw = width() - _st.textMrg.left() - _st.textMrg.right() - _st.phPos.x() - 1; + auto availw = width() - _textMrg.left() - _textMrg.right() - _st.phPos.x() - 1; auto placeholderText = _placeholderFactory ? _placeholderFactory() : QString(); if (_st.font->width(placeholderText) > availw) { _placeholder = _st.font->elided(placeholderText, availw); @@ -1683,7 +1690,7 @@ void FlatInput::inputMethodEvent(QInputMethodEvent *e) { } QRect FlatInput::placeholderRect() const { - return QRect(_st.textMrg.left() + _st.phPos.x(), _st.textMrg.top() + _st.phPos.y(), width() - _st.textMrg.left() - _st.textMrg.right(), height() - _st.textMrg.top() - _st.textMrg.bottom()); + return QRect(_textMrg.left() + _st.phPos.x(), _textMrg.top() + _st.phPos.y(), width() - _textMrg.left() - _textMrg.right(), height() - _textMrg.top() - _textMrg.bottom()); } void FlatInput::correctValue(const QString &was, QString &now) { diff --git a/Telegram/SourceFiles/ui/widgets/input_fields.h b/Telegram/SourceFiles/ui/widgets/input_fields.h index 1576fbb33..49f0d40f0 100644 --- a/Telegram/SourceFiles/ui/widgets/input_fields.h +++ b/Telegram/SourceFiles/ui/widgets/input_fields.h @@ -243,6 +243,7 @@ public: void setPlaceholder(base::lambda placeholderFactory); QRect placeholderRect() const; + void setTextMrg(const QMargins &textMrg); QRect getTextRect() const; QSize sizeHint() const override; @@ -302,6 +303,7 @@ private: bool _lastPreEditTextNotEmpty = false; const style::FlatInput &_st; + QMargins _textMrg; QTimer _touchTimer; bool _touchPress, _touchRightButton, _touchMove;