Repository navigation
Conversation
|
Same note as on #1005: this PR and #1005 conflict in the Android list files. The combined resolution we shipped in the pingdotgg fork (pingdotgg#2 and #3) keeps this PR's |
|
#1015 is merged (9fabe82), which carries #1005 plus the review follow-ups, and GitHub now reports this branch as conflicting. Could you rebase onto the latest What changed on
The Android |
|
Thanks for landing this! In the future if PRs are made I'll try to have the source branch be easier to update. |
945e46d to
23a3096
Compare
|
Rebased onto
On the baselines: I used the |
|
Thanks again for this. We can't push to the fork branch, so the work now continues in #1023, which carries your commit unchanged (17188be on top of the current
Both Android packages' unit tests and ktlint pass with the follow-up. This PR can be closed in favour of #1023; the fix and credit are yours. |
* fix(android): align mixed nested list indents with iOS * fix(android): expose the baseline marker column as a property and recapture mixed-list baselines Follow-up to the cherry-picked #1006 commit. `getBaselineMarkerWidth()` becomes `open val baselineMarkerWidth` to match `markerExtraWidth`, and `ListItemRenderer` restores `listItemMarkerWidth` through a `previousMarkerWidth` local like `previousMarkerExtra`. The five Android baselines are recaptured on the Pixel9-API36-EnrichedMarkdown AVD. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Mike Olson <mwolson@member.fsf.org> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
What/Why?
On Android, a nested list whose marker type differs from its parent's gets the
wrong space between marker and text. A numbered list under a bullet draws
1.over the first letters of its items, a task list under a bullet puts its
checkboxes against the text, and bullets under a short
1.sit far from theirtext. The repo's own Android baseline for
mixed_nested_list_testshows it("1Django"); the iOS baseline does not.
Closes #1004.
Nested items used a fixed
marginLeftas their text indent, so their textstarted from the parent's marker column while their marker was drawn from their
own. Each nested item now starts its text from its own marker column, the way
iOS already lays it out, so every parent and child combination keeps the usual
marker-to-text gap.
The change is one term in
BaseListSpan.getLeadingMargin, next to themarkerExtraWidthfrom #1015. Each item records the column it reserves beforeany widening, and its nested items get it as
parentMarkerWidth. A nesteditem's margin is the difference between its own truncated absolute indent and
its parent's, plus its own widening. The widenings are whole pixels, so the
Intmargins and the float marker positions agree at every depth, includingtasks and bullets inside wide numbered lists. Top-level lists, and nests of the
same marker type with a whole-pixel
marginLeft(the default 24dp is 63 px on aPixel 9), are unchanged. With a fractional pixel
marginLeft, same-type nestsnow alternate whole-pixel steps instead of always truncating, so their text
stays one gap from the marker instead of drifting toward it by the fraction at
each level.
Both Android renderers get the same change:
react-native-enriched-markdownandthe standalone
enriched-markdown-android. iOS already renders these listscorrectly and is not touched. In the React Native package the toggled copy of a
task keeps
parentMarkerWidth, so toggling leaves every indent where it was.Testing
ListRenderingTestin both Android packages gains the mixed-nest cases: thegap for all six parent and child combinations (tasks checked and unchecked),
same-type and top-level geometry, absolute indents with fractional bullet
sizes and margins (including a run of same-type levels before a mixed child),
mixed ancestors followed by sibling lists, mixed nests in and around wide
numbered lists, wrapped lines, RTL, and equal
markerMinWidthcolumns.shortMixedNestsKeepTheirOriginalTextIndentspinned the old indents and isreplaced by
mixedNestsStartTheirTextFromTheirOwnMarkerColumn. The sharedListMarkerCanvasnow records square bullets (depth 2 and deeper) and eachparagraph's right edge and direction. With the old depth>0 margin, 6 of these
tests fail in each package; the same-type and equal-column tests pass either
way.
TaskListInteractionTest: toggling a task under a bullet andunder a number keeps every margin and drawn marker. It fails if the toggled
copy drops
parentMarkerWidth.testDebugUnitTest,ktlintCheckandlintDebugfor the standalonepackage, and the React Native package's unit tests and ktlint, pass.
mixed_nested_list_markers_test(bullets andnumbers both ways, and task lists) with baselines, and refreshed
mixed_nested_list_display(React Native and native Android examples) andlist_sublist_first_combo_display. I ran everylist-tagged flow in capturemode on
mainand on this branch on the repo'sPixel9-API36-EnrichedMarkdownAVD: those are the only captures that change, and the rebase leaves them
byte-identical to the pre-rebase baselines. One caveat: my AVD runs on x86_64
Linux with software rendering, and its captures of
maindiffer from thecommitted Android baselines by anti-aliasing (identical at 10% fuzz, including
ordered_list_wide_markers_*), and on a few flows by a shorter visible area.If these five baselines do not pass exact-match on your AVD, recapturing them
there should be all they need.
mixed_nested_list_testnow scrolls once on Android before its capture. In myemulator the preview was cut off after "1Django" without it, and the committed
baseline has the gesture bar over its last row.
https://github.com/mwolson/tmp-enriched-markdown-issues/tree/main/android-mixed-nested-list-indent
Screenshots
React Native example on Android (
mixed_nested_list_testandmixed_nested_list_markers_test), with iOS onmainfor reference:Native Android example,
mixed_nested_list_test:PR Checklist
listflows pass in capture mode; see Testing)