atom / settings-view

🔧 Edit Atom settings
MIT License
272 stars 275 forks source link

Opening settings view rewrites newline characters in config.cson #560

Open evanwarner opened 9 years ago

evanwarner commented 9 years ago

General issue: I have a few key:value pairs in my config.cson file that have "\n" as the value. If I open Atom's settings view, those values get immediately overwritten with triple quotes surrounding blank lines of indentation.

So for example:

    "space-after-opening-brace": "\n"

becomes

    "space-after-opening-brace": '''

    '''

The issue is recreatable in safe mode, and no errors appear in the dev tools.

Specific details: If I leave Atom open and edit the config file back to the correct "\n" values, I can toggle back and forth to settings and it will stay correct. However, if I change any settings or enable/disable a package, the config file is overwritten again.

bug

Atom v1.0.0 on OS X 10.9.5

Moved from https://github.com/atom/atom/issues/7569

benogle commented 9 years ago

I can reproduce this. Super weird that it makes 2 newlines with indentation.

evanwarner commented 9 years ago

I've noticed that whatever triggers this error also adds more indentation every time it happens. Open config.cson and settings view in different panes (so you can watch the config file) then just keep toggling the "Audio Beep" checkbox. Additional indentation will be added with every toggle.

benogle commented 9 years ago

I've noticed more indentation on each update as well. Sorry about this.

evanwarner commented 9 years ago

So I've just discovered some more quirky behavior that may help figure this out. The package I'm configuring with those newline values is CSSComb. By default this plugin has no configurable settings in Settings > Packages > CSSComb. When I manually enter the configuration into config.cson, then visit Settings > Packages > CSSComb, all the options I manually set have gained GUI config fields in the package settings. (I assume this is a feature of settings view.)

However, as soon as I open Settings > Packages > CSSComb, my config.cson goes into an infinite loop, appending more indentation every half second. Closing settings view does not stop this. Closing config.cson does not stop this. I have to quit Atom otherwise it will just continue to write indentation.

So then I tried something else: I edited config.cson back to normal, but instead of "\n" I just put "xxx" in for those values. As expected, nothing unusual happened when I opened Settings > Packages > CSSComb. Then I went and copied a hard return character and pasted it directly into one of the GUI config fields that was now enabled. The indentation bug started happening in the GUI field itself. It expanded to two lines and every half second appended a chunk of indentation.

So it seems that the textfields in settings view don't like having newline characters within them.