diff --git a/Telegram/SourceFiles/data/data_media_types.cpp b/Telegram/SourceFiles/data/data_media_types.cpp index 46b1140f1..709c9d49b 100644 --- a/Telegram/SourceFiles/data/data_media_types.cpp +++ b/Telegram/SourceFiles/data/data_media_types.cpp @@ -100,9 +100,9 @@ struct AlbumCounts { if (caption.text.isEmpty()) { return Ui::Text::Colorized(attachType); } - + auto wrapped = st::wrap_rtl(caption); return hasMiniImages - ? caption + ? wrapped : tr::lng_dialogs_text_media( tr::now, lt_media_part, @@ -112,7 +112,7 @@ struct AlbumCounts { Ui::Text::Colorized(attachType), Ui::Text::WithEntities), lt_caption, - caption, + wrapped, Ui::Text::WithEntities); } diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp index 809a74eaf..2347dd224 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp @@ -663,14 +663,22 @@ void PaintRow( : context.selected ? st::dialogsNameFgOver : st::dialogsNameFg); - rowName.drawElided(p, rectForName.left(), rectForName.top(), rectForName.width()); + rowName.draw(p, { + .position = rectForName.topLeft(), + .availableWidth = rectForName.width(), + .elisionLines = 1, + }); } else if (hiddenSenderInfo) { p.setPen(context.active ? st::dialogsNameFgActive : context.selected ? st::dialogsNameFgOver : st::dialogsNameFg); - hiddenSenderInfo->nameText().drawElided(p, rectForName.left(), rectForName.top(), rectForName.width()); + hiddenSenderInfo->nameText().draw(p, { + .position = rectForName.topLeft(), + .availableWidth = rectForName.width(), + .elisionLines = 1, + }); } else { p.setPen(context.active ? st::dialogsNameFgActive @@ -681,7 +689,11 @@ void PaintRow( : (context.selected ? st::dialogsNameFgOver : st::dialogsNameFg)); - rowName.drawElided(p, rectForName.left(), rectForName.top(), rectForName.width()); + rowName.draw(p, { + .position = rectForName.topLeft(), + .availableWidth = rectForName.width(), + .elisionLines = 1, + }); } } diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 6d89ca456..e0a96d7f6 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -3453,7 +3453,11 @@ ItemPreview HistoryItem::toPreview(ToPreviewOptions options) const { if (_media) { return _media->toPreview(options); } else if (!emptyText()) { - return { .text = options.translated ? translatedText() : _text }; + return { + .text = st::wrap_rtl(options.translated + ? translatedText() + : _text) + }; } return {}; }(); @@ -5509,7 +5513,7 @@ PreparedServiceText HistoryItem::preparePinnedText() { lt_from, fromLinkText(), // Link 1. lt_text, - std::move(original), // Link 2. + st::wrap_rtl(original), // Link 2. Ui::Text::WithEntities); } else { result.text = tr::lng_action_pinned_media( @@ -5756,7 +5760,7 @@ PreparedServiceText HistoryItem::prepareCallScheduledText( } TextWithEntities HistoryItem::fromLinkText() const { - return Ui::Text::Link(_from->name(), 1); + return Ui::Text::Link(st::wrap_rtl(_from->name()), 1); } ClickHandlerPtr HistoryItem::fromLink() const { diff --git a/Telegram/SourceFiles/history/view/history_view_element.cpp b/Telegram/SourceFiles/history/view/history_view_element.cpp index 39d5850aa..d36c32a2c 100644 --- a/Telegram/SourceFiles/history/view/history_view_element.cpp +++ b/Telegram/SourceFiles/history/view/history_view_element.cpp @@ -442,8 +442,8 @@ void ServicePreMessage::paint( .align = style::al_top, .palette = &context.st->serviceTextPalette(), .now = context.now, - //.selection = context.selection, .fullWidthSelection = false, + //.selection = context.selection, }); p.translate(0, -top); diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index 0a4fcded4..482c0b9f8 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -1687,7 +1687,11 @@ void Message::paintFromName( } p.setFont(st::msgNameFont); p.setPen(nameFg); - nameText->drawElided(p, availableLeft, trect.top(), availableWidth); + nameText->draw(p, { + .position = { availableLeft, trect.top() }, + .availableWidth = availableWidth, + .elisionLines = 1, + }); const auto skipWidth = nameText->maxWidth() + (_fromNameStatus ? (st::dialogsPremiumIcon.icon.width() diff --git a/Telegram/SourceFiles/history/view/history_view_service_message.cpp b/Telegram/SourceFiles/history/view/history_view_service_message.cpp index 09fa2b43f..0de40ca7a 100644 --- a/Telegram/SourceFiles/history/view/history_view_service_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_service_message.cpp @@ -570,8 +570,8 @@ void Service::draw(Painter &p, const PaintContext &context) const { .now = context.now, .pausedEmoji = context.paused || On(PowerSaving::kEmojiChat), .pausedSpoiler = context.paused || On(PowerSaving::kChatSpoiler), - .selection = context.selection, .fullWidthSelection = false, + .selection = context.selection, }); } if (mediaDisplayed) { diff --git a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp index 92bd21800..0a241055d 100644 --- a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp @@ -600,11 +600,11 @@ void TopBarWidget::paintTopBar(Painter &p) { const auto namewidth = availableWidth - badgeWidth; p.setPen(st::dialogsNameFg); - _title.drawElided( - p, - nameleft, - nametop, - namewidth); + _title.draw(p, { + .position = { nameleft, nametop }, + .availableWidth = namewidth, + .elisionLines = 1, + }); p.setFont(st::dialogsTextFont); if (!paintConnectingState(p, nameleft, statustop, width()) diff --git a/Telegram/SourceFiles/ui/chat/message_bar.cpp b/Telegram/SourceFiles/ui/chat/message_bar.cpp index c3cf6e113..a5db1bb58 100644 --- a/Telegram/SourceFiles/ui/chat/message_bar.cpp +++ b/Telegram/SourceFiles/ui/chat/message_bar.cpp @@ -438,12 +438,15 @@ void MessageBar::paint(Painter &p) { if (_title.isEmpty()) { // "Loading..." state. p.setPen(st::historyComposeAreaFgService); - _text.drawLeftElided( - p, - body.x(), - body.y() + (body.height() - st::normalFont->height) / 2, - body.width(), - width); + _text.draw(p, { + .position = { + body.x(), + body.y() + (body.height() - st::normalFont->height) / 2, + }, + .outerWidth = width, + .availableWidth = body.width(), + .elisionLines = 1, + }); } else { p.setPen(_st.textFg); _text.draw(p, { diff --git a/Telegram/SourceFiles/ui/text/text_options.cpp b/Telegram/SourceFiles/ui/text/text_options.cpp index 404b53c8b..eeeb28e04 100644 --- a/Telegram/SourceFiles/ui/text/text_options.cpp +++ b/Telegram/SourceFiles/ui/text/text_options.cpp @@ -103,10 +103,6 @@ TextParseOptions WebpageDescriptionOptions = { } // namespace void InitTextOptions() { - HistoryServiceOptions.dir - = TextNameOptions.dir - = TextDialogOptions.dir - = Qt::LeftToRight; TextDialogOptions.maxw = st::columnMaximalWidthLeft * 2; WebpageTitleOptions.maxh = st::webPageTitleFont->height * 2; WebpageTitleOptions.maxw diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 91fa96fb9..9028e288a 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 91fa96fb946a672bfa47361f96af5a675fc9693d +Subproject commit 9028e288afcb9aaa31bfad98a283f30dd30cdca3