Repository navigation
compose: Insert uploaded file link on its own line, matching web. - #2451
Open
ibrahim-iqbal wants to merge 1 commit into
Open
ibrahim-iqbal wants to merge 1 commit into
ibrahim-iqbal wants to merge 1 commit into
Conversation
ibrahim-iqbal
force-pushed
the
compose-upload-link-padding
branch
from
September 16, 2026 11:50
882f79b to
a4869c5
Compare
ibrahim-iqbal
force-pushed
the
compose-upload-link-padding
branch
from
November 2, 2026 13:00
563eea5 to
0b0f764
Compare
Collaborator
|
Thanks for this @ibrahim-iqbal!
|
Previously, registerUploadStart inserted an uploaded file's link placeholder at the cursor with no leading whitespace and two trailing newlines, so a placeholder would land in the middle of whatever the user had already typed on that line and push an extra blank line after itself. Match zulip-web's shape instead: one leading newline when the insertion point isn't already at the start of a line, and a single trailing newline. The link ends up on its own line and the compose box does not accumulate blank lines between consecutive uploads. The widget tests in test/widgets/compose_box_test.dart exercise every entry point (media library on Android and iOS, camera, keyboard attach, file picker); their expected strings are updated for the new shape, and a new case covers an insertion point that is already at the start of a line. Fixes: zulip#2227
ibrahim-iqbal
force-pushed
the
compose-upload-link-padding
branch
from
November 14, 2026 16:54
682b5f4 to
76d064c
Compare
Author
|
Thanks @Ruhdee, done:
The branch is now a single commit; the code and tests are unchanged. |
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.
Fixes #2227.
Previously,
ComposeContentController.registerUploadStartinlib/widgets/compose_box.dartinserted an uploaded file's link placeholder at the cursor with no leading whitespace and two trailing newlines, so a placeholder would land in the middle of whatever the user had already typed on that line and push an extra blank line after itself. That does not match zulip-web, which puts the link on its own line with a single trailing newline.Change: compute a
paddingBeforefrom the text before the insertion point — empty when the cursor is already at the start of a line (or in an empty buffer), one newline otherwise — and use a single trailing newline instead of two.Sample text
see image:followed by an upload now becomes:instead of
The existing widget tests in
test/widgets/compose_box_test.dartundergroup('uploads', ...)exercise every entry point (media library on Android and iOS, camera, keyboard attach, file picker, non-ASCII filename), so their expected strings are updated in the same commit and pin the new shape.Notes
[...](...)#2227 has been dormant since 2026-03-18 and zulip-flutter'sREADME.md(via zulip.readthedocs.io) allows taking over abandoned work. Happy to hand it back if @Prince2347X is still on it.flutter testis blocked on this Mac by the Xcode license gate (objective_cplugin's build hook shells out toxcrun --show-sdk-path), so I've relied onflutter analyzelocally (clean on both touched files) and am counting on CI for the widget-test run.insertPaddedsemantics are untouched (that helper still adds the empty-line-before-and-after padding quote-and-reply blocks want); only the direct call site for uploads is updated.