data loss with new C++ text buffer backend under some cirumstances
Closed this issue ยท 8 comments
Prerequisites
- Put an X between the brackets on this line if you have done all of the following:
- Reproduced the problem in Safe Mode: http://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode
- Followed all applicable steps in the debugging guide: http://flight-manual.atom.io/hacking-atom/sections/debugging/
- Checked the FAQs on the message board for common solutions: https://discuss.atom.io/c/faq
- Checked that your issue isn't already filed: https://github.com/issues?utf8=โ&q=is%3Aissue+user%3Aatom
- Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages
Description
Since Atom 1.19 enabling this plugin can lead to data loss.
Steps to Reproduce
- Enable autosave.
- Open a file.
- Enter
test
enter. - Save.
- Remove new line.
- Hit
cmd-w
.
Expected behavior: [What you expect to happen]
File should either be saved or atom should ask if you want to save the changes to the file.
Actual behavior: [What actually happens]
Empty file is saved.
Reproduces how often: [What percentage of the time does it reproduce?]
Evertime for removing new lines, happens in conjunction with prettier-atom in all cases where prettier changes the file. See: prettier/prettier-atom#264
Versions
- Atom: 1.19.7
- Atom-Shell:
- OS: Mac OS X 10.12.6
- Misc
- apm 1.18.4
- npm 3.10.10
- node 6.9.5 x64
- python 2.7.10
- git 2.11.0
Additional Information
Disabling the whitespace
package prevents this from happening. So I guess this happens whenever a package changes the buffer onWillSave
.
Yep, just checked, also happens when using editorconfig
instead of whitespace
.
@Ben3eeE I'm happy to help reproduce this, I tested this with atom --safe
and whitespace
and autosave
plugins enabled. It always saved an empty file when removing the trailing new line or adding a trailing whitespace to a line.
Wow thanks for the report and I apologize for this very serious regression. I'll be working on this today.
Thanks for working on this, luckily I lost nothing major, just refactoring grunt work ๐
~@despairblue I haven't been able to reproduce this yet; at the final step, when I type cmd-w
, I am prompted to save the file as expected. If instead of using cmd-w
I focus another window, Atom saves the correct contents of the file.~~
Does this happen if you run atom in safe mode?
Oh, nevermind. I had the Ensure Single Trailing Newline
option turned off. With that option enabled, I can reproduce this using your steps. Fixing now.
@despairblue This data loss bug is fixed on Atom's master branch. There is still a bug that when autosave is turned on, you get a save prompt when closing a tab with cmd-w
. I am looking into that one next.
@maxbrunsfeld Thank you โค๏ธ