cmux NEXT composer: a long paste scrolls to its end, caret after it
A long paste into the composer now scrolls the field to its end, with the caret right after the pasted text, as Claude desktop does.
The prompt field grows to eight lines and then scrolls. Milkdown's clipboard plugin inserts a paste without asking ProseMirror to scroll, so pasting 40 lines into a short draft left the field at the top and the caret out of view. The field now marks a paste that no surface handled itself. A small appendTransaction then adds scrollIntoView to whichever transaction inserts it. The markup-text paste path (HTML or JSX pasted as text) scrolls too.
This is one path in MarkdownField, so it covers every surface that uses it: chat, Quick Composer, sub-sessions and the Chief/Home composer. The shell field is a plain textarea, which already scrolls on paste.
Changelog
- Fixed: A long paste into the composer scrolls to its end, with the caret after it.
Test
webviews/test/composer-paste-end.test.ts (browser lane, Chromium and WebKit): type a 3-line draft, paste 40 lines, then check that the field scrolled, the caret is at the end, and the caret and "pasted line 40" are inside the field's visible box. The test is committed red before the fix (85b0249c53), and the fix is eb2c7d45fe.
Observed / Not run
- Ran:
vp fmton the changed files. - Not run: the test on base or head,
bun run check, and web lint. Agents don't run bun or playwright on this Mac, so CI is the first run. The red-on-base claim comes from reading the code, not from a run.
Agent session: cosmic-gray
🤖 Generated with Claude Code
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Fixes pasting a long text into the composer so the field scrolls to its end, with the caret right after the pasted text.
Milkdown's clipboard plugin inserts a paste without asking ProseMirror to scroll, so pasting 40 lines into a short draft left the field at the top with the caret out of view. MarkdownField now flags a paste that no surface handled, and an appendTransaction adds scrollIntoView to the transaction that inserts it; the markup-text paste path scrolls too. Because the fix lives in MarkdownField, it covers chat, Quick Composer, sub-sessions, and the Chief/Home composer; the shell field is a plain textarea that already scrolls on paste.
Adds a browser test (Chromium and WebKit) that pastes 40 lines into a 3-line draft and verifies the field scrolled, the caret sits at the end, and the caret and last pasted line are in view.