Skip to content

Fix deleting a numbered-list item removing following items (#18)#25

Merged
Wavesonics merged 1 commit into
mainfrom
fix/issue-18-list-item-deletion
Jun 12, 2026
Merged

Fix deleting a numbered-list item removing following items (#18)#25
Wavesonics merged 1 commit into
mainfrom
fix/issue-18-list-item-deletion

Conversation

@Wavesonics

Copy link
Copy Markdown
Owner

Summary

Deleting a numbered-list item in the middle dropped every following item from the list.

Root cause

In RichSpanManager's single-newline delete branch (line merge), spans living entirely below the joined line were never re-added to the updated span set and kept stale line indices, so they were dropped. For an ordered list, deleting/merging a middle item removed every following item's OrderedListSpanStyle. (The multi-line delete path already decrements following-line offsets via transformOffset; only the newline-merge path was broken.)

Fix

Add the missing case: spans entirely below the joined line have their start/end line index decremented by one to follow the upward shift.

Tests

  • New regression test deleting a middle ordered-list item keeps following items in the list (in markdown.OrderedListSerializationTest) — fails before, passes after.
  • Full suite: :ComposeTextEditor:desktopTest — 430 tests, 0 failures.

Fixes #18

When a single newline was deleted to merge two lines, RichSpanManager did
not remap spans living entirely below the joined line, so they kept stale
line indices and were dropped. Deleting a middle ordered-list item therefore
removed every following item from the list. Decrement those spans' line
indices to follow the upward line shift.

Fixes #18

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Wavesonics Wavesonics marked this pull request as ready for review June 12, 2026 06:04
@Wavesonics Wavesonics merged commit 0d8f744 into main Jun 12, 2026
1 check passed
@Wavesonics Wavesonics deleted the fix/issue-18-list-item-deletion branch June 12, 2026 06:47
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.

Deleting a numbered-list item removes all following list items

1 participant