Copy correct text for a forwarded reply message.

This commit is contained in:
John Preston 2017-07-18 19:48:10 +03:00
parent 7c6bb132ce
commit a5e0b19b79
1 changed files with 9 additions and 9 deletions

View File

@ -1288,6 +1288,15 @@ TextWithEntities HistoryMessage::selectedText(TextSelection selection) const {
result.text += qstr("\n\n");
TextUtilities::Append(result, std::move(logEntryOriginalResult));
}
if (auto reply = Get<HistoryMessageReply>()) {
if (selection == FullSelection && reply->replyToMsg) {
TextWithEntities wrapped;
wrapped.text.reserve(lang(lng_in_reply_to).size() + reply->replyToMsg->author()->name.size() + 4 + result.text.size());
wrapped.text.append('[').append(lang(lng_in_reply_to)).append(' ').append(reply->replyToMsg->author()->name).append(qsl("]\n"));
TextUtilities::Append(wrapped, std::move(result));
result = wrapped;
}
}
if (auto forwarded = Get<HistoryMessageForwarded>()) {
if (selection == FullSelection) {
auto fwdinfo = forwarded->_text.originalTextWithEntities(AllTextSelection, ExpandLinksAll);
@ -1301,15 +1310,6 @@ TextWithEntities HistoryMessage::selectedText(TextSelection selection) const {
result = wrapped;
}
}
if (auto reply = Get<HistoryMessageReply>()) {
if (selection == FullSelection && reply->replyToMsg) {
TextWithEntities wrapped;
wrapped.text.reserve(lang(lng_in_reply_to).size() + reply->replyToMsg->author()->name.size() + 4 + result.text.size());
wrapped.text.append('[').append(lang(lng_in_reply_to)).append(' ').append(reply->replyToMsg->author()->name).append(qsl("]\n"));
TextUtilities::Append(wrapped, std::move(result));
result = wrapped;
}
}
return result;
}