sindresorhus / atom-editorconfig

Helps developers maintain consistent coding styles between different editors
https://atom.io/packages/editorconfig
MIT License
812 stars 80 forks source link

insert_final_newline being removed and added again every save #121

Closed scttcper closed 7 years ago

scttcper commented 7 years ago

I'm back. When using insert_final_newline = true the final line at the bottom is being removed and added again every save. This blocks the undo button.

How to test:

  1. Write some text on line 1
  2. Manually add your own final newline
  3. Write more text on line 1
  4. Save
  5. Undo (ctrl + z) should remove the text written in step 3 but instead it removes a newline that is being removed and written every save.
florianb commented 7 years ago

I hoped it would be you.. 😁 Let me check that, but it is likely the undo-history is changed.

florianb commented 7 years ago

Okay.. i guess i have to apologize. The insert_final_newline-algorithm is badly implemented. I will fix that.

Would you either expect to have insert_final_newline create an undo-marker, if a final newline was added, or should it add the final newline silently? I guess i would prefer first, since every change should create an undo-marker, eh?

scttcper commented 7 years ago

I would expect a marker if it was added yeah

I think thats how whitespace works too.

florianb commented 7 years ago

Aye.. expect a patch soon.

florianb commented 7 years ago

Hey @scttcper, the new patch is published. 🙏

scttcper commented 7 years ago

10/10 👍