atom / settings-view

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

Opening Settings View clobbers my Invisibles setting #237

Open lee-dohm opened 10 years ago

lee-dohm commented 10 years ago

I like to have "Show Invisibles" on, but I don't like seeing the line ending unless it includes a CR (which is an improper line ending for my files). So I disable the "EOL" line ending character by setting it to empty. But with a recent change to Settings View (haven't tracked down exactly which yet), EOL gets set to the default because empty is treated as equivalent.

Atom Version: 0.125.0-805c62 OS Version: OS X 10.9.4

Repro Steps

  1. Edit config.cson to set editor.invisibles.eol to be ''
  2. Open Settings View

Expected: Line Endings EOL setting should be empty Actual: Line Endings EOL setting shows as Default: ¬

  1. Close Settings View
  2. Open config.cson

Expected: editor.invisibles.eol should be '' Actual: editor.invisibles.eol has been removed (which sets it to the default)

Workaround

I suppose a workaround is to set the EOL character to a space character of some sort zero-width or otherwise (although now I'm wondering if the input in the boxes is trimmed and then we're back to square one), but long-term I think there should be a method to differentiate between the empty string and "set this to the default".

lee-dohm commented 10 years ago

Putting a single space in the EOL setting seems to work as a workaround for now.

hmemcpy commented 9 years ago

I figured it out!

I had the same problem (issue https://github.com/atom/atom/issues/6033), I couldn't understand why opening and closing the settings tab removed my invisibles. Turns out, much like @lee-dohm, I set some of the characters to '', e.g.:

"*":
  editor:
    invisibles:
      eol: ''
      cr: ''
      ...

Turns out, after reading the settings schema, that invisibles support boolean toggles. So after writing the settings like so:

"*":
  editor:
    invisibles:
      eol: false
      cr: false
      ...

This configuration remains even after opening and closing the Settings tab.

So the bug is with handling the default values of invisibles when they are empty strings!

bastilian commented 8 years ago

In config-schema invisibles mentions now that these can be set to false to not show them, but this is not shown in the settings view.

It would make sense to simple show the description in the settings view if on exists for settings objects. Also, adding checkboxes for ['boolean', 'string'] types (currently only invisibles) would make illustrate that fact even more. I was thinking something like this (as proposed in #442):

screen shot 2016-06-24 at 16 22 47

When the checkbox is not enabled the editor would be disabled. maybe even hidden (in that case I would group the checkbox with the label.

And I would change the title for these settings to "Show...", so it is more apparent what the current state of the settings mean.