Skip to content

[BUG] Auto formatting sometimes mess up list order #17

@YousefHadder

Description

@YousefHadder

Description

In some weird cases, if you have an numbered list, and you have a couple of empty list items, auto-formatting will mess up the ordering of the list.

Also when that happens, the undo keymap doesn't work properly.

Steps to Reproduce

  1. Start a numbered list of 3 items
  2. On items number 2, press o in normal mode, or <CR> in insert mode
  3. Repeat step 2 on the last item
  4. Save the changes, if auto-format is configured on save, the list items numbering will get messed up.

Expected Behavior

It should either delete the empty list items, or not change the numbering.
Also undo behavior should not get affected by this.

Actual Behavior

The items numbers get randomly changed:

  1. A
  2. b
  3. c

Environment

  • Neovim version: (output of nvim --version)
  • Plugin version: (commit hash or tag)
  • OS: (macOS, Linux, Windows, etc.)

Additional Context

This is before Auto-format:
Image

This is after Auto-format:
Image

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions