abrookins / WrapToColumn

An IntelliJ plugin that wraps text
Apache License 2.0
62 stars 12 forks source link

Wrong wrapping of markdown list items at higher levels #54

Open NikolausDemmel opened 1 year ago

NikolausDemmel commented 1 year ago

In markdown, wrapping paragraphs works great for list items at the first level.

However, at higher levels it behaves strangely and removes some text from the start.

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras sit amet dapibus massa. Ut feugiat risus ut neque facilisis, faucibus tempus est posuere.
  - Donec finibus in mi at imperdiet. In hac habitasse platea dictumst.

--> "Wrap Paragraph" with the cursor on the "Donec..." line results in:

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras sit amet dapibus massa. Ut feugiat risus ut neque facilisis, faucibus tempus est posuere.
  - nec finibus in mi at imperdiet. In hac habitasse platea dictumst.

If you first format the Lorem ... line (which works correctly):

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras sit amet dapibus massa. Ut feugiat
  risus ut neque facilisis, faucibus tempus est posuere.
  - Donec finibus in mi at imperdiet. In hac habitasse platea dictumst.

and then the "Donec..." line, you get the following (also wrong):

- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras sit amet dapibus massa. Ut feugiat
  risus ut neque facilisis, faucibus tempus est posuere. - Donec finibus in mi at imperdiet. In hac
  habitasse platea dictumst.