fix: reset list numbering when switching from unordered to ordered list#7436
Merged
JohnMcLear merged 1 commit intoether:developfrom Apr 3, 2026
Merged
Conversation
When an ordered list followed directly after an unordered list (no blank line between), all OL items showed "1" instead of incrementing. This was because renumberList's applyNumberList function counted bullet items in the position counter, so the first OL item got start=3 (after 2 bullet items) instead of start=1, preventing the CSS counter-reset class from being applied. The fix resets the position counter when the list type changes at the same level (e.g., bullet -> number). Fixes: ether#5160 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Review Summary by QodoFix ordered list numbering after unordered list
WalkthroughsDescription• Reset list numbering counter when switching from unordered to ordered lists • Fixes ordered list items showing "1" instead of incrementing after bullet lists • Adds regression test for issue #5160 with multiple list type transitions Diagramflowchart LR
A["Unordered list items<br/>position counter increments"] -->|"List type changes<br/>bullet to number"| B["Reset position to 1"]
B --> C["Ordered list items<br/>numbered correctly 1,2,3"]
File Changes1. src/static/js/ace2_inner.ts
|
Code Review by Qodo
1. Forced toolbar clicks
|
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.
Summary
One-line logic fix in
ace2_inner.ts'sapplyNumberListfunction: reset thepositioncounter when the list type changes at the same nesting level (e.g., bullet -> number).Root Cause
renumberListwalks backward to find the first line of a contiguous list block, then walks forward throughapplyNumberListto assignstartvalues. The function counted all list items at the same level in a singlepositioncounter — regardless of whether they were bullet or number items.When an ordered list followed an unordered list:
The first OL item got
start=3instead ofstart=1. Sincedomline.tsonly applies thelist-start-number1CSS class whenstart === 1, the CSScounter-resetnever fired and all OL items displayed as "1".Test plan
issue #5160 ordered list increments correctly after unordered listpassesmessages.tstests pass (10/10)Fixes #5160
🤖 Generated with Claude Code