Repository navigation
fix(chat): remove inter-tile spacing in custom emoji collages - #225
Conversation
iebb
left a comment
There was a problem hiding this comment.
Reviewed 98c5aac against current master f311e34. The current PR-body update only corrects diff statistics; no source or head change. Independently replayed the new geometry tests on unchanged master: MessageBubble has the 1px horizontal gap and TelegramRichText the 2.25px vertical gap; both fail before the fix and pass after it. All 66 focused collage, spoiler, source-offset/desktop quote, rich-text scaling, and swipe tests pass. The change removes wrapper spacing and corrects the owned emoji/paragraph metrics without adding component/icon assets.
Independently reviewed the actual production diff and affected entry points. The completed contribution template is present; classification is compliant/unchanged, with no Section 1.4 feature or required exception guard. No authentication, protocol/native, storage-schema, release/deployment, or official-build flag path changes. Credential-free snapshots use secrets_example.dart only. The combined intended master tree 6202d9cf8812ed9ca91a39422039a4cfbcee0102 passes all 3,449 unit/widget tests (one existing skip), formatting of 999 files with zero changes, full analysis, 8 locales x 3830 keys / 9 generated locale assets, visible-string and registration checks, and explicit false/true/invalid build-flag tests. Current exact-head Quality is green. Platform evidence here is shared Flutter layout/navigation/selection testing, not native-device QA; no Telegram, real account, deployment, or store action was used.
Change
Fix extra horizontal and vertical gaps between consecutive custom (premium) emoji tiles in message text and rich text surfaces so multi-emoji collages/banners (such as bandage/sticker-grid combinations) render seamlessly without visual splitting (all platforms):
lib/chat/message_bubble.dart:Padding(padding: EdgeInsets.symmetric(horizontal: 0.5))wrapper aroundSelectableCustomEmojiViewin_textSegmentSpans, which previously injected a1pxhorizontal gap between every adjacent custom emoji.math.max(20, (fontSize * 1.15).roundToDouble())) soPlaceholderAlignment.middlebaseline positioning does not suffer from fractional half-pixel rounding drift against integer font metrics.height: 1.0andTextHeightBehavior(applyHeightToFirstAscent: false, applyHeightToLastDescent: false, leadingDistribution: TextLeadingDistribution.even)on theRichTextso multi-row custom emoji collages stack flush vertically without extra font ascent/descent leading gaps.lib/chat/telegram_rich_text.dart:math.max(20, (ambientScaler.scale(rawFontSize) * 1.15).roundToDouble())), invalidate_spanCachewhenMediaQuery.textScalerOf(context)changes, and apply the same tight line-height +TextHeightBehaviorwhen custom emoji entities are present so channel/topic posts, Moments, and album captions render custom emoji collages seamlessly too.lib/chat/custom_emoji.dart:textScaler: TextScaler.noScalingon the transparent selection-fallbackTextinsideSelectableCustomEmojiViewso ambient text scaling cannot double-scale the hidden fallback paragraph beyond its pre-scaledsizebox.Telegram API Terms classification
Follow the contribution and agentic review rules. Select exactly one classification and explain it below.
This is an agentic source-code review classification. Every store version must remain compliant with applicable Telegram API Terms; the guarded-source exception does not apply to store distribution or review.
allowTelegramTosViolations(I_DONT_FUCKING_CARE_ABOUT_TOS), disabled in official builds, and available only in an explicitly enabled self-build.Reason and affected Telegram behavior:
Pure client-side text/emoji layout fix for
textEntityTypeCustomEmojiWidgetSpanrendering. It does not affect Telegram protocol behavior or any Section 1.4 functionality.Basic checks (every PR)
Check each item after verification. If a check is inapplicable, explain why in the evidence below before checking it.
dart format --output=none --set-exit-if-changed lib test integration_test test_driver.flutter analyze.flutter test --concurrency=4.Commands, results, platform/build/UI evidence, and reasons for inapplicable checks:
git show --stat HEAD@98c5aac4):lib/chat/custom_emoji.dart(+1/-0),lib/chat/message_bubble.dart(+27/-11),lib/chat/telegram_rich_text.dart(+34/-6),test/telegram_rich_text_test.dart(+148/-0).~/.cache/dart3122/bin/dart format --output=none --set-exit-if-changed lib/chat/custom_emoji.dart lib/chat/message_bubble.dart lib/chat/telegram_rich_text.dart test/telegram_rich_text_test.dart→Formatted 4 files (0 changed)./tmp/flutter-3.44.2/bin/flutter analyze lib/chat/custom_emoji.dart lib/chat/message_bubble.dart lib/chat/telegram_rich_text.dart test/telegram_rich_text_test.dart→No issues found!.1.0pxhorizontal gap and2.25pxvertical gap; all 33 tests acrosstelegram_rich_text_test.dartandmessage_bubble_swipe_reply_test.dartand 32 indesktop_message_quote_test.dart+rich_text_text_scaler_test.dartpass with the fix):/tmp/flutter-3.44.2/bin/flutter test --no-pub -j 1 test/telegram_rich_text_test.dart test/message_bubble_swipe_reply_test.dart→00:15 +33: All tests passed!./tmp/flutter-3.44.2/bin/flutter test --no-pub -j 1 test/rich_text_text_scaler_test.dart test/desktop_message_quote_test.dart→All tests passed!.New test cases in
test/telegram_rich_text_test.dart:MessageBubble lays out consecutive custom emoji collages flush horizontally and verticallyTelegramRichText lays out consecutive custom emoji collages flush horizontally and verticallypython3 tool/check_l10n_strings.py→No visible UI string literals outside lib/l10n.python3 translations/tools/check.py→8 locales x 3829 keys (11 counted): OKpython3 translations/tools/gen_assets.py --check→9 locale assets are up to datepython3 tool/gen_registration_anchors.py --check→ passed (exit 0).Section 1.4 exception checks
Complete every item for an exception. For a compliant/unchanged PR, write
Not applicablehere.Not applicable
--dart-define=I_DONT_FUCKING_CARE_ABOUT_TOS=false, the feature is absent and ordinary Telegram behavior remains intact.--dart-define=I_DONT_FUCKING_CARE_ABOUT_TOS=true, the feature works through the guarded entry points in a self-build; I included relevant test and build/UI evidence.falseand have no option that enables it. All store versions remain compliant with applicable Telegram API Terms.Guard locations and evidence for each flag variant:
Not applicable
Agentic reviewer confirmation
Agentic code reviewer only: record this confirmation in the PR review or check these boxes before approval.