diff --git a/Telegram/SourceFiles/data/data_drafts.cpp b/Telegram/SourceFiles/data/data_drafts.cpp index e0ebb7741..1bd7135e8 100644 --- a/Telegram/SourceFiles/data/data_drafts.cpp +++ b/Telegram/SourceFiles/data/data_drafts.cpp @@ -129,9 +129,12 @@ void ClearPeerCloudDraft( history->applyCloudDraft(topicRootId); } -void SetChatLinkDraft( - not_null peer, - const TextWithEntities &draft) { +void SetChatLinkDraft(not_null peer, TextWithEntities draft) { + static const auto kInlineStart = QRegularExpression("^@[a-zA-Z0-9_]"); + if (kInlineStart.match(draft.text).hasMatch()) { + draft = TextWithEntities().append(' ').append(std::move(draft)); + } + const auto textWithTags = TextWithTags{ draft.text, TextUtilities::ConvertEntitiesToTextTags(draft.entities) diff --git a/Telegram/SourceFiles/data/data_drafts.h b/Telegram/SourceFiles/data/data_drafts.h index 581acaeea..1330995ed 100644 --- a/Telegram/SourceFiles/data/data_drafts.h +++ b/Telegram/SourceFiles/data/data_drafts.h @@ -205,8 +205,6 @@ using HistoryDrafts = base::flat_map>; && (a->webpage == b->webpage); } -void SetChatLinkDraft( - not_null peer, - const TextWithEntities &draft); +void SetChatLinkDraft(not_null peer, TextWithEntities draft); } // namespace Data