Repository navigation
fix(muya): keep a Tab-indented list item out of a sublist of the other kind (#5349) - #5354
Merged
Merged
Conversation
Tab nests an item under the previous item and appended it to that item's trailing sublist whenever the sublist was any list, so a task item landed in a bullet or ordered list and a plain item in a task list. Neither list may hold that kind, and reopening the saved markdown gave a different structure. Join the trailing sublist only when it holds the item's kind; otherwise give the item a new list of its own kind after that sublist, the structure the parser builds for the saved markdown. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01KGKDSxyPk9WxU2h5DgPcWn
A list created next to a sublist of the other item kind that uses the same marker is still the same markdown list. It copied the looseness of the list the item came from, so with a loose outer list and a tight sublist the serialized markdown reopened with a different structure. Take the looseness of that sublist instead. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01KGKDSxyPk9WxU2h5DgPcWn
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.
Closes #5349
Summary
Tab nests a list item under the previous item. When that item already ended with a sublist,
ParagraphContent._indentListItem()appended the new item to it whenever it was anyul/ol, without checking the item kind. A task item landed in a bullet or ordered list, or a plain item in a task list. Neither list may hold that kind, later Enter kept adding items of the wrong kind, and reopening the saved markdown gave a different structure. This is the indent direction of #5341 (Shift+Tab, fixed by #5348).Two commits:
fix(muya): give an indented item a list of its own kind. Join the previous item's trailing sublist only when it holds the item's kind; otherwise create a new list of the item's own kind after that sublist, which is the structure the parser builds for the saved markdown. Same-kind sublists and items with no trailing sublist behave as before.fix(muya): match the looseness of a same-marker sublist when indenting. A list created next to a sublist of the other kind that uses the same marker is still the same markdown list, so it takes that sublist's looseness. Without this, a loose outer list with a tight sublist reopened differently.Before / after
Real Chrome (muya e2e host): click at the end of
c, Tab, then typez, Enter,n. Then reopen the saved markdown, and separately undo the Tab.- [ ] a/- b/- [ ] ca{ bullet-list{ b, task c, task n } }, structure changes on reopena{ bullet-list{ b }, task-list{ c, n } }, same on reopen- a/- [ ] b/- ca{ task-list{ b, item c, item n } }, changes on reopena{ task-list{ b }, bullet-list{ c, n } }, same1. a/- [ ] b/2. ca{ task-list{ b, item c } }, reopens withcas a bulleta{ task-list{ b }, order-list{ c, n } }, same- [ ] a/- b/- [x] ctask-list{ [x]c, n }, checked state kept- a/- b/- c(same kind)- [ ] a/- [ ] c(no sublist)No renderer errors and undo restores the document in every case, on both versions. In the built desktop app, the rendered lists after Tab go from
mu-bullet-list[b, task c]tomu-bullet-list[b]+mu-task-list[c], and frommu-task-list[b, item c]tomu-task-list[b]+mu-bullet-list[c].Type of change
Test plan
paragraphContent/__tests__/indentListKind.spec.ts. Each case asserts every list holds only its own item kind and that the state equals what reopening the serialized markdown builds:develop: the 5 different-kind cases fail and the 3 controls pass. The loose-list case also fails with only the first commit's change (checked by removing the looseness rule).vitest run229 files / 1622 tests pass;lint(no new warnings),lint:types,check-circularpass.build:unpack+ Playwright/Electron): the table above.By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.
🤖 Generated with Claude Code
https://claude.ai/code/session_01KGKDSxyPk9WxU2h5DgPcWn