Repository navigation
Conversation
Pasting a selection copied from a rich message opens the rich text editor seeded with the fragment, but the text already typed in the message input was not moved into the editor, and closing the editor replaced the input with the editor's content, losing it. Move the composer text into the seeded editor around the pasted fragment at the caret, the same way the attach-menu entry consumes it. Fixes https://bugs.telegram.org/c/66903
f4rceful
marked this pull request as ready for review
November 5, 2026 15:20
Collaborator
Please update this branch against |
Collaborator
|
Issues
|
f4rceful
force-pushed
the
fix/keep-typed-text-when-pasting-rich-fragment
branch
from
November 15, 2026 10:54
1063f28 to
087b939
Compare
Collaborator
|
Issues
|
Collaborator
|
Issues:
The changed files pass the contributor file allowlist. Earlier review details |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Key change
Pasting a selection copied from a rich message opens the rich text editor seeded with that fragment. The text already typed in the message input is now moved into the editor as well, around the pasted fragment at the caret (text before the caret + fragment + text after; a selection is replaced like a normal paste), and the input is cleared — the same way the attach-menu entry consumes the composer text.
Reason
Fixes https://bugs.telegram.org/c/66903.
The paste path (
showRichTextEditor(chatInteraction:seeding:)) opened the editor with only the fragment. On close,onCancel(.plain)replaced the input state with the editor's text, so anything typed before the paste was lost. The attach-menu path (showRichTextEditor(chatInteraction:morphSource:)) didn't have the problem because it moves the composer text into the editor first. When the composer holds a structural rich draft, behavior is unchanged.Video result (before/after)
Before
https://youtu.be/MCSZHGuGn3Q
After
https://youtu.be/wm6tyhSA_zk
Confirmation
Tested on macOS 27.2, Debug build from master @ 5611693, Xcode 27.1 beta (built with the local
scripts/xcode27.shchanges, not committed).