diff --git a/Telegram/SourceFiles/boxes/send_files_box.cpp b/Telegram/SourceFiles/boxes/send_files_box.cpp index 8f14cd89b..c9c4b25b0 100644 --- a/Telegram/SourceFiles/boxes/send_files_box.cpp +++ b/Telegram/SourceFiles/boxes/send_files_box.cpp @@ -260,12 +260,8 @@ SendFilesBox::SendFilesBox( , _sendLimit(peer->slowmodeApplied() ? SendLimit::One : SendLimit::Many) , _sendMenuType(sendMenuType) , _allowEmojiWithoutPremium(Data::AllowEmojiWithoutPremium(peer)) -, _caption( - this, - st::confirmCaptionArea, - Ui::InputField::Mode::MultiLine, - nullptr, - caption) +, _caption(this, st::confirmCaptionArea, Ui::InputField::Mode::MultiLine) +, _prefilledCaptionText(std::move(caption)) , _scroll(this, st::boxScroll) , _inner( _scroll->setOwnedWidget( @@ -688,6 +684,15 @@ void SendFilesBox::setupCaption() { &_controller->session(), { .suggestCustomEmoji = true, .allowCustomWithoutPremium = allow }); + if (!_prefilledCaptionText.text.isEmpty()) { + _caption->setTextWithTags( + _prefilledCaptionText, + Ui::InputField::HistoryAction::Clear); + + auto cursor = _caption->textCursor(); + cursor.movePosition(QTextCursor::End); + _caption->setTextCursor(cursor); + } _caption->setSubmitSettings( Core::App().settings().sendSubmitWay()); _caption->setMaxLength(kMaxMessageLength); diff --git a/Telegram/SourceFiles/boxes/send_files_box.h b/Telegram/SourceFiles/boxes/send_files_box.h index 978e2d34b..944bc9372 100644 --- a/Telegram/SourceFiles/boxes/send_files_box.h +++ b/Telegram/SourceFiles/boxes/send_files_box.h @@ -180,6 +180,7 @@ private: bool _confirmed = false; object_ptr _caption = { nullptr }; + TextWithTags _prefilledCaptionText; object_ptr _emojiToggle = { nullptr }; base::unique_qptr _emojiPanel; base::unique_qptr _emojiFilter;