Skip to content

Snap the composer to its new height when a line is added or removed - #156

Merged
Tarquinen merged 1 commit into
devfrom
composer-line-growth-smooth
Nov 18, 2026
Merged

Tarquinen merged 1 commit into
devfrom
composer-line-growth-smooth

Conversation

@Tarquinen

@Tarquinen Tarquinen commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

When a line is added to or removed from the session composer, the card now takes its new height at once, with card and text moving in the same frame, as a standard Android text field does. On dev the field takes its new height at once but the card grows over about 0.3 s, so the card's top edge cuts off the top line for several frames. On a shrink, the text drops before the card does.

The card's animateContentSize is replaced by a small size animation of the same shape (composerCardHeight) so that line changes can be left out of it. Stock animateContentSize only sees the card's total height while measuring, so it can't tell a line change from any other size change. The new modifier reads the input's height in the same measure pass and animates only the rest of the card's height.

Different from dev: line changes no longer animate. Everything else animates as before, with the same springs: adding and removing attachments, the autocomplete list opening and closing, and the send reset (SEND_RESET_SLIDE). Nothing animates under Reduce Motion or during the keyboard morph.

before-after.mp4

Frame by frame, from real-speed emulator recordings (720×1600). Columns: card top edge / first line's ink, and the gap between them. A gap of 3 means the top line is cut off.

dev (263cb62) This PR
Growth (2 → 3 lines, typing at the end) 11.557 s: 795 / 822 (27)
11.605: 795 / 798 (3)
11.696: 781 / 784 (3)
11.761: 763 / 781 (18)
11.817: 757 / 781 (24)
11.875: 755 / 781 (26), settled after ~0.27 s
8.254 s: 795 / 822 (27)
8.297: 755 / 781 (26), first changed frame; the typed word is visible
8.339: 755 / 781 (26)
8.356: 755 / 781 (26)
Shrink (4 → 3 lines, deleting from the end) 35.558 s: 714 / 741 (27)
35.608: 714 / 781 (67)
35.711: 729 / 781 (52)
35.764: 743 / 781 (38)
35.817: 750 / 781 (31)
36.014: 755 / 781 (26), settled after ~0.4 s
29.536 s: 714 / 741 (27)
29.576: 755 / 781 (26), first changed frame
29.615: 755 / 781 (26)
29.660: 755 / 781 (26)

The gap also stayed constant, and the typed text was in place in the first changed frame, for Return, typing with the caret on line 1, deleting on line 1, pasting into an empty field, pasting into a one-line draft, and cutting all. Dark mode at font scale 1.3 gives the same result (gap 28–29 on every change; dev drops to 4).

Checked on the emulator against dev: everything above, plus fast typing across several lines; max height (the card doesn't move and the text scrolls); scrolling the capped draft; adding an image and removing it (animates as on dev); sending a 3-line draft (the send reset matches dev frame for frame); closing and opening the keyboard with a 3-line draft; Quote; inserting an @ chip (the autocomplete list folds away as on dev); a restored 3-line draft after relaunch (full height in its first frame, no growth from zero); rotating to landscape and back; Reduce Motion (every change lands in one frame). scripts/check.sh passes.

Not tested: dictation text arriving, Share into the composer, adding an attachment in the same frame as a line wrap (I couldn't time it with adb), and a real phone.

A line added or removed in the session composer now changes the card's
height at once, card and text in the same frame, as a standard Android
text field does. Before, the field took its new height at once while the
card's animateContentSize grew over ~0.3 s, so the top line was cut off by
the card's edge for several frames (and the text dropped before the card
on a shrink).

The card's animateContentSize is replaced by composerCardHeight, a size
animation of the same shape (same springs, bottom-anchored, clipped, off
under Reduce Motion and during the keyboard morph, SEND_RESET_SLIDE during
the send reset). It reads the input region's height from the same measure
pass and leaves the input's own growth out of the animation, so attachments,
autocomplete and the send reset still animate as before. Stock
animateContentSize only sees the card's total height while measuring, so it
can't tell a line change from any other size change. Removes the input
region's animateContentSize(TopStart) from the earlier slide version.

Verified on the emulator against origin/dev (263cb62), frame by frame from
real-speed recordings: wraps, Return, caret on line 1, deleting from line 1
and the end, paste into empty and one-line drafts, max height and scrolling,
attachments added and removed, send reset, keyboard close/open, Quote, @ chip,
restored draft after relaunch, rotation, Reduce Motion, dark mode with font
scale 1.3. scripts/check.sh (vm.sh check) passes.
@Tarquinen
Tarquinen force-pushed the composer-line-growth-smooth branch from c1074ee to 4b8dee7 Compare November 18, 2026 20:05
@Tarquinen Tarquinen changed the title Move composer text with the card's top edge when a line is added or removed Snap the composer to its new height when a line is added or removed Nov 18, 2026
@Tarquinen
Tarquinen merged commit 1253274 into dev Nov 18, 2026
3 checks passed
@Tarquinen
Tarquinen deleted the composer-line-growth-smooth branch November 18, 2026 22:55

This branch was previously deployed

1 inactive deployment
release — 4b8dee73 Deployed Nov 18, 2026 by Tarquinen via check #524
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant