mirror of https://github.com/procxx/kepka.git
Fix media caption line breaks in MediaView.
This commit is contained in:
parent
5964261db5
commit
af165115f8
|
@ -1202,7 +1202,15 @@ void MediaView::displayPhoto(PhotoData *photo, HistoryItem *item) {
|
||||||
_caption = Text();
|
_caption = Text();
|
||||||
if (auto itemMsg = item ? item->toHistoryMessage() : nullptr) {
|
if (auto itemMsg = item ? item->toHistoryMessage() : nullptr) {
|
||||||
if (auto photoMsg = dynamic_cast<HistoryPhoto*>(itemMsg->getMedia())) {
|
if (auto photoMsg = dynamic_cast<HistoryPhoto*>(itemMsg->getMedia())) {
|
||||||
_caption.setMarkedText(st::mediaviewCaptionStyle, photoMsg->getCaption(), (item->author()->isUser() && item->author()->asUser()->botInfo) ? _captionBotOptions : _captionTextOptions);
|
auto asBot = (item->author()->isUser()
|
||||||
|
&& item->author()->asUser()->botInfo);
|
||||||
|
auto skipw = qMax(_dateNav.left() + _dateNav.width(), _headerNav.left() + _headerNav.width());
|
||||||
|
auto maxw = qMin(qMax(width() - 2 * skipw - st::mediaviewCaptionPadding.left() - st::mediaviewCaptionPadding.right() - 2 * st::mediaviewCaptionMargin.width(), int(st::msgMinWidth)), _caption.maxWidth());
|
||||||
|
_caption = Text(maxw);
|
||||||
|
_caption.setMarkedText(
|
||||||
|
st::mediaviewCaptionStyle,
|
||||||
|
photoMsg->getCaption(),
|
||||||
|
asBot ? _captionBotOptions : _captionTextOptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue