burodepeper / language-markdown

Add support for Markdown to Atom (including Github flavored, Markdown Extra, CriticMark, YAML/TOML front-matter, and R Markdown), and smart behavior to lists.
https://atom.io/packages/language-markdown
MIT License
119 stars 295 forks source link

reproduce leading whitespaces of prev line when adding new list items #240

Closed hbschr closed 5 years ago

hbschr commented 6 years ago

in lists with more than one whitespace between list marker "add new list items" will inconveniently create list items with only one space. example, where _ marks cursor position after creating new item:

-   item1
-   item2
- _

this pr adds whitespaces in new item like so:

-   item1
-   item2
-   _

this may also fix #238

burodepeper commented 6 years ago

Thanks for the PR. Looks good.

Could you have a look whether it's reasonable to add some tests for this feature? The code that adds the new list items is currently implemented as an anonymous function in the activate method, and I intend to refactor this at some point. The tests would help a lot in preventing regressions, and for catching edge cases.

hbschr commented 5 years ago

and here are the tests. have fun :-)

burodepeper commented 5 years ago

Kudos for you! Will have a look soon