From 4802d368f83c948a7dd4e0d64bc0b64cec09f994 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 1 Jul 2026 16:05:34 +0400 Subject: [PATCH] Fix crash typing in Create with AI prompt --- Telegram/SourceFiles/boxes/create_ai_box.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Telegram/SourceFiles/boxes/create_ai_box.cpp b/Telegram/SourceFiles/boxes/create_ai_box.cpp index 8acf6d0f71..367ac532b3 100644 --- a/Telegram/SourceFiles/boxes/create_ai_box.cpp +++ b/Telegram/SourceFiles/boxes/create_ai_box.cpp @@ -368,14 +368,17 @@ void CreateAiBox(not_null box, CreateAiBoxArgs &&args) { 1024)); state->prompt = prompt; - const auto promptPlaceholder = AddAiComposeFieldDecor( + AddAiComposeFieldDecor( prompt, tr::lng_ai_compose_create_placeholder()); - promptPlaceholder->heightValue( - ) | rpl::on_next([=](int phHeight) { - const auto pad = st::aiToneFieldPadding; - prompt->setMinHeight(phHeight + pad.top() + pad.bottom()); - }, prompt->lifetime()); + + // The prompt is pinned to the top of the box, so a text-driven auto-grow + // would resize the pinned content and re-enter the box layout during a + // text-change event (which crashes). Keep the island at a fixed tall + // height and let long prompts scroll inside it instead of growing. + const auto promptHeight = st::aiTonePromptField.heightMin; + prompt->setMinHeight(promptHeight); + prompt->setMaxHeight(promptHeight); const auto chooseLanguage = [=] { box->uiShow()->showBox(Box([=](not_null chooser) {