Fixed emoji display in reply markup button from bar for pinned messages.

This commit is contained in:
23rd 2024-06-02 23:07:36 +03:00
parent 47ce34e987
commit 9c83b8bac5
2 changed files with 25 additions and 6 deletions

View File

@ -930,7 +930,12 @@ historyPinnedBotButton: RoundButton(defaultActiveButton) {
textTop: 6px;
padding: margins(2px, 10px, 10px, 9px);
}
historyPinnedBotButtonMaxWidth: 150px;
historyPinnedBotLabel: FlatLabel(defaultFlatLabel) {
style: semiboldTextStyle;
align: align(center);
maxHeight: 30px;
}
historyPinnedBotButtonMaxWidth: 120px;
historyToDownPosition: point(12px, 10px);
historyToDownAbove: icon {{ "history_down_arrow", historyToDownFg }};

View File

@ -7249,10 +7249,27 @@ void HistoryWidget::refreshPinnedBarButton(bool many, HistoryItem *item) {
if ((rows.size() == 1) && (rows.front().size() == 1)) {
const auto text = rows.front().front().text;
if (!text.isEmpty()) {
const auto &st = st::historyPinnedBotButton;
auto button = object_ptr<Ui::RoundButton>(
this,
rpl::single(text),
st::historyPinnedBotButton);
rpl::never<QString>(),
st);
const auto label = Ui::CreateChild<Ui::FlatLabel>(
button.data(),
text,
st::historyPinnedBotLabel);
if (label->width() > st::historyPinnedBotButtonMaxWidth) {
label->resizeToWidth(st::historyPinnedBotButtonMaxWidth);
}
button->setFullWidth(label->width()
+ st.padding.left()
+ st.padding.right()
+ st.height);
label->moveToLeft(
st.padding.left() + st.height / 2,
(button->height() - label->height()) / 2);
label->setTextColorOverride(st.textFg->c);
label->setAttribute(Qt::WA_TransparentForMouseEvents);
button->setTextTransform(
Ui::RoundButton::TextTransform::NoTransform);
button->setFullRadius(true);
@ -7262,9 +7279,6 @@ void HistoryWidget::refreshPinnedBarButton(bool many, HistoryItem *item) {
0,
0);
});
if (button->width() > st::historyPinnedBotButtonMaxWidth) {
button->setFullWidth(st::historyPinnedBotButtonMaxWidth);
}
struct State {
base::unique_qptr<Ui::PopupMenu> menu;
};