Support system text replacements on macOS.

This commit is contained in:
John Preston
2026-03-12 18:25:45 +04:00
parent ff54ea88e2
commit af4c7bc754
12 changed files with 64 additions and 15 deletions
@@ -577,7 +577,8 @@ void GroupInfoBox::prepare() {
_title->setMaxLength(Ui::EditPeer::kMaxGroupChannelTitle);
_title->setInstantReplaces(Ui::InstantReplaces::Default());
_title->setInstantReplacesEnabled(
Core::App().settings().replaceEmojiValue());
Core::App().settings().replaceEmojiValue(),
Core::App().settings().systemTextReplaceValue());
Ui::Emoji::SuggestionsController::Init(
getDelegate()->outerContainer(),
_title,
@@ -593,7 +594,8 @@ void GroupInfoBox::prepare() {
_description->setMaxLength(Ui::EditPeer::kMaxChannelDescription);
_description->setInstantReplaces(Ui::InstantReplaces::Default());
_description->setInstantReplacesEnabled(
Core::App().settings().replaceEmojiValue());
Core::App().settings().replaceEmojiValue(),
Core::App().settings().systemTextReplaceValue());
_description->setSubmitSettings(
Core::App().settings().sendSubmitWay());
@@ -177,7 +177,8 @@ void InitField(
not_null<Main::Session*> session) {
field->setInstantReplaces(Ui::InstantReplaces::Default());
field->setInstantReplacesEnabled(
Core::App().settings().replaceEmojiValue());
Core::App().settings().replaceEmojiValue(),
Core::App().settings().systemTextReplaceValue());
auto options = Ui::Emoji::SuggestionsController::Options();
options.suggestExactFirstWord = false;
Ui::Emoji::SuggestionsController::Init(
@@ -954,7 +955,8 @@ not_null<Ui::InputField*> CreatePollBox::setupSolution(
solution->setMaxLength(kSolutionLimit + kErrorLimit);
solution->setInstantReplaces(Ui::InstantReplaces::Default());
solution->setInstantReplacesEnabled(
Core::App().settings().replaceEmojiValue());
Core::App().settings().replaceEmojiValue(),
Core::App().settings().systemTextReplaceValue());
solution->setMarkdownReplacesEnabled(rpl::single(
Ui::MarkdownEnabledState{ Ui::MarkdownEnabled{ {
Ui::InputField::kTagBold,
@@ -185,7 +185,8 @@ void InitField(
not_null<Main::Session*> session) {
field->setInstantReplaces(Ui::InstantReplaces::Default());
field->setInstantReplacesEnabled(
Core::App().settings().replaceEmojiValue());
Core::App().settings().replaceEmojiValue(),
Core::App().settings().systemTextReplaceValue());
auto options = Ui::Emoji::SuggestionsController::Options();
options.suggestExactFirstWord = false;
Ui::Emoji::SuggestionsController::Init(
@@ -662,7 +662,8 @@ object_ptr<Ui::RpWidget> Controller::createTitleEdit() {
result->entity()->setMaxLength(Ui::EditPeer::kMaxGroupChannelTitle);
result->entity()->setInstantReplaces(Ui::InstantReplaces::Default());
result->entity()->setInstantReplacesEnabled(
Core::App().settings().replaceEmojiValue());
Core::App().settings().replaceEmojiValue(),
Core::App().settings().systemTextReplaceValue());
Ui::Emoji::SuggestionsController::Init(
_wrap->window(),
result->entity(),
@@ -770,7 +771,8 @@ object_ptr<Ui::RpWidget> Controller::createDescriptionEdit() {
result->entity()->setMaxLength(Ui::EditPeer::kMaxChannelDescription);
result->entity()->setInstantReplaces(Ui::InstantReplaces::Default());
result->entity()->setInstantReplacesEnabled(
Core::App().settings().replaceEmojiValue());
Core::App().settings().replaceEmojiValue(),
Core::App().settings().systemTextReplaceValue());
result->entity()->setSubmitSettings(
Core::App().settings().sendSubmitWay());
Ui::Emoji::SuggestionsController::Init(