2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Added utility to correctly cut text with commands.

This commit is contained in:
23rd
2021-12-25 17:31:31 +03:00
committed by John Preston
parent 8b74dc2dec
commit c40bcdc446
3 changed files with 11 additions and 3 deletions

View File

@@ -1029,7 +1029,11 @@ QString HistoryItem::notificationText() const {
}();
return (result.size() <= kNotificationTextLimit)
? result
: result.mid(0, kNotificationTextLimit) + qsl("...");
: TextUtilities::CutTextWithCommands(
result,
kNotificationTextLimit,
textcmdStartSpoiler(),
textcmdStopSpoiler());
}
ItemPreview HistoryItem::toPreview(ToPreviewOptions options) const {

View File

@@ -711,7 +711,11 @@ HistoryService::PreparedText HistoryService::preparePinnedText() {
}
}
if (!limit && cutAt + 5 < size) {
original = original.mid(0, cutAt) + qstr("...");
original = TextUtilities::CutTextWithCommands(
std::move(original),
cutAt,
textcmdStartSpoiler(),
textcmdStopSpoiler());
}
result.text = tr::lng_action_pinned_message(tr::now, lt_from, fromLinkText(), lt_text, textcmdLink(2, original));
} else {