Skip to content

Port upstream list paste ordering fix#65

Open
Renakoni wants to merge 1 commit into
mainfrom
sync/upstream-4842-list-paste-order
Open

Port upstream list paste ordering fix#65
Renakoni wants to merge 1 commit into
mainfrom
sync/upstream-4842-list-paste-order

Conversation

@Renakoni

@Renakoni Renakoni commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Port upstream MarkText PR #4842 into the Android Muya copy.
  • Keep pasted list items in order when merging a pasted list into the middle of another list.
  • Add regression coverage for bullet and ordered list middle-paste cases.

Upstream Source

Android Relevance

This affects Android's live Muya editor paste behavior. Before this fix, tryMergeListPaste() rebuilt the enclosing list by appending pasted items to the end of the list, even when the cursor was in a middle item. Pasting - Item 1 / - Item 2 / - Item 3 into an empty middle item between Item A and Item B could produce A, Item 1, B, Item 2, Item 3 instead of keeping the pasted sequence together.

Change Details

  • Splice pasted list items immediately after the anchor item instead of pushing them to the end.
  • Extract post-rebuild caret placement into seatListMergeCursor() so the caret lands on the folded paragraph, trailing pasted states, or the last pasted list item as appropriate.
  • Add tests for bullet-list and ordered-list middle paste ordering.
  • Android currently preserves source ordered-list markers during serialization, so the ordered-list regression locks item order while preserving the repo's existing numbering policy.

Verification

  • pnpm --dir third_party/muya exec vitest run src/clipboard/__tests__/pasteListMerge.spec.ts passed.
  • pnpm build passed.
  • Broader clipboard suite command pnpm --dir third_party/muya exec vitest run src/clipboard/__tests__ was also run; it has one pre-existing unrelated failure in cutSelectionToClipboardData.spec.ts where cutSelectionToClipboardData does not delete alpha from alpha beta. The touched paste-list spec passes independently.

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