mirror of
https://github.com/atom/atom.git
synced 2026-02-09 14:15:24 -05:00
Add config.editor.showInvisibles
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
fs = require 'fs'
|
||||
_ = require 'underscore'
|
||||
EventEmitter = require 'event-emitter'
|
||||
|
||||
module.exports =
|
||||
class Config
|
||||
@@ -8,14 +9,23 @@ class Config
|
||||
@configJsonPath = fs.join(@configDirPath, "config.json")
|
||||
@userInitScriptPath = fs.join(@configDirPath, "atom.coffee")
|
||||
|
||||
@core = {}
|
||||
@editor = {}
|
||||
|
||||
load: ->
|
||||
if fs.exists(@configJsonPath)
|
||||
userConfig = JSON.parse(fs.read(@configJsonPath))
|
||||
_.extend(this, userConfig)
|
||||
@requireUserInitScript()
|
||||
|
||||
update: ->
|
||||
@trigger 'update'
|
||||
|
||||
|
||||
requireUserInitScript: ->
|
||||
try
|
||||
require @userInitScriptPath if fs.exists(@userInitScriptPath)
|
||||
catch error
|
||||
console.error "Failed to load `#{@userInitScriptPath}`", error.stack, error
|
||||
|
||||
_.extend Config.prototype, EventEmitter
|
||||
|
||||
@@ -60,6 +60,7 @@ class Editor extends View
|
||||
|
||||
@id = Editor.idCounter++
|
||||
@lineCache = []
|
||||
@configure()
|
||||
@bindKeys()
|
||||
@handleEvents()
|
||||
@cursorViews = []
|
||||
@@ -296,7 +297,12 @@ class Editor extends View
|
||||
scanInRange: (args...) -> @getBuffer().scanInRange(args...)
|
||||
backwardsScanInRange: (args...) -> @getBuffer().backwardsScanInRange(args...)
|
||||
|
||||
configure: ->
|
||||
@setShowInvisibles(config.editor.showInvisibles ? false)
|
||||
|
||||
handleEvents: ->
|
||||
config.on "update.editor#{@id}", => @configure()
|
||||
|
||||
@on 'focus', =>
|
||||
@hiddenInput.focus()
|
||||
false
|
||||
@@ -658,6 +664,7 @@ class Editor extends View
|
||||
@destroyEditSessions()
|
||||
|
||||
$(window).off ".editor#{@id}"
|
||||
config.off ".editor#{@id}"
|
||||
rootView = @rootView()
|
||||
rootView?.off ".editor#{@id}"
|
||||
if @pane() then @pane().remove() else super
|
||||
|
||||
Reference in New Issue
Block a user