fix(input): address list-state review feedback from upstream #545#1
Merged
hsource merged 1 commit intoJul 19, 2026
Merged
Conversation
- clamp list depth into [0, kENRMMaxListDepth] in the iOS parser and in ENRMBlockStore's metadata pass so deep markdown nesting can't over-index the ordinal counters - mirror input list markers for RTL paragraphs on iOS (bullet position and ".N" ordered labels, matching the readonly ListMarkerDrawer) and flip Android's input ordered marker to ".N" when dir < 0 - normalize the block store after newline continuation so continued ordered items renumber instead of sticking at "1." - changeListDepthBy: indents/outdents every selected paragraph (one range per line), mirroring Android's forEachSelectedLine - toggling unordered <-> ordered keeps each line's nesting depth (both platforms) - strip the empty-list-line ZWSP anchor from Android's onChangeText payload - replace the per-keystroke O(document) line-count scan with O(edit-size) newline detection over the inserted/replaced runs (Android's editTouchedNewline approach); _lastLineCount is gone entirely, which also removes the stale-count reformat after importMarkdown/pasteMarkdown - docs: rename "Bullet Lists" to "Lists", note items are single-line (loose items keep only their first line), listItemSpacing covers both list types - e2e: add ordered-list (continuation + indent/outdent renumbering) and UL<->OL toggle (depth kept) input flows - fix "two spaces" -> "three spaces" comment nit Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What/Why?
Addresses @hryhoriiK97's review comments on software-mansion#545, targeting this fork's
feat/list-5-stateso the fixes ride along with the upstream PR.Per-comment breakdown:
recomputeListMetadata/ iOS parser) —ENRMInputParsernow capslistContainerStack.size() - 1atkENRMMaxListDepth(matching Android's parser), andrecomputeListMetadatacoerces levels into[0, kENRMMaxListDepth]before ancestry-clamping, so a deeply nested document can never over-index the ordinal counter arrays.ENRMInputLayoutManagernow resolves each list line's direction from its paragraph style (ENRMParagraphIsRTL, same as the readonlyListMarkerDrawer) and mirrors the marker to the trailing edge, flipping ordered labels to".N". Empty list lines (attribute-less) get the direction from a newemptyBulletRTLproperty the orchestrator resolves from the writing-direction mode. Android'sInputOrderedListMarkerSpannow draws".N"left-aligned whendir < 0, matching the readonlyOrderedListSpan.1.after Enter —handleTextChangedre-runsnormalizeToLineBoundsInText:right afterreconcileBlockContinuationAfterNewlineAt:, so the freshly re-seeded block ranges get renumbered by the metadata pass.changeListDepthBy:multi-line selections — now enumerates the selected paragraphs and sets one range per line (each clamped from its own depth), mirroring Android'sforEachSelectedLine; normalize can no longer drop list state from the other selected items.InputEventEmitter.emitChangeTextstrips the empty-list-line ZWSP anchor from theonChangeTextpayload (the markdown serializer already did).toggleBlockType:(iOS) andtoggleListType(Android) look up the line's existing list block and reuse its level when replacing the other list type, per line.listItemSpacingwording covers both list types.ordered_list_test.yaml(ordered items, Return continuation, indent → renumber, outdent → renumber back) andlist_toggle_test.yaml(UL → indent → toggle to OL keeping depth), both taggedsmoke.editTouchedNewlineapproach: the inserted run is scanned in the post-edit text and the replaced run is captured inshouldChangeTextInRange(both O(edit size))._lastLineCountis gone entirely, which also resolves the "initialize_lastLineCountafter import/paste" nit — there is no cached count left to go stale.ENRMUnorderedListBlockHandler.h.Screenshot baselines still needed
I couldn't run the example apps in this environment, so three baselines need an
UPDATE_SCREENSHOTS=truecapture run on device/CI:enrichedMarkdownInput/screenshots/android/unordered_list_input.png(requested in review)ordered_list_inputandlist_toggle_inputfor both platforms (new flows)Testing
yarn lint-clang:iospasses../gradlew :react-native-enriched-markdown:ktlintCheckand:compileDebugKotlinpass.ReactNativeEnrichedMarkdownscheme) builds for the simulator.🤖 Generated with Claude Code